mzsk / tinypy

Automatically exported from code.google.com/p/tinypy
Other
0 stars 0 forks source link

print statement needs documentation #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I tried 3 ways of printing, and tinypy doesn't match Python's behavior
(only the last one works).  I didn't see anything about this in the docs. 
In practice nearly all Python programs contain print statements, so this is
likely to be one of the first things that people run into when trying tinypy.

And if you didn't know print is a special case in Python 2.x (which is a
bit unfortunate and changing in Python 3000) -- it looks like you have
implemented it as a normal function.

(Very cool project BTW)

tinypy-read-only$ ./build/tinypy ../tinypy-test/hello.py

Exception:
error: invalid statement
   1: print 'hello world'
            ^

tinypy-read-only$ ./build/tinypy ../tinypy-test/hello2.py

Exception:
error: invalid statement
   1: print "hello world"
            ^

tinypy-read-only$ ./build/tinypy ../tinypy-test/hello3.py
hello world

tinypy-read-only$ cat ../tinypy-test/hello3.py
print("hello world")

Original issue reported on code.google.com by andyc...@gmail.com on 14 Sep 2008 at 11:54

GoogleCodeExporter commented 9 years ago
Correct, print was written as a function.  No support is planned for the 2.x 
way of
writing print statements.

Can someone document this?

Original comment by philhas...@gmail.com on 14 Sep 2008 at 2:44

GoogleCodeExporter commented 9 years ago
This is the correct behaviour for python 3.0+

is tinypy based on this codebase, or was this purely by accident?

Original comment by mikey.be@gmail.com on 3 Mar 2009 at 1:25

GoogleCodeExporter commented 9 years ago
I don't think there is any such need.After all it is subset of python.So it is
understood.

Original comment by puneet0...@gmail.com on 3 Mar 2009 at 1:52

GoogleCodeExporter commented 9 years ago
This is by design.

Original comment by philhas...@gmail.com on 4 Mar 2009 at 12:09