Python vs. Io

Jp Calderone exarkun at intarweb.us
Sat Jan 31 15:38:02 EST 2004


On Sat, Jan 31, 2004 at 12:20:52PM -0800, Daniel Ehrenberg wrote:
> > Perhaps it isn't more flexible.  On the other hand, it does allow anyone 
> > to read your code and know that there isn't any magical syntax that is 
> > usable on one Python x.y installation, that isn't on another.
> > 
> >   - Josiah
> 
> What are you talking about? There's tons of new "magical syntax" in
> Python. Examples for "magical syntax" features that don't work on
> 1.5.2 include:
> *List comprehensions

  Yep.

> *String methods

  Nope.  The syntax is identical.  Strings just happen to have more useful
attributes new.

> *Generators

  Yep.

> *Emulating numeric types

  Nope.  Never seen __coerce__? :)

> *Nested scopes

  Hmm.  Not really a syntactic difference... The syntax is the same, after
all, but the behavior is definitely different.

> * * and ** in function declarations

  Yep.

> *for line in this_file

  Nope.  Same as with strings, the iterator protocol, a set of methods with
a defined meaning, was added, and file objects were made to implement it. 
No syntactic changes.

> *Subclassing types
> 

  This is another iffy one.  The syntax is no different, the behavior has
just been changed.  "str", "int", etc, used to be builtin functions, not
type objects.  You also couldn't subclass types in Python, but if you could
have, the syntax would have been identical to what it is today.

> There's tons of stuff still being added to Python.

  Definitely.  But "stuff" isn't always the same as "magical syntax".
 
  Jp




More information about the Python-list mailing list