Why should I switch to Python?

ben at co.and.co ben at co.and.co
Thu May 11 11:19:58 EDT 2000


Charlie Derr <charlie at intelligenesis.net> wrote:
> [Tim Peters]
> ~
> ~ [Grant Griffin]
> ~ > Speaking of C, I find myself missing the "x=" operators, and "++".
> ~ > However, I understand and endorse the reasons Python omits them.
> ~
> ~ While ++ makes little sense in a language with immutable numbers,
> 
> I'm probably missing something obvious here, but why?
> 
> The only weird part that i see is that in order to implement it you would
> have to do a type check and make sure the operand is of type integer, which
> certainly seems to violate python's spirit, but I don't understand what's
> relevant about numbers being immutable.   I never write "5++" it's always
> "varName++", which can obviously be done the long way with "varName =
> varName + 1".   Couldn't this be implemented with assignment in this
> fashion?  (not that i would want it to be done, i'm just curious)
 
There will be some surprises:

def malicious_print(i):
	i++
	print i

malicious_print(5) # Huh?
b = 5
malicious_print(b)
print b		   # Huh?

Greetings,
-- 
ben . de . rydt at pandora . be ------------------ your comments
http://users.pandora.be/bdr/ ------- inl. IPv6, Linux en Pandora




More information about the Python-list mailing list