On Mon, 2008-03-17 at 23:32 -0700, Michel Lespinasse wrote:
> Not a big deal, but it did trip me up the first time (and, I still don't know
> of a good way to create the two-dimensional array with actual separate
> copies for each row)
A bit kludgy, but you could use a list comprehension:
[ [0
On Mon, Mar 17, 2008 at 12:01:04PM -0400, Jason Tackaberry wrote:
> On Mon, 2008-03-17 at 16:47 +0100, Duncan Webb wrote:
> > Thanks both Jason and James, it makes sense that the list is created
> > when the method is first parsed, this is something that I need to watch
> > out for. I guess that
On Mon, 2008-03-17 at 16:47 +0100, Duncan Webb wrote:
> Thanks both Jason and James, it makes sense that the list is created
> when the method is first parsed, this is something that I need to watch
> out for. I guess that this is only a problem for mutable objects, so
> strings and numbers are
Jason Tackaberry wrote:
> On Mon, 2008-03-17 at 15:42 +0100, Duncan Webb wrote:
>
>> class A:
>> def __init__(self, l=[]):
>> self.l = l
>>
>
> Note that this creates a default list for l only once at
> class-declaration time. All instances of A will share this list. This
> is
On Mon, 2008-03-17 at 15:42 +0100, Duncan Webb wrote:
> class A:
> def __init__(self, l=[]):
> self.l = l
Note that this creates a default list for l only once at
class-declaration time. All instances of A will share this list. This
is a common python gotcha. You might want instead:
On March 17, 2008, Duncan Webb wrote:
> Here is a bit of code:
>
> class A:
> def __init__(self, l=[]):
> self.l = l
>
> class B:
> def __init__(self):
> self.l = []
>
> a1 = A()
> a2 = A()
>
> b1 = B()
> b2 = B()
>
> a1.l += ['a1']
> a2.l += ['a2']
> b1.l += ['b1']
> b2.l +
On Fri, 14 Mar 2003, Starkeeper wrote:
> I try to write a small LCD-script for freevo, but I have no experience in
> programming Python. I did not find anything about device-files on python.org
> so I ask here.
> How can I print out some text to a device-file with Python?
For reading or w