En Tue, 22 Apr 2008 13:50:54 -0300, Jérémy Wagner <[EMAIL PROTECTED]> escribió:

> Sure. Python is more readable than Perl, though I have found Python
> to have a weird behavior regarding this little issue :
>
> How can you explain that Python doesn't support the ++ opeator,
> whereas at the same time it does support the += operator ???
>
> No python developer I know has been able to answer that.

Because Python doesn't follow the "boxed variables" model. In other languages 
i++ changes the "value" stored inside the box "i", but the box itself (the 
variable) is still the same. Python doesn't have boxes, it has names that refer 
to objects. For all builtin numeric types, i += 1 creates a *new* object with 
the resulting value and makes the name "i" refer to this new object.
i++ would be confusing because it looks like a mutating operation over i, but 
in fact it would be an assignment.

-- 
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to