Martin P. Hellwig a écrit :
> Hi all,
> 
> I created a class which creates a relative unique id string, now my 
> program just works fine and as expected but somehow I get the feeling 
> that I misused the __repr__ since I guess people expect to 'execute' a 
> function in an instance instead of using it's representation string of 
> the instance itself, could you elaborate whether you find this bad 
> practice and if yes what would have been a better way to do it?

Why not just use the call operator instead ? ie:

 >>> id = IDGenerator(...)
 >>> id()
01_20060424_151903_1
 >>> id()
01_20060424_151905_2

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

Reply via email to