tag:blogger.com,1999:blog-10678074.post2832326178216530806..comments2024-03-18T21:40:59.116+00:00Comments on making apps, making webs.: python 3000 breaks hello worldUnknownnoreply@blogger.comBlogger15125tag:blogger.com,1999:blog-10678074.post-48547249742924487982012-07-21T13:03:16.385+01:002012-07-21T13:03:16.385+01:00its now 2012 and ive just downloaded and installed...its now 2012 and ive just downloaded and installed python 3.2.3., tried print "hello world", and got the SyntaxError message. <br /><br />Not a big problem, took me less then a minute of googling to find the answer. Also, there was a warning on the download page.xbb1024https://www.blogger.com/profile/12759592345383580249noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-86852015637539141542009-08-15T06:08:50.662+01:002009-08-15T06:08:50.662+01:00thanks you SO much for posting this, and to your r...thanks you SO much for posting this, and to your respondents for helpful answers. I thought I must be losing my marbles!<br /><br />back to the stable version I go. Yay.pomo housewifehttps://www.blogger.com/profile/15435987785993072179noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-50734007230127748242007-09-12T21:40:00.000+01:002007-09-12T21:40:00.000+01:00All functions entered this way produce the same ob...All functions entered this way produce the same obtuse message.<BR/><BR/>Perhaps, for the interactive shell at least (though this could be nice even at run time, I suppose), offer to show the syntax of the function in question?<BR/><BR/>---<BR/><BR/>>>> len "string"<BR/> File "<stdin>", line 1<BR/> len "string"<BR/> ^<BR/>SyntaxError: invalid syntax<BR/><BR/>"len" is a built-in function<BR/><BR/>Would you like to see help( len ) ([Y]/N)?<BR/><BR/>---<BR/><BR/>Or, perhaps, simply show the doc string (with "more" as apropos)?<BR/><BR/><BR/>I've long thought that "print" should be a function, just for consistency. (Obviously, I like not needing parens currently, however. ;)<BR/><BR/>-LarzLarzhttps://www.blogger.com/profile/09758314759650956081noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-44971148315759642522007-09-11T14:39:00.000+01:002007-09-11T14:39:00.000+01:00Here Guido shoots down a similar proposal.<A HREF="http://www.mail-archive.com/python-3000@python.org/msg09373.html" REL="nofollow">Here Guido shoots down</A> a similar proposal.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-10678074.post-61554553611400177962007-09-11T12:31:00.000+01:002007-09-11T12:31:00.000+01:00One approach would be to allow:print 'hello world'...One approach would be to allow:<BR/><BR/>print 'hello world'<BR/><BR/>as valid syntax for calling a function (as well as the traditional syntax). <A HREF="http://www.lua.org/" REL="nofollow">Lua</A> allows this (when the argument is a single string or a single table) and it's really great. ML also allows it, in fact it's the only syntax for calling a fuction in ML.<BR/><BR/>I'd have to sit down properly with the Python syntax to see what grammatical problems it introduces (and it usually does).Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-10678074.post-15054162032302397482007-09-05T18:48:00.000+01:002007-09-05T18:48:00.000+01:00Such a module would have to modify Python's syntax...Such a module would have to modify Python's syntax, even introducing print as a keyword again. That's possible with PyPy in some cases.. but I don't think it will be with Python 3.<BR/><BR/>I do agree with people that want print to become a function rather than a statement. On its own, print relies on sys.stdout being something appropriate - which is often not the case on GUI and embedded systems. Statements part of a language system should not depend on the library.<BR/><BR/>Python 3.0 will be known to break compatibility in other places, so learning Python 3 from an earlier tutorial is likely to break anyway. I'm sure most tutorials will be updated, at least with a note that they apply to pre 3.0 versions.<BR/><BR/>As for providing a better error message like for help, how do you propose to do that? "help" is an object with a string representation - so typed on it's own on the console, that representation is printed. Type<BR/><BR/>help "something"<BR/><BR/>on the console and you'll get a syntax error just as for<BR/><BR/>print "something"<BR/><BR/>To provide a "good" error message there as you describe, you would have to catch that special case in the parser, which is an overall bad idea. For one thing you'll be making unnecessary checks for code that is not running in an interactive shell.<BR/><BR/>The fact remains that NAME LITERAL is a parse error and should be presented just like that. Otherwise we'd have to catch other cases as well, like<BR/><BR/>>>> str 10<BR/>Use str(10) if you want to convert a type to a string.Arnar Birgissonhttps://www.blogger.com/profile/12073820949049315334noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-24899174552546576092007-09-04T21:50:00.000+01:002007-09-04T21:50:00.000+01:00Brandon: It's not far too late to change it.Howev...Brandon: It's not far too late to change it.<BR/><BR/>However this post is mainly about addressing the problem that does exist - for those people who it will matter most. Those people being the total newbies reading some documentation for python1x - python2.x.<BR/><BR/>A syntax error with a "print is a function now" type message would also be nice - as well as the extra help message in the shell.<BR/><BR/>Guido actually got boos at europython when he mentioned print was becoming a function in his talk - so people feel quite strongly about it.<BR/><BR/>All the print debug people are just going to have to suck it up it seems. OR write a hack which allows nice print.<BR/><BR/>Something like:<BR/>easy_install-3.0 nice_print<BR/><BR/>Then people who like elegant print can just put something in their personal python directory and get away with using the good print.<BR/><BR/>I think it'll be one of the most popular modules on the cheeseshop.René Dudfieldhttps://www.blogger.com/profile/17762358075557755436noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-59352089203774480632007-09-04T14:48:00.000+01:002007-09-04T14:48:00.000+01:00There’s no point in acting all surprised about it....There’s no point in acting all surprised about it. PEP 3000 has been on display in your local planning department on Alpha Centauri for fifty of your Earth years, so you’ve had plenty of time to lodge any formal complaint and it’s far too late to start making a fuss about it now.Brandon Corfmanhttps://www.blogger.com/profile/01765211985760464677noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-2331791241830934622007-09-02T08:10:00.000+01:002007-09-02T08:10:00.000+01:00Crikey. All these people berating illume for tryin...Crikey. All these people berating illume for trying the alpha release are missing the point that this will be an issue in the final Python 3.0 as well.<BR/><BR/>As Andrew Dalke indicated, the problem is that the canonical "Hello World" program now has to be written differently depending on which version of Python you're using -- and the error you get when you get it wrong might be enough to put off a beginner ("but the tutorial/book says to write 'print "hello world"' and that's not working! Stupid language!")Richard Joneshttps://www.blogger.com/profile/04600262656208358816noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-27493616712636133562007-09-02T01:57:00.000+01:002007-09-02T01:57:00.000+01:00We didn't break Hello World -- you're writing it w...We didn't break Hello World -- you're writing it wrong.Collin Winterhttps://www.blogger.com/profile/15620556415033181797noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-89078535091837515682007-09-01T21:11:00.000+01:002007-09-01T21:11:00.000+01:00And there will be a Python 2.x to 3.0 conversion p...And there will be a Python 2.x to 3.0 conversion program(s).Unknownhttps://www.blogger.com/profile/13794490952663705668noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-72426296963031133002007-09-01T20:45:00.000+01:002007-09-01T20:45:00.000+01:00I would probably grab the most recent stable relea...I would probably grab the most recent stable release not the alpha release. Otherwise, unless you might actually wish to contribute to in development Python 3000, your wasting your time.Brian Rayhttps://www.blogger.com/profile/08873023023007310687noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-27304333625260456822007-09-01T16:04:00.000+01:002007-09-01T16:04:00.000+01:00Given the blog author's other posts on Python, I s...Given the blog author's other posts on Python, I suspect the phrase "learning Python" was used more for rhetorical exaggeration. That is, once Python 3K is stable and released, a beginning programmer - who doesn't know the difference between Python 3K and Python <3K - might like some better guidance in the traceback error.<BR/><BR/>Then illume points out that it might be help that the shell can provide, and not even be part of the language.Andrew Dalkehttps://www.blogger.com/profile/17091314849699854287noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-81189535963688993902007-09-01T15:19:00.000+01:002007-09-01T15:19:00.000+01:00The first few Python 3.0 alpha releases will be ve...The first few Python 3.0 alpha releases will be very unstable. Some features are turned off, some unimplemented and some will change due to user feedback. Only people who are familiar with Python *and* constantly follow the Python-3000 mailing list have any hope of keeping up. Please take Paddy's advice to stick to Python 2.5.x for now.James Thielehttps://www.blogger.com/profile/04335807773215473429noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-74296515971329732212007-09-01T06:31:00.000+01:002007-09-01T06:31:00.000+01:00If you are learning Python then you should not be ...If you are learning Python then you should not be using the Alpha release of a new version of Python that is heavily advertised as being allowed to break compatibility with older versions to allow a general tidy-up of the language.<BR/><BR/>Talk to the person who installed the version of Python about not making the alpha version the default, and get access to <A HREF="http://www.python.org/download/" REL="nofollow"> version 2.5.1</A>.<BR/><BR/>Python 3 should not be used by beginners as yet - its going through alpha testing by the community.<BR/><BR/>- Paddy.Paddy3118https://www.blogger.com/profile/06899509753521482267noreply@blogger.com