unicode() has LOAD_GLOBAL which s.decode() does not. Is it generally
the case that LOAD_ATTR is slower than LOAD_GLOBAL that lead to your
intuition that the former would probably be slower? Or some other
intuition?
Of course, the results from timeit are a different thing - I ask about
the intuiti
Did not intend that there was a problem.
Just a gotcha or a fun little titbit ... maybe. :)
On Aug 4, 1:25 pm, "Jan Kaliszewski" wrote:
> 04-08-2009 o 22:11:18 1x7y2z9 <1x7y...@gmail.com> wrote:
>
> > Another one (also explainable):
> >>>> 0 or Non
>>> 0 or None is None
True
>>> None or 0 is None
False
>>> None or 0 is 0
True
Yes, this is explained in the docs:
The expression x or y first evaluates x; if x is true, its value is
returned; otherwise, y is evaluated and the resulting value is
returned.
Another one (also explainable):
>>> 0 or
python 2.5.2
errno, strerror and message do not appear to be set in the following
two cases (at least).
Is this to be expected? (as an aside, arg[0] is set)
# case 1
> print exception, exception.errno, exception.strerror, exception.message == ''
None None True
# case 2
> print exception, exce
On Jun 22, 5:56 pm, Lawrence D'Oliveiro wrote:
> In message
> c77d-4a47-8cb4-7dd916d69...@s1g2000prd.googlegroups.com>, 1x7y2z9 wrote:
> > Not sure if this is defined in a later version, but it would be nice
> > to define re.NONE = 0 in the re module.
>
> Do so:
I am currently using python v2.5.2.
Not sure if this is defined in a later version, but it would be nice
to define re.NONE = 0 in the re module. This would be useful in cases
such as:
flags = re.DOTALL if dotall else re.NONE
Also useful for "building up" flags by ORing with other flags.
Thanks
Say, we have a (parent) class P.
It has N child classes C1(P), C2(P) ... CN(P)
Each of the child classes defines (differently) a method func().
I wish to decorate all of the CX.func() in the same way. One way to
do this is to add a decorator to each of the derived classes. But
this is tedious