On 14/11/2011 19:31, Francesco Maida wrote:
Si esatto, l'Hungarian notation.
Devo dire che mi sentirei letteralmente *PERSO* senza quella, perchè
non saprei ricordare se una particolare variabile che uso ad esempio è
una stringa, un booleano o un intero.

Ti spiego qual'è il punto:

Python 3.1.2
>>> def add(a,b):
...     return a + b
...
>>> add('a', 'b')
'ab'
>>> add(2, 1)
3
>>> add(True,False)
1
>>> add([1,2,3],['a','b','c'])
[1, 2, 3, 'a', 'b', 'c']
>>> add( { 1:'a',2:'b'},{3:'c',4:'e'})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in add
TypeError: unsupported operand type(s) for +: 'dict' and 'dict'

Che prefisso metteresti ai due parametri della funzione add?



--
Wyrmskull
_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python

Rispondere a