[Python-3000] [Python-ideas] Namespaces are one honking great idea -- let's do more of those!

Charles Merriam charles.merriam at gmail.com
Mon Feb 4 19:04:27 CET 2008


How about the ellipses as a Python 3 marker?

>From a previous discussion, the error messages on this null-op should
be made better in Python 3.0 anyway.

If ellipses are allowed as a stand-alone statement, much like pass,
then we could just have these messages:

Python 2.6:  "Unexpected '...'.   Ellipses not supported until Python
3.0.   Another cause might be pasting in code from within the IDLE
interpreter.

Python 3.0:  'Unexpected '...'.  Might be caused by pasting in code
from within the IDLE interpreter.

An idiom that might be used during the early transition period:

   ...    # Require python 3.x
   print ("I'm Pythonic!")

The idiom would disappear with time, not add special cruft to the
language, and would give a reasonable compile-time error message.

Just a thought,

Charles
---
Charles Merriam
e:  charles.merriam at gmail.com
u:  http://www.charlesmerriam.com
q:  "Crufty solutions make crufty curmudgeons."


On Feb 2, 2008 11:47 PM, Gregory P. Smith <greg at krypto.org> wrote:
> yep we've already been through that problem in the past when list
> comprehensions, generators and with were added to name a few.  since python
> 3 code is highly unlikely to even parse with a 2.x interpreter much of the
> time thats a reason to consider a .py3 extension if this precedent of not
> caring is to be broken.
>
> -0 on using .py3 instead of .py for python 3.  i think its slightly silly
> but i won't object.
>
> +1 on devising a way (to appear starting in 2.6 and 3.0) of marking the
> minimum language version required by a file near the top so that the parser
> can bail with a useful error message instead of one confusing to the lay
> person.  similar to a from future import type of thing perhaps?  or should
> python parse a #! line and magically notice a required major version number
> in the python binary name (evil but it would work and magically annotate a
> bunch of existing code as 2 vs 3)?
>
> also yes python 3 should build and install as 'python3' as the short form of
> its name though realistically anyone sane will write their code with #!
> lines specifying the actual version in the executable name and have shell
> aliases setup if they want an even shorter name.
>
>
>
> On 2/2/08, skip at pobox.com <skip at pobox.com> wrote:
> >
> >
> >
> >
> >     Leif> There is already an idiom with other packages (pygtk etc.) that
> >     Leif> suggests syntax like
> >
> >     Leif> try:
> >     Leif>     python.require('3.1')
> >     Leif> except:
> >     Leif>     print('Some warning about version incompatibility')
> >     Leif>     exit(1)
> >
> > It won't work in this case.  Compilation of the module might well fail
> > because of Python2/Python3 syntax differences.
> >
> > Skip


More information about the Python-3000 mailing list