Re: This coding style bad practise?

2006-05-04 Thread bruno at modulix
Carl Friedrich Bolz wrote: Bruno Desthuilliers wrote: Martin P. Hellwig a écrit : 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'

Re: This coding style bad practise?

2006-05-04 Thread bruno at modulix
Martin P. Hellwig wrote: 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

Re: This coding style bad practise?

2006-05-04 Thread Martin P. Hellwig
bruno at modulix wrote: Martin P. Hellwig wrote: 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

Re: This coding style bad practise?

2006-05-04 Thread Martin P. Hellwig
cut Thanks for the input folks! I adapted my script to the given suggestions and it's now far more 'logical', for reference I added it below. -- mph - script - import string import time class IDGenerator(object): (leading_id, subversion_length, tz) # tz = 'local' or 'gm'

This coding style bad practise?

2006-05-03 Thread Martin P. Hellwig
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

Re: This coding style bad practise?

2006-05-03 Thread Bruno Desthuilliers
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

Re: This coding style bad practise?

2006-05-03 Thread keirr
Martin P. Hellwig wrote: 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

Re: This coding style bad practise?

2006-05-03 Thread Carl Friedrich Bolz
Bruno Desthuilliers wrote: Martin P. Hellwig a écrit : 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

Re: This coding style bad practise?

2006-05-03 Thread Carl Friedrich Bolz
Bruno Desthuilliers wrote: Martin P. Hellwig a écrit : 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

Re: This coding style bad practise?

2006-05-03 Thread Martin P. Hellwig
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()

Re: This coding style bad practise?

2006-05-03 Thread Martin P. Hellwig
keirr wrote: Martin P. Hellwig wrote: 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

Re: This coding style bad practise?

2006-05-03 Thread Heiko Wundram
Am Donnerstag 04 Mai 2006 01:04 schrieb Martin P. Hellwig: 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! You need to