Objects in Python

Jan Kuiken jan.kuiken at quicknet.nl
Thu Aug 23 16:43:41 EDT 2012


On 8/23/12 20:17 , Ian Kelly wrote:

...

>>> Well, there you go. There *is* something wrong with having six variables
>>> called 'q'.

>> Sometimes you don't want only six variables called 'q' but a hundred
>> of them :-)
>>
>>    def fac(q):
>>        if q < 1 :
>>            return 1
>>        else:
>>            return q * fac(q-1)
>>
>>    print(fac(100))

> That's only one variable called 'q', instantiated 100 times simultaneously.

Bare with me, i come from a C world, and think of each variable,
whatever its name or scope, as a piece of memory and therefore
different.
btw. I like the idea of simultaneously instantiation :-)

Jan Kuiken



More information about the Python-list mailing list