On Wed, Jun 9, 2010 at 6:36 AM, Mark Lawrence wrote:
> Yes alright bloody Aussies ** n * sodit * *wink*. Not sure if this is a
> syntax error, but too lazy too test at an interactive prompt.
I resent that remark :)
--James
--
http://mail.python.org/mailman/listinfo/python-list
On 08/06/2010 17:55, Steven D'Aprano wrote:
On Tue, 08 Jun 2010 17:24:55 +0100, Mark Lawrence wrote:
On 08/06/2010 17:04, Ross Williamson wrote:
Hi Everyone,
Just a quick question - Is it possible to assign class variables in the
__init__() - i.e. somthing like:
They're instance variables,
you can also use :
>>> class A(object):
def __init__(self, **args):
self.__dict__.update(args)
>>> a=A(source='test', length=2)
>>> a.source
'test'
but this is to be used carefully because mispelling your args somewhere
in your program will not raise any error :
>>> A(
Jean-Michel Pichavant wrote:
> def __init__(self, source="test", length=1):
> self.source = source
> self.length = length
>
> is the way to go. OP's original idea is a bad idea :).
D'accord.
> Could be a problem with hundreds of parameters, but who write
> constructors with hundreds of paramete
Peter Otten wrote:
Jason Scheirer wrote:
On Jun 8, 9:37 am, Peter Otten <__pete...@web.de> wrote:
Ross Williamson wrote:
Hi Everyone,
Just a quick question - Is it possible to assign class variables in
the __init__() - i.e. somthing like:
def __init__(self,se
Jason Scheirer wrote:
> On Jun 8, 9:37 am, Peter Otten <__pete...@web.de> wrote:
>> Ross Williamson wrote:
>> > Hi Everyone,
>>
>> > Just a quick question - Is it possible to assign class variables in
>> > the __init__() - i.e. somthing like:
>>
>> > def __init__(self,self.source = "test", self.le
On Jun 8, 9:37 am, Peter Otten <__pete...@web.de> wrote:
> Ross Williamson wrote:
> > Hi Everyone,
>
> > Just a quick question - Is it possible to assign class variables in
> > the __init__() - i.e. somthing like:
>
> > def __init__(self,self.source = "test", self.length = 1)
>
> > rather than
>
>
On Tue, 08 Jun 2010 17:24:55 +0100, Mark Lawrence wrote:
> On 08/06/2010 17:04, Ross Williamson wrote:
>> Hi Everyone,
>>
>> Just a quick question - Is it possible to assign class variables in the
>> __init__() - i.e. somthing like:
>
> They're instance variables, not class variables.
In the usua
Ross Williamson wrote:
> Hi Everyone,
>
> Just a quick question - Is it possible to assign class variables in
> the __init__() - i.e. somthing like:
>
> def __init__(self,self.source = "test", self.length = 1)
>
> rather than
>
> def __init__(self,source = "test", length = 1):
No. If you are
On 08/06/2010 17:04, Ross Williamson wrote:
Hi Everyone,
Just a quick question - Is it possible to assign class variables in
the __init__() - i.e. somthing like:
They're instance variables, not class variables.
def __init__(self,self.source = "test", self.length = 1)
No.
rather than
def _
Hi Everyone,
Just a quick question - Is it possible to assign class variables in
the __init__() - i.e. somthing like:
def __init__(self,self.source = "test", self.length = 1)
rather than
def __init__(self,source = "test", length = 1):
--
Ross Williamson
University of Chicago
Department of As
11 matches
Mail list logo