How to validate the __init__ parameters
Jean-Michel Pichavant
jeanmichel at sequans.com
Mon Jan 11 08:52:51 EST 2010
More information about the Python-list mailing list
Mon Jan 11 08:52:51 EST 2010
- Previous message (by thread): How to validate the __init__ parameters
- Next message (by thread): asyncore based port splitter code questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Aahz wrote: > In article <mailman.2244.1261418090.2873.python-list at python.org>, > Jean-Michel Pichavant <jeanmichel at sequans.com> wrote: > >> class A: >> def __init__(self, foo = None, bar = None): >> if len(foo) > 5: >> raise ValueError('foo cannot exceed 5 characters') >> > > Bad Idea -- what happens when foo is None? > You're right. That perfectly illustrates how the simplest solution is the often most valuable one: it is much more easy to find bugs, when there is any. JM
- Previous message (by thread): How to validate the __init__ parameters
- Next message (by thread): asyncore based port splitter code questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list