Adam Lanier wrote:
>> class Foo(object):
>> def __init__(self, *args):
>> self.params = [arg if isinstance(arg, Bar) else Bar(arg) for
>> arg in args]
>>
>
> Interesting, I'm not familiar with this idiom...
>
>
These are two idioms actually:
1. a "list comprehension":
>>> newlis
On Wed, 2007-10-03 at 18:47 +, George Sakkis wrote:
> >
> > I would use variable argument list for this; it's also consistent
with
> > your example Foo( 'baz', Bar( 'something else' )), otherwise you
need
> > to call it as Foo([ 'baz', Bar( 'something else' ) ])
Good point, this is what was tr
On Oct 3, 2:27 pm, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Oct 3, 1:04 pm, Adam Lanier <[EMAIL PROTECTED]> wrote:
>
>
>
> > Relatively new to python development and I have a general question
> > regarding good class design.
>
> > Say I have a couple of classes:
>
> > Class Foo:
> >
On Oct 3, 1:04 pm, Adam Lanier <[EMAIL PROTECTED]> wrote:
> Relatively new to python development and I have a general question
> regarding good class design.
>
> Say I have a couple of classes:
>
> Class Foo:
> params = [ ]
> __init__( self, param ):
>