Chris wrote:
> Why can pickle serialize references to functions, but not methods?
>
> Pickling a function serializes the function name, but pickling a
> staticmethod, classmethod, or instancemethod generates an error. In
> these cases, pickle knows the instance or class, and the method, so
> what's
Dustan wrote:
> B isn't recognizing its inheritence of A's methods get_a and set_a
> during creation.
>
> Why am I doing this? For an object of type B, it makes more sense to
> reference the attribute 'b' than it does to reference the attribute
> 'a', even though they are the same, in terms of read
Robert Kern wrote:
> Inheritance really doesn't work that way. The code in the class suite gets
> executed in its own namespace that doesn't know anything about inheritance.
> The
> inheritance rules operate in attribute access on the class object later.
Right. That was what I should have said,
Steven Bethard wrote:
> Here's the recipe I use::
>
> [...]
>
> There may be some special cases where this fails, but I haven't run into
> them yet.
Wow, that's a really nice recipe; I didn't even know about the copy_reg
module. I'll have to start using that.
I did notice one failure mode,
My understanding of the __future__ statement is that you may say
something like:
from __future__ import foo, bar
to enable more than one feature. However, this does not seem to be
working properly in 2.5; it behaves as expected when typed into the
interactive interpreter, but not when it is in a
[EMAIL PROTECTED] wrote:
> I found myself writing:
>
> for f in [i for i in datafiles if '.txt' in i]:
> print 'Processing datafile %s' % f
>
> but I was wishing that I could have instead written:
>
> for f in in datafiles if '.txt' in f:
> print 'Processing datafile %s' % f
>
> Has there
John Henry wrote:
> Can I say something to the effect of:
>
> (a,b,c[0:2],d[0:5])=a_list# Obviously this won't work
Your best bet is probably:
x = [...some list...]
a,b,c,d = x[:1],x[1:2],x[2:5],x[5:]
> I am asking this because I have a section of code that contains *lots*
> of things like t