Re: With or without leading underscore...

2009-08-11 Thread Bruno Desthuilliers
Carl Banks a écrit : (snip) class A(object): def __init__(self,*args,**kwargs): raise TypeError('Type not callable; use factory function instead') @classmethod def _create_object(cls,initial_value): self = object.__new__(cls) # avoid __init__ self.value = in

Re: With or without leading underscore...

2009-08-10 Thread Steven D'Aprano
On Mon, 10 Aug 2009 16:37:25 +0200, Ulrich Eckhardt wrote: > ...that is the question! > > I have a module which exports a type. It also exports a function that > returns instances of that type. Now, the reason for my question is that > while users will directly use instances of the type, they wil

Re: With or without leading underscore...

2009-08-10 Thread Carl Banks
On Aug 10, 7:37 am, Ulrich Eckhardt wrote: > ...that is the question! > > I have a module which exports a type. It also exports a function that > returns instances of that type. Now, the reason for my question is that > while users will directly use instances of the type, they will not create > in

Re: With or without leading underscore...

2009-08-10 Thread Jan Kaliszewski
10-08-2009 Ulrich Eckhardt wrote: So, the type is a part of the public API, but its constructor is not. Should I mark the type as private (with a leading underscore) or not? IMHO you shouldn't (i.e. name should be marked "public") because of possible usage of e.g. "isinstance(foo, YourType)

With or without leading underscore...

2009-08-10 Thread Ulrich Eckhardt
...that is the question! I have a module which exports a type. It also exports a function that returns instances of that type. Now, the reason for my question is that while users will directly use instances of the type, they will not create instances of the type themselves. So, the type is a part