%s)" % (args,kwds)
class B(A):
def foo(self, *args, **kwds):
return "B.foo dispatcher(%s,%s)" % (args,kwds)
d = TypeDispatcher()
d[A] = lambda self,*args,**kwds: self.foo(*args,**kwds)
d[int] = lambda self,*args,**kwds: "int dispatcher(%s, %s, %s)" %
(self, args, kwds)
for obj in A(), B(), 3:
print d(obj, "hello", "world", x=3, y=3.5)
George
--
http://mail.python.org/mailman/listinfo/python-list
at if you select a single item from the select box,
'q' is binded to a string instead of a list of length 1, so instead of
retrieving 'apple', she got back the results for 'a', 'p', 'p',
'l','e'.
Bottom line, type checking is a tricky
gt; words = []
> for w in ['this', 'is', 'probably', 'what', 'you', 'want']:
>words.append(Word(w))
> print words
Or more compactly:
words = [Word(w) for w in 'this is probably what you want'.split()]
print words
George
--
http://mail.python.org/mailman/listinfo/python-list
tr.__lt__(self,other)
L.sort(key=lambda i: (i.somestring, revstr(i.someotherstring),
i.anotherkey))
George
--
http://mail.python.org/mailman/listinfo/python-list
ing; just
let it propagate up the call stack until the appropriate level. This
might be the console, a GUI, a logfile, an automatically sent email or
any combination of these or more. If it's a programmer's error (aka
bug), it should propagate all the way up and end in printing the stack
"sir_alex" <[EMAIL PROTECTED]> writes:
> Hi! I have a little problem writing xml files formatted in a way like
> the following:
>
>
> bla
> bla
>
>
> Every new node element should have a tabulation before it, but when I
> use xml.dom.minidom I use writexml, which considers as
missed an option?
Can anyone provide me an example of how to access the serial port with
pyserial?
Thanks
George T.
--
http://mail.python.org/mailman/listinfo/python-list
on of your webapp and your
lack of experience with a pythonic web framework.
George
--
http://mail.python.org/mailman/listinfo/python-list
You may want to start from HarvestMan:
http://harvestman.freezope.org/
George
--
http://mail.python.org/mailman/listinfo/python-list
download the path.py module
(http://www.jorendorff.com/articles/python/path/):
from path import path
for fs_object in path(root).walk():
ADD fs_object to dictionary
George
--
http://mail.python.org/mailman/listinfo/python-list
StopIteration:
return False
else:
copy(first_match, dest_dir)
return True
I/O exceptions are left to propagate to the caller.
George
--
http://mail.python.org/mailman/listinfo/python-list
You'd probably get more results by searching for "web crawlers" or "web
spiders". You may start from here:
http://harvestman.freezope.org/faq.html
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
By god this sounds interesting I wish I
knew what you are talking about
George-- Original Message -
From: "andreas" <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python.announce
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 22, 2006 6:14 AM
Subject: ANN: pyFltk-1.1
of is Dabo, but it (currently)
supports wxPython only for the UI. If there isn't anything like this
out of the box, what would the best starting point be for implementing
such a system ? Extending Dabo, a web framework (e.g. Django), or
something different ?
George
--
http://mail.pytho
".split()
for word_color in it.izip(word, it.cycle(colors)):
print "%s" % word_color
George
--
http://mail.python.org/mailman/listinfo/python-list
This all looks interesting but I don't know
what all this would do for me
and I don't understand any of it
george
- Original Message -
From: "Richard Jones" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: ; <[EMAIL PROTECTED]>
Sent: Thursday, March 0
"Peter Otten" <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
>
> > What's the fastest and most elegant equivalent of zip() in
> > Numeric/Numarray between two equally sized 1D arrays ? That is, how
to
> > combine two (N,)-shaped arrays to one (N,2)
"Peter Otten" <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
>
> > Though not the fastest to execute; using concatenate instead of
> > initializing an array from a list [a,a] is more than 2,5 time
faster in
> > my system (~4.6 vs 11.8 usec per loop a
tp://docs.python.org/lib/module-re.html
- HOWTO
http://www.amk.ca/python/howto/regex/
In your case, the code would go like this:
>>> text = '{1:1} Random text here. {1:2} More text here. and so on.'
>>> import re
>>> pattern = re.compile('{\d+:\d+}'
?
>
> cheers
> ---
> Tim Henderson
> mail me: [EMAIL PROTECTED]
Check out the gnosis.magic package of David Mertz (
http://www-106.ibm.com/developerworks/linux/library/l-pymeta.html).
Even if it's not exactly what you want, it will give you an idea of
where to go from there.
George
--
http://mail.python.org/mailman/listinfo/python-list
d rather avoid metaclasses and start from scratch, this
article is a nice guideline to introspection:
http://www-106.ibm.com/developerworks/library/l-pyint.html
George
--
http://mail.python.org/mailman/listinfo/python-list
odule may be useful for that purpose. Doctest can also
be used as a unittest.
--
george
http://www.dynkin.com/
--
http://mail.python.org/mailman/listinfo/python-list
This newsgroup is in general very helpful, but there are some
exceptions; one of them is when the problem appears blatantly to be a
homework. Perhaps if you showed that you worked on it and made some
progress, but it's not quite right, someone may help you.
George
--
http://mail.pytho
o admit
that
> my answer may not be as (kindly) funny as intended, and so I hope the
OP
> has a better sens of humor than you and me !-)
>
or perhaps the OP's sense of humor is irrelevant if he/she
cannot read this thread in english :-)
George
--
http://mail.python.org/mailman/listinfo/python-list
quot;can't delete attribute"
# in ignored
v.magnitude = 10
Any ideas on what's going on and if there's a workaround ?
George
--
http://mail.python.org/mailman/listinfo/python-list
timezone; the
latter variable follows the POSIX standard while this module
follows RFC 2822.
http://docs.python.org/lib/module-time.html
--
george
http://www.dynkin.com/
--
http://mail.python.org/mailman/listinfo/python-list
"Florian Lindner" wrote:
> Hello,
> when I'm iterating through a list with:
>
> for x in list:
>
> how can I get the number of the current iteration?
>
> Thx,
>
> Florianfor
in python 2.3+:
for i,x in enumerate(sequence):
print "sequence[%d]
de/self.magnitude))
Any alternatives to get the same effect without deleting an attribute
of the superclass ?
George
--
http://mail.python.org/mailman/listinfo/python-list
, just as it would verify that the program below is correct:
if (aCondition):
AFunctionThatIsDefined()
.
.
.
.
def AFunctionThatIsDefined():
return 0 / (0-0)
Moral: There are *many* more reasons for testing every execution path
than catching name or type errors.
George
--
http://mail.python.org/mailman/listinfo/python-list
p.pyx
tmp.pyx:1:8: 'foo.bar.pxd' not found
I tried every reasonable choice for '-I' dir, without success. Am I
missing something or it's just cimport's deficiency ?
George
--
http://mail.python.org/mailman/listinfo/python-list
;
> did you perhaps stumble upon a strange man with a keg of liquor back
> in the sixties, or what's going on here? ;-)
>
>
>
>
>
In more modern terminology, an analog might be UML sequence diagrams.
George
--
http://mail.python.org/mailman/listinfo/python-list
to look up language features,
modules and APIs, the python quick reference is an excellent starting
point, especially for someone new to the language:
http://rgruet.free.fr/PQR24/PQR2.4.html (also linked from
http://www.python.org/doc/ along with other doc sources). It's
available in pd
therchain[j]. If you're
talking about something else, you need to clarify the problem more.
George
--
http://mail.python.org/mailman/listinfo/python-list
by
default ). Below is the doctest and the documentation (with
epydoc tags); mail me offlist if you'd like to check it out.
George
#===
def parseDateTime(string, USA=False, implyCurrentDate=False,
yearHeuristic=_20thcent
hread posted today with almost the same topic
(http://tinyurl.com/bpcg8).
George
--
http://mail.python.org/mailman/listinfo/python-list
"John Machin" <[EMAIL PROTECTED]> wrote:
> On 16 May 2005 17:51:31 -0700, "George Sakkis" <[EMAIL PROTECTED]>
> wrote:
>
>
> >#===
> >
> >def parseDateTime(string, USA=Fal
"flamesrock" wrote:
> I don't understand.. why is everyone talking about christ on
> comp.lang.python? Isn't this not the place?
>
Maybe they know something we don't.
--
http://mail.python.org/mailman/listinfo/python-list
faces, and write the bulk
of the implementation in jython. PSF has awarded a grant to make jython
catch up with cpython, and that's good news for making the transition
from java to python smoother to a large audience. Others may have more
to say on the pros and cons of going with java/jython instead of
cpython, but it seems a good compromise to me.
George
--
http://mail.python.org/mailman/listinfo/python-list
t;standard
> business
> > practices", so in a way "it's ok" to screw up, you did what
everybody
> > else does. Yet another failed java enterprise project, nothing to
see
> > here.
>
> Hi George, You probably know the tale about Achilles and the turtl
fe
# mutation and accumulation of yielded lists
perm[n] = 0; yield perm
perm[n] = 1; yield perm
return _bin(n)
$ python /usr/local/lib/python2.4/timeit.py -s "from bin import bin3"
"for i in bin3(10): pass"
1000 loops, best of 3: 587 usec per loop
Cheers,
George
--
http://mail.python.org/mailman/listinfo/python-list
3.exe
If you only need Japanese support, Japanese Codecs might be handy.
On the other hand, CJKCodecs can handle much broader encodings.
Aside from that, starting from 2.4, Python ships with CJKCodecs,
so I'd recomment CJKCodecs without reservations.
-- george
--
http://mail.python.org/mailman/listinfo/python-list
x27;.')])
for p in '[EMAIL PROTECTED]'.split('@')])"
Cheers,
George
--
http://mail.python.org/mailman/listinfo/python-list
esn't use inspect.
import sys
class Log:
def write(self,message):
frame = sys._getframe(1)
code = frame.f_code
print "%s:%d:%s, %s" % (code.co_filename, frame.f_lineno,
code.co_name, message)
There's a logging module in the
ttp://www.onlamp.com/pub/a/python/2005/06/01/kongulo.html
>>
>>and
>>
>>Python Standard Logging
>>http://www.onlamp.com/pub/a/python/2005/06/02/logging.html
>>
>>
>>Comments, criticisms, flames all welcome.
>
>
> I've read the logging ar
hether numeric value is a decimal.'''
class ZipCodeValidator(Validator):
def __call__(self,name,value):
'''Test if value is a US Zip Code.'''
def validateField(name, value, validators):
""" Validates field input """
results = {}
for validate in validators:
result = validate(name,value)
if result is not None:
results[name] = result
# XXX: if more than one validators succeed,
# all but the last result will be overwritten
return results
# test
validators = [DecimalValidator(), ZipCodeValidator()]
print validateField("home ZIP", "94303", validators)
Regards,
George
--
http://mail.python.org/mailman/listinfo/python-list
omating the addition of the missing rich comparisons
with the expected semantics: == and != are complementary, and given
either of them and one of <, >, <=, >=, the other three are defined.
You can check it out at
http://rafb.net/paste/results/ymLfVo81.html. Corrections and comments
are welcome.
Regards,
George
--
http://mail.python.org/mailman/listinfo/python-list
show:
a.x = val # statement
setattr(a,'x',val) # expression
George
--
http://mail.python.org/mailman/listinfo/python-list
(http://mail.python.org/pipermail/python-dev/2004-June/045111.html) but
it was already too late.
Waiting-for-python-3K'ly yours
George
--
http://mail.python.org/mailman/listinfo/python-list
:
class SomeArray(object):
dimensions = property(
fget = lambda self: (self.x,self.y),
fset = lambda self,(x,y): setattr(self,'x',x) or
setattr(self,'y',y))
Again, it is quite limited, but properties are also often limited so
it's a useful idiom to know.
George
--
http://mail.python.org/mailman/listinfo/python-list
in the eye of the beholder; IMO both are
much less obvious than the if/then/else, especially for a beginner or
someone who has never seen these idioms before. I personally don't find
the (ab)use of dictionaries in this case to be more beautiful or
pythonic than the and/or idiom (not to mention the runtime cost of
building a new dictionary every time), but YMMV.
George
--
http://mail.python.org/mailman/listinfo/python-list
ion the runtime cost of building a new dictionary every time), but
YMMV.
George
--
http://mail.python.org/mailman/listinfo/python-list
> Hello,
>
> Does anyone have an efficient Python routine for calculating the
> structure function?
>
>
> Thanks very much,
>
>
> Daran
> [EMAIL PROTECTED]
Read this first and come back:
http://www.catb.org/~esr/faqs/smart-questions.html#beprecise
George
-
ks automagically the fget, fset, fdel and
__doc__ from the property's locals(), instead of having the property
return locals() explicitly. Also, it doesn't break when the property
defines local variables other than [fget, fset, fdel, doc].
George
--
http://mail.python.org/mailman/listinfo/python-list
ces sys.modules['__main__'] for each unit test and then it
execfile()s it, which seems like a hack. I didn't look into unittest's
internals in case there is a more elegant way around this; if there
isn't, a future version of unittest should address the automatic
aggregation of tests, as py.test does already.
The link to the script is http://rafb.net/paste/results/V0y16g97.html.
Hope this helps,
George
--
http://mail.python.org/mailman/listinfo/python-list
discussion for every single recipe.
> + What's going to happen with v3
>
Google is your friend; search for "python 3000" (interestingly,
searching for "python 3" returns something completely different :-)).
George
--
http://mail.python.org/mailman/listinfo/python-list
cerned
(http://www2.di.uoa.gr/en/lessons.php). Although these are certainly
useful if one is interested in hardware, architecture, realtime and
embedded systems, etc., I hardly find them relevant (or even more,
necessary) for most CS/IT careers. Separation of concerns works pretty
well for most practical purposes.
George
--
http://mail.python.org/mailman/listinfo/python-list
tring, old, new):
count = [0]
def counter(match):
count[0] += 1
return new
replaced = re.sub(old,counter,aString)
return count[0], replaced
A good example of trying to be smart and failing :)
George
--
http://mail.python.org/mailman/listinfo/python-list
e needs to be good at both
at any given time, it's useful to distinguish between them.
George
--
http://mail.python.org/mailman/listinfo/python-list
}
> public void sendAgent(Agent anAgent, WorkplaceAddress anAddress) {
>
> }
> }
>
> bye
class ConnectionManager(object):
def __init__(self):
super(ConnectionManager,self).__init__()
def sendAgent(self, anAgent, anAddress):
pass
George
--
http://mail.python.org/mailman/listinfo/python-list
a low level language once he has seen the Light ?
George
--
http://mail.python.org/mailman/listinfo/python-list
if/elif/elif (or switch in
C++/Java). That's ok though because, as you noticed, at some point you
have to take a decision. What's important is the "once and only once"
principle, that is all the decision logic is encapsulated in a single
method (or in python in a single function)
ing multiple
processes in one or more hosts (through PYRO) and one singlethreaded
(for the sake of completeness, probably not very useful). I'll write
up some docs and I'll announce it, hopefully within the week.
George
--
http://mail.python.org/mailman/listinfo/python-list
k
> prototype implementation of this. I'm off to work
> soon, so I can't do it today, but maybe Sunday.
I'm afraid I beat you to it :)
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/521877
George
--
http://mail.python.org/mailman/listinfo/python-list
enerators-itertools, not only for the productivity gains
but perhaps even more for changing the way of thinking about
programming, making Python worth learning [1]. But in general it's the
overall design, making the right tradeoffs in most cases.
George
[1] "A language that doesn'
On Jun 2, 4:58 pm, [EMAIL PROTECTED] (Aahz) wrote:
> In article <[EMAIL PROTECTED]>,
> George Sakkis <[EMAIL PROTECTED]> wrote:
>
>
>
> >I had probably stumbled on many/most of the common pitfalls usually
> >mentioned (e.g.http://www.ferg.or
a difference for tight
loops).
I usually go for (1), at least until the number of global imports in
the top remains in single digits. After some point though I often
localize the standard library imports that are used only once or twice
(the third-party and local application imports are a
are a better
way to go. The boilerplate code can be minimal too with an appropriate
decorator, something like:
class A(object):
def __init__(self,x,y):
self.x = x
self.y = y
@cachedproperty
def z(self):
return self.x * self.y
where cachedproperty is
def
On Jun 11, 10:37 am, Frank Millman <[EMAIL PROTECTED]> wrote:
> On Jun 11, 3:38 pm, George Sakkis <[EMAIL PROTECTED]> wrote:
> >The boilerplate code can be minimal too with an appropriate
> > decorator, something like:
>
> > class A(object):
>
> > d
allel version in a few lines, with minimal boilerplate
code overhead.
To get a copy, visit http://code.google.com/p/papyros/; also available
from the Cheeseshop at http://www.python.org/pypi/papyros/.
George
Sample code
==
Here's a basic example; for more details go through the READ
eptable syntax for multiline lambdas; TOOWTDI is a
secondary reason (as one can easily come up with a dozen TOOWTDI
violations in other parts of the language). I agree though that in
practice it's a very small limitation.
George
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 12, 11:36 am, Kay Schluehr <[EMAIL PROTECTED]> wrote:
> On 12 Jun., 16:54, George Sakkis <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jun 12, 10:12 am, Kay Schluehr <[EMAIL PROTECTED]> wrote:
>
> > > On 12 Jun., 14:57, Facundo Batista <[EMAIL P
.com/ASPN/Cookbook/Python/Recipe/117119:
from itertools import count, ifilter
def sieve():
seq = count(2)
while True:
p = seq.next()
seq = ifilter(p.__rmod__, seq)
yield p
I suspect that it violates your second rule though :)
George
--
http://mail.python.org/mailman/listinfo/python-list
gt; >http://stickpeople.com/projects/python/win-psycopg/
>
> > It may well be, thanks.
>
> On second thoughts, is there one anywhere without an extra multi-
> megabyte dependency? This seems to rely on the eGenix 'mx' library.
>
> --
> Ben Sizer
IIRC v
gt; value. I don't care which items I get so now I just use a couple of
> pops or a for loop for more than two.
>
> Thanks
>
> jh
>>> x = range(10)
>>> y = []
>>> y.append(x.pop(4))
>>> print x, y
[0, 1, 2, 3, 5, 6, 7, 8, 9] [4]
>>> y
g one) comment on how they compare to the standard
logging ?
George
* among other shortcomings, such as unpickleable handlers, absurdly
verbose config files, etc.
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 17, 6:46 pm, Philipp Leitner <[EMAIL PROTECTED]> wrote:
> Ever came to your mind that there are people (programmers and others)
> who will not use emacs for their day-to-day work simply because they
> have tools that suit them better for the work they have to do (Eclipse
> for me, as an exa
-- code a bit, save, the other guy codes a bit.
But when someone uses vi and then forgets how to do block moves, or
uses eclipse and bogs down the session, or uses MS Notepad and can't
enforce language-specific indents, I get frustrated.
--
Harry George
PLM Engineering Architecture
--
http://mail.python.org/mailman/listinfo/python-list
e (and sometimes less) restrictive than necessary. Still,
If you're addicted to manifest typing [1], the typechecking module [2]
may give you a warm and fuzzy feeling:
from typecheck import accepts
@accepts(int, str)
my_func(some_non_hungarian_notation_meaningful_name,
othe
> get_init_locals(f, 3, 4, 5)
{'a': (5,), 'k': {}, 'x': 3, 'y': 4}
>>> get_init_locals(f, 3, q=-1)
{'a': (), 'k': {'q': -1}, 'x': 3, 'y': 1}
Any takers ?
George
--
http://mail.python.org/mailman/listinfo/python-list
ll available as well. You
can have dependencies, as long as they are documented and can be
obtained by separate manual download.
Thanks for listening.
--
Harry George
PLM Engineering Architecture
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 21, 4:42 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> On Jun 21, 8:51 pm, George Sakkis <[EMAIL PROTECTED]> wrote:
>
>
>
> > I wonder if there is a (preferably not too-hackish) solution to the
> > following introspection problem: given
[EMAIL PROTECTED] (John J. Lee) writes:
> Harry George <[EMAIL PROTECTED]> writes:
> [...]
> > These are unacceptable behaviors. I am therefore dropping ZODB3, and
> > am considering dropping TurboGears and ZSI. If the egg paradigm
> > spreads, yet more packages
Robert Kern <[EMAIL PROTECTED]> writes:
> Harry George wrote:
> > ...at least around here.
> >
> > I run a corporate Open Source Software Toolkit, which makes hundreds
> > of libraries and apps available to thousands of technical employees.
> > The
Ben Finney <[EMAIL PROTECTED]> writes:
> Harry George <[EMAIL PROTECTED]> writes:
>
> > Historically, python packages played well in this context. Install
> > was a simple download, untar, setup.py build/install.
> >
> > Eggs and with other setupt
(Function Signature Object) in place.
What you claim about introspection code though I think holds for code
in general. There are quite often edge cases which the programmer
doesn't anticipate or care to handle. A tool that covers X% of real-
world use cases for some large X and doc
Robert Kern <[EMAIL PROTECTED]> writes:
> Harry George wrote:
>
>> We need to know the dependencies, install them in dependency order,
>> and expect the next package to find them. "configure" does this for
>> hundreds of packages. cmake, scons, and other
[EMAIL PROTECTED] (John J. Lee) writes:
> Harry George <[EMAIL PROTECTED]> writes:
>> [EMAIL PROTECTED] (John J. Lee) writes:
> [...]
>>> 2. You can run your own private egg repository. IIRC, it's as simple
>>> as a directory of eggs and a plain old web
estLoop()
finally:
# nothing is printed if f() runs in a thread
print "i am here!!"
DAEMON.shutdown()
print "i am over!!"
Is "finally" not guaranteed to be executed in a non-main thread or is
there something else going on ?
George
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 3, 5:05 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
> > I posted this on the Pyro list but I'm not sure if it's related
> > specifically to Pyro. The "finally" clause below is not executed when
> > f() r
x27;t know anything more about static typing than it does
now. FWIW, there is already a typechecking module [1] providing a
syntax as friendly as it gets without function annotations. If the
number of its downloads from the Cheeshop is any indication of static
typing's popularity among Pythonis
ook". You want "Python Programming on Win32"
By Mark J.. Hammond, Andy Robinson. It covers exactly this case.
--
Harry George
PLM Engineering Architecture
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 12, 5:52 pm, Robert Dailey <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Is there a way to force a specific parameter in a function to be a
> specific type?
Yes; have a look at typecheck (http://oakwinter.com/code/typecheck/)
and FormEncode (http://formencode.org/Validator.html).
-
Version: 08.00..0010
Intermediate Language 060405.07
Driver 060518a
Date: Thu May 18 22:08:53 EDT 2006
-
I suspect the trailing comma is the issue. Googling for "xlc enumerator
trailing comma" gave me
http://sources.redhat.com/ml/gdb/1999-q1/msg00136.html
which says "AIX 4.2.0.0 xlc gives an error for trailing commas in enum
declarations".
George
--
http://mail.python.org/mailman/listinfo/python-list
e you're waiting...
Wow, can you make a coffee in.. 57ms ?
$ time python -c "for n in xrange(2**19937 + 1): random.random()"
Traceback (most recent call last):
File "", line 1, in
OverflowError: long int too large to convert to int
real0m0.057s
user0m0.050s
rlap(a, b) # output:None
> print getOverlap(b, a) # output: None
>
> any easy way of doing this?
It's not really hard to come up with a quick and dirty solution;
however if this isn't a homework or a toy program, take a look at the
interval module (http://cheeseshop.python.org/pypi/interval/1.0.0) for
a more thought-out design.
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
test 3: error
> test 4: error
> 16.23 usec/pass
>
> `getgropus2' fails test 0 because it produces a reversed list. That
> can easily be fixed by re-reversing the output before returning. But,
> since it is by far the slowest method, I didn't bother.
>
> `getgroups3' is a method I got from another post in this thread, just
> for comparison.
>
> >From my benchmarks it looks like getgroups1 is the winner. I didn't
>
> scour the thread to test all the methods however.
Here's a small improvement of getgroups1, both in time and memory:
from itertools import islice
def getgroups4(seq):
idxs = [i for i,v in enumerate(seq) if v&0x80]
idxs.append(None)
return [seq[i:j] for i,j in izip(idxs, islice(idxs,1,None))]
George
--
http://mail.python.org/mailman/listinfo/python-list
d csv, b) check the
loaded structure's data against the new data-on-disk to find changed
files, c) update the structure appropriately, d) write out the
resulting new csv.
--
Harry George
PLM Engineering Architecture
--
http://mail.python.org/mailman/listinfo/python-list
ts haven't appeared (yet) at the google
group but they show up on the mailing list:
http://mail.python.org/pipermail/python-list/2007-July/thread.html
George
--
http://mail.python.org/mailman/listinfo/python-list
llowing feature, which
by the way disproves the assertion that "new-style classes can do
anything Classic classes did":
class Classic: pass
class NewStyle(object):pass
for o in Classic(),NewStyle():
o.__str__ = lambda: 'Special method overriding works on
instances!'
print '%s object: %s' % (o.__class__.__name__, o)
George
--
http://mail.python.org/mailman/listinfo/python-list
Take me off mailing list
thank you
george
- Original Message -
From: "Georg Brandl" <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python.announce
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 21, 2007 4:10 AM
Subject: [ANN] Python documentation team looking for me
601 - 700 of 1560 matches
Mail list logo