Python Success stories

Paul Boddie paul at boddie.org.uk
Wed Apr 23 07:43:56 EDT 2008


On 23 Apr, 11:12, Mark Wooding <m... at distorted.org.uk> wrote:
> Gabriel Genellina <gagsl-... at yahoo.com.ar> wrote:
> > Because Python doesn't follow the "boxed variables" model.
>
> Be careful here.  `Boxed types' or `boxed objects' is a technical term
> essentially meaning `heap-allocated objects, probably with reference
> semantics', which Python most definitely does use -- so this almost
> means the opposite of what you're talking about.

I think Gabriel meant "variables as boxes" - the classic description
of variables in "old school" programming languages, which is in
contrast to the "variables as labels" model used by Python.

[...]

>              This won't hold in Python, since assignments (which `++'
> assuredly ought to be) aren't allowed as subexpressions anyway.

This syntactic note is probably one of the biggest arguments against
it, yes, since many of the benefits it has in C would be absent in
Python.

[...]

> That's not quite true, in fact: it might be useful to define other kinds
> of incrementing for specialist types, but I can't think of any obvious
> examples off the top of my head.

Well, as I recall, data structures in C++ (such as iterators) often
use the pre/post-increment/decrement operators as shorthand, arguably
reflecting the "pointer arithmetic" heritage of the C family of
languages. It would be pure sugar in Python, though.

Paul



More information about the Python-list mailing list