This coding style bad practise?

Martin P. Hellwig mhellwig at xs4all.nl
Wed May 3 19:04:24 EDT 2006


Bruno Desthuilliers wrote:
<cut>
> 
> Why not just use the call operator instead ? ie:
> 
>  >>> id = IDGenerator(...)
>  >>> id()
> 01_20060424_151903_1
>  >>> id()
> 01_20060424_151905_2
> 

Because of:
>>>> id = IDGenerator("01",99)
>>>> id()
> Traceback (most recent call last):
>   File "<pyshell#1>", line 1, in ?
>     id()
> TypeError: 'IDGenerator' object is not callable
>>>> 

But i do appreciate your comment, thanks!

-- 
mph



More information about the Python-list mailing list