e, and who knows what else, the 4-spaces rule is
necessary for survival.
The reason is simple: People get confused, and accidentally get the
wrong tab indents when they move among editors or among settings on
the same editor. In most languages this is an irritation, requiring
some cleanup.
seems to be:
http://www.opencascade.org/
http://free-cad.sourceforge.net/
5. Knowledge Based Engineering (KBE) inference engines:
Python already gives you lazy evaluation and memoizing, but a
prolog-based backward chaining engine helps too. We wrote
CAD-engine-calls-python-and-prolog and
python-
s = ET.tostring(element, encoding)
element.text = text
return s
Why isn't this the standard behaviour ?
Thanks,
George
--
http://mail.python.org/mailman/listinfo/python-list
t; return "my custom computed result"
1) __getattribute__ is called for new-style classes only (those that
inherit directly or indirectly from object).
2) Even if your class was new-style, this would enter an infinite loop
because 'self.ppt' calls __getattribute__ again.
George
--
http://mail.python.org/mailman/listinfo/python-list
for text in columns[2].fetchText(_any_re))
d[field] = value
print d
George
--
http://mail.python.org/mailman/listinfo/python-list
ion:
self._exhausted = True
raise
def __iter__(self):
return self
class ExhaustedIteratorException(Exception):
pass
And then in your function:
def f(i):
i = ExhaustibleIterator(i)
print list(i)
print list(i)
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
ntactic sugar for something as
prevalent as regular expressions, it's not that hard to predict the
luck of this proposal. Good luck pushing it forward.
George
--
http://mail.python.org/mailman/listinfo/python-list
. If it's not
too late for feature additions, I'd love to see this in 2.5.
George
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> George Sakkis wrote:
>
>> It would be useful if list.sort() accepted two more optional
>> parameters
>
>
> useful for what? what's the use case ?
>
>
>
Although there is a use case (see below), I don't think it's s
dongdong wrote:
> how could I get all email address in a html page? Have any modle can do
> this?
> like the htmldata.urlextract .
As if there arent' enough spammers already...
--
http://mail.python.org/mailman/listinfo/python-list
slow (perhaps an over night job). I've yet to experience a context
where language features are the rate limiting step.
On the other hand, I have definitely experienced language as a rate
limiting factor in a) peer code reviews, b) debugging, c) ramping up
new team members. Python wins those
Stefan Behnel wrote:
> George Sakkis wrote:
> > Fredrik Lundh wrote:
> >
> >> [EMAIL PROTECTED] wrote:
> >>
> >>> I wanted to see what would happen if one used the results of a tostring
> >>> method as input into the XML method. Wha
Heiko Wundram wrote:
> Am Donnerstag 18 Mai 2006 19:27 schrieb George Sakkis:
> > It would be useful if list.sort() accepted two more optional
> > parameters, start and stop, so that you can sort a slice in place.
>
> I've just submitted:
>
> http://sourceforge.n
r fact or speculation about the
perl community is rather unproductive and offtopic for a python
newsgroup.
Thanks,
George
--
http://mail.python.org/mailman/listinfo/python-list
John Bokma wrote:
> "George Sakkis" <[EMAIL PROTECTED]> wrote:
>
> > Not trying to be as ass, but can you take this offline or at least in
> > a perl newsgroup ? Arguing on a particular fact or speculation about
> > the perl community is rather unproductive
John Bokma wrote:
> "George Sakkis" <[EMAIL PROTECTED]> wrote:
>
> > John Bokma wrote:
> >
> >> "George Sakkis" <[EMAIL PROTECTED]> wrote:
> >>
> >> > Not trying to be as ass, but can you take this offline or at leas
ow. Spamvertizing _one_ site is worth your host's
subscription; doing it for _four_ sites at your signature is perfectly
ok though. A rare case of irony deficit disorder I suppose.
Have a nice day.
George
--
http://mail.python.org/mailman/listinfo/python-list
if node.haschildren():
2) "There should be one and preferably only one way to do it."
List/genexp comprehensions don't allow larger statement blocks anyway,
so that's not a problem for them.
George
--
http://mail.python.org/mailman/listinfo/python-list
tp://docs.python.org/lib/itertools-functions.html):
"The returned group is itself an iterator that shares the underlying
iterable with groupby(). Because the source is shared, when the groupby
object is advanced, the previous group is no longer visible. So, if
that data is needed later, it should be stored as a list"
George
--
http://mail.python.org/mailman/listinfo/python-list
cular reason. Is there any coding style consensus on when
should dict literals be preferred over dict(**kwds) and vice versa ?
George
--
http://mail.python.org/mailman/listinfo/python-list
Bruno Desthuilliers wrote:
> George Sakkis a écrit :
> > Although I consider dict(**kwds) as one of the few unfortunate design
> > choices in python since it prevents the future addition of useful
> > keyword arguments (e.g a default value or an orderby function), I'
Alan wrote:
> With apologies to Voltaire:
> If Xah Lee did not exist, it would be necessary for John Bokma to
> invent him.
>
> Xah and Bokma are both idiots, they truly deserve each other. The
> sooner you killfile these two clowns, the happier you'll be.
Well said, I couldn't put it better.
-
define a function like
def foo(dict_like_class):
return dict_like_class(x=1,y=2).iteritems()
and call it as foo(MyDict)
In either case, I would guess that for the vast majority of cases the
builtin dicts are just fine and there's no compelling reason for
dict(**kwds). Perhaps it'
Robert Boyd wrote:
> On 24 May 2006 08:29:57 -0700, Rune Strand <[EMAIL PROTECTED]> wrote:
> >
>
> > I can just declare my support. Reading Mr. Bokmas comments below [*]
> > certainly makes my suport stronger.
> >
>
> I sent an email in support of Xah, which I wouldn't have bothered to
> do had I
Interesting. Doesn't your signature contain advertisements for your
> > website? Aren't you posting to five different groups?
>
> Shh! Pointing out ironic hypocrisy never works.
You can say that again: http://tinyurl.com/hvvqd
George
--
http://mail.python.org/mailman/listinfo/python-list
ot; others after a week or two toying with the language because you
might be offering disservice, despite your good intentions; leave this
to more experienced users``. The words might have been a bit harsher
but that's just his style; you'll get used to it if you hang around
here often.
George
--
http://mail.python.org/mailman/listinfo/python-list
e, an exception is raised.
Note that there is not an exception if
- you replace print with return in __getattr__, or
- Foo is a new-style class, i.e. extends object like this:
class Foo(object):
# rest remain the same
The reason is that in step (3) above, __repr__ would be looked up in
F
any interest at all on a pythonic version
of something like JOLAP or XMLA ?
George
--
http://mail.python.org/mailman/listinfo/python-list
ain__':
import string
b = CircularBuffer()
for c in string.letters * 10:
b.putmark(c)
print b
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
nderstand that the given feature is
1) redundant (see above).
2) restricting in a more serious sense: the future addition of optional
keyword arguments that affect the dict's behaviour. Google for "default
dict" or "dictionary accumulator".
George
--
http://mail.python.org/mailman/listinfo/python-list
Duncan Booth wrote:
> George Sakkis wrote:
>
> > 2) restricting in a more serious sense: the future addition of optional
> > keyword arguments that affect the dict's behaviour. Google for "default
> > dict" or "dictionary accumulator".
>
> Th
Bruno Desthuilliers wrote:
> George Sakkis a écrit :
> > The thing is there are four (at least?) ways to get a dict instance:
> >
> > In [1]: d1={'name':'mike', 'age':23}
> >
> > In [2]: d2=dict(d1)
> >
> > In [3]: d3=di
Duncan Booth wrote:
> George Sakkis wrote:
>
> > Duncan Booth wrote:
> >
> >> George Sakkis wrote:
> >>
> >> > 2) restricting in a more serious sense: the future addition of
> >> > optional keyword arguments that affect the dict&
ure if it's stable
enough for your needs.
George
--
http://mail.python.org/mailman/listinfo/python-list
Diez B. Roggisch wrote:
> Dr. Pastor schrieb:
> > I need a row of 127 bytes that I will use as a
> > circular buffer. Into the bytes (at unspecified times)
> > a mark (0 > After some time the "buffer" will contain the last 127 marks.
> > (A pointer will point to the next byte to write to.)
> > What
ability to hot patch and continue. I know not everyone
works in RT, but I can't possibly be alone in developing applications
that are hard to restart effectively.
That all said, online compilation such as in Lisp is only one of
several ways of replacing running code. Whether it is the best w
volved groupby() with an appropriate key function. The
takewhile/dropwhile solution seems shorter and (maybe) easier to read
but perhaps not as flexible and general. Regardless, it's a good
example of takewhile/dropwhile.
George
--
http://mail.python.org/mailman/listinfo/python-list
t
instead of the common one. Unfortunately, many Pythoneers become so
immersed with the language and whatever the current status quo is that
they rarely question the rationale of the few counter-intuitive design
choices.
George
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 28 Dec 2007 22:07:12 -0800 (PST), [EMAIL PROTECTED] wrote:
>Ada is airline/dod blessed.
Airline blessed maybe. The DOD revoked its Ada only edict because
they couldn't find enough Ada programmers. AFAIK, Ada is still the
preferred language, but it is not required.
George
--
f
On Jan 7, 9:27 am, Kay Schluehr <[EMAIL PROTECTED]> wrote:
> On Jan 7, 12:53 pm, Berco Beute <[EMAIL PROTECTED]> wrote:
>
> > Cool! We knew it would happen one day :)
> > What could be the reason? Python 3? Jython 2.2? Java's loss of
> > sexiness?
>
> Python eats Perls lunch as a scripting languag
ter skates.
>
> Would you Python old-timers try to agree on a word or two that
> completes:
>
> The best thing about Python is ___.
... it's a pleasure to write *and* read.
... it keeps simple things simple and makes hard things doable.
... it's the language that sucks t
Hi Guys,
Is there a python user group in the bay area?
Cheers,
George
--
http://mail.python.org/mailman/listinfo/python-list
quot;Java
Pet Store" apps, I think that would help me to fill up some gaps in my
learning process. Does anybody know any app like that?
Cheers,
George
--
http://mail.python.org/mailman/listinfo/python-list
Yeap. It is. I'm looking for something like that app. Smth that I
could base my future developments on.
On Jan 8, 1:47 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> On Mon, 07 Jan 2008 22:21:53 -0800, George Maggessy wrote:
> > I'm an experience Ja
rs are the de facto
standard used by millions; the spec is pretty much irrelevant (unless
you're a compiler writer or language theorist).
George
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 11, 8:59 am, Bruno Desthuilliers wrote:
> George Sakkis a écrit :
>
>
>
> > On Jan 11, 4:12 am, Bruno Desthuilliers > [EMAIL PROTECTED]> wrote:
>
> >> George Sakkis a écrit :
>
> >>> On Jan 10, 3:37 am, Bruno Desthuilliers wrote:
> &g
On Jan 11, 4:12 am, Bruno Desthuilliers wrote:
> George Sakkis a écrit :
>
> > On Jan 10, 3:37 am, Bruno Desthuilliers wrote:
>
> >> I fail to see how the existence of JIT compilers in some Java VM changes
> >> anything to the fact that both Java (by language sp
ntion or configuration, and with
> 100% compatibility, so it doesn't compare well to Python accelerators
> like psyco.
Plus, IIRC Java's JIT is not limited to optimizing special cases,
while psyco helps primarily with number-crunching code (admittedly an
important special case) and
27;path/to/some_config.py', CFG)
Traceback (most recent call last):
...
ImportError: No module named master_config
I understand why this fails but I'm not sure how to tell execfile() to
set the path accordingly. Any ideas ?
George
--
http://mail.python.org/mailman/listinfo/python-list
n = islice(cycle(':,'), len(parts)-1)
> return ''.join(interleave(parts, punctuation))
>
> s1 = 'hi_cat_bye_dog'
> print punctuate(s1)
>
> # Or as a one-liner (once you have interleave):
>
> print ''.join(list(interleave(s1.split('
On Jan 11, 5:24 pm, Mike Meyer <[EMAIL PROTECTED]>
wrote:
> On Fri, 11 Jan 2008 14:05:11 -0800 (PST) George Sakkis <[EMAIL PROTECTED]>
> wrote:
>
> > I maintain a few configuration files in Python syntax (mainly nested
> > dicts of ints and strings) and us
On Jan 11, 6:54 pm, Mitko Haralanov <[EMAIL PROTECTED]> wrote:
> On Fri, 11 Jan 2008 14:05:11 -0800 (PST)
>
> George Sakkis <[EMAIL PROTECTED]> wrote:
> > # trying to set the configuration:
> > CFG = {}
> > execfile('path/to/some_config.py
On Sat, 12 Jan 2008 12:03:49 -0800 (PST), [EMAIL PROTECTED] wrote:
>On Jan 10, 9:57 am, Jim <[EMAIL PROTECTED]> wrote:
>> DEK celebrates 70 today.
>>
>> I doubt he'll read this but I'll say it anyway: Happy Birthday!
>>
>> Jim Hefferon
>
>Donald Knuth is a son of a bitch who made a lot of money fr
By the way, why do we need both NotImplementedError and the
NotImplemented singleton object ? Couldn't we have just one of them ?
--
http://mail.python.org/mailman/listinfo/python-list
ses:
from inspect import getmro
def getdef(obj,attr):
try: objattrs = obj.__dict__
except AttributeError:
objattrs = obj.__slots__
if attr in objattrs:
return obj
for cls in getmro(obj.__class__):
if attr in cls.__dict__:
return cls
>>> g
Unless I missed it, PEP 328 doesn't mention anything about this.
What's the reason for not allowing "from .relative.module import *' ?
George
--
http://mail.python.org/mailman/listinfo/python-list
the information explicitly but that's less maintenable in
the long run. Also this is in a web environment so the information
can't be really global (though within-thread global should be fine).
Is there some standard pattern for this scenario ?
George
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 14, 6:01 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:
> George Sakkis <[EMAIL PROTECTED]> writes:
> > Unless I missed it, PEP 328 doesn't mention anything about this.
> > What's the reason for not allowing "from .relative.module import *'
&g
> 100
>
> Why doesn't it work in the first version of a3.py?
>
> Thanks,
> iu2
Try to guess what the following snippet prints, run it, and see if you
guessed correctly:
s = {'a':None}
x = s['a']
s['a'] = 1
print x
The same mechanism applies to what "from ... import" does.
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 14, 5:39 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:
> I think of NotImplemented as equivalent to None; it's useful as a
> sentinel value to set an attribute to in (e.g.) an abstract class.
My guess would be that it is more of an implementation performance
decision than semantic. Checking 'i
s either. :) As someone who has used Template Toolkit quite a bit,
> I must say that is is quite cool. Congrats on a job well done!
>
> j
How does it compare with other "mainstream" Python template engines
such as Cheetah, Mako, etc. ? Unless I missed it, the documentation
covers the Perl version only.
George
--
http://mail.python.org/mailman/listinfo/python-list
viding the overall task to smaller bits that can be
documented, tested and reused separately. For anything more
sophisticated, you have to constrain what are the possible
transformations that can happen. I did something similar for
transforming CSV input rows (http://pypi.python.org/pypi/csvutils/) so
that it's easy to specify 1-to-{0,1} transformations but not 1-to-many
or many-to-1.
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 15, 6:53 pm, George Sakkis <[EMAIL PROTECTED]> wrote:
> name_tranformer = lambda input: dict(
>zip(('first_name', 'last_name'),
>input['name']))
Of course that should
int x[] = {1,2,3};
test(x);
for (int i=0; i<3; i++) {
printf("%d ", x[i]);
}
}
$ gcc -std=c99 test.c
$ ./a.out
-1 2 3
Hope this helps,
George
--
http://mail.python.org/mailman/listinfo/python-list
ften, you may extract it to a general
grouping function such as
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/521877:
import re
for line in iterblocks(source,
start = lambda line:
line.startswith('Schedule HOST'),
end = lambda line: re.search(r'^
\s*Total',line),
skip_delim=False):
process(line)
George
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 17, 12:42 am, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Jan 17, 12:01 am, Scott David Daniels <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > [EMAIL PROTECTED] wrote:
> > > Hi there,
> > > I'm struggling to find a sensible way to process a
On Jan 17, 1:03 am, Christian Heimes <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
> > Python's parameter passing is like passing a pointer in C/C++.
>
> [snip]
>
> It's not (I repeat NOT) like passing a pointer in C. Please
> readhttp://effbot.o
On Jan 17, 1:59 am, Christian Heimes <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
> > Posting a counter-example where the difference is clearly shown would
> > be more vastly useful than referring to a list of long obscure usenet
> > posts with practically no e
able).next for iterable in iterables]
pending = size = len(iterables)
while True:
slice = [None] * size
for i in xrange(size):
try: slice[i] = getnext[i]()
except StopIteration:
pending -= 1
if not pending: return
On Jan 17, 7:13 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote:
> George Sakkis <[EMAIL PROTECTED]> writes:
> > And if the iterables don't necessarily support len(), here's a more
> > general solution:
>
> Not trying to pick on you personally but there&
, so it seems to me that some kind of array
> (numpy?) would be more efficient, but the upper bound changes in each
> file.
Yes, dict is the right data structure; since Python 2.5,
collections.defaultdict is an alternative. numpy is good for
processing numeric data once they are already in arrays, not for
populating them.
George
--
http://mail.python.org/mailman/listinfo/python-list
utes have to
repeated in derived classes:
class Derived(Base):
x = 1
z = ''
def __init__(self, **kwds):
super(Derived,self).__init__(**kwds)
print 'In Derived.__init__'
Is this a good way of doing it ? Is there a better p
; > local name.
>
> Thank you. Does python have so-called 'block scope' object?
No, it doesn't; in most cases that you may care, a name's scope is
either local or global*.
> or if you can,please show me the doc for python's object scope.
http://www.network-the
uding you
after a few weeks/months). If you want to save a few keystrokes, you
may use 'n' instead of 'node' or use an editor with easy auto
completion.
By the way, is there any particular reason for generating the XML
programmatically like this ? Why not have a separate template and use
one of the dozen template engines to populate it ?
George
--
http://mail.python.org/mailman/listinfo/python-list
s (like x and y)
*after* the call to super __init__ while new attributes (like z, a and
b) *before* the call. Mixing it up will either raise a runtime error
for passing an unknown argument to the parent, or (worse) set the
parent's default instead of the child's. So for the common attribute
setting case it involves more error-prone boilerplate code.
George
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 21, 2:52 pm, glomde <[EMAIL PROTECTED]> wrote:
> On 21 Jan, 20:16, George Sakkis <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jan 21, 1:56 pm, glomde <[EMAIL PROTECTED]> wrote:
>
> > > On 21 Jan, 18:59, Wildemar Wildenburger
>
> > > &
sort), so
> that records with the same key are all brought together. Then you can
> process the files sequentially.
Seconded. Unix sort can do external sorting [1] so your program will
work even if the files don't fit in memory. Once they are sorted,
itertools (especially groupby) is y
se the print statement is just illustrative.)
> What is the fastest way? (Ignore the import time.)
Look up the timeit module and test yourself the various alternatives;
that's the most reliable way to tell for sure.
George
--
http://mail.python.org/mailman/listinfo/python-list
est
pure Python version happens to be among the most elegant and concise,
unlike other languages where optimization usually implies obfuscation.
George
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 22, 1:34 pm, Paddy <[EMAIL PROTECTED]> wrote:
> On Jan 22, 5:34 am, George Sakkis <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jan 22, 12:15 am, Paddy <[EMAIL PROTECTED]> wrote:
>
> > > On Jan 22, 3:20 am, Alan Isaac <[EMAIL PROTECTED]> wro
(perceived) social value and other reasons.
And since you like metaphors, here's another one: caring about
efficient code only when you need it is like keeping notes for a
course only for the material to be included in the final exams,
skipping the more encyclopedic, general knowledge
On Jan 23, 4:37 am, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Tue, 22 Jan 2008 23:33:00 -0800, George Sakkis wrote:
> > As I mentioned already, I consider the seeking of the most efficient
> > solution a legitimate question, regardless of whether a "dumb"
now, what he wanted as a child,
what's the meaning of one's life and so on. After a couple of minutes
the guy cuts him and asks again:
- "Man, what do you want, burger or hot dog?"
- "Oh, a hot dog".
Sometimes you want to see the tree right in front of you, not the
whole damn forest.
George
--
http://mail.python.org/mailman/listinfo/python-list
other, you'd have to write
> quite perverse code care about the difference.
Even if for some reason I did want the result to be int, I would write
it as "int(not f)".
George
--
http://mail.python.org/mailman/listinfo/python-list
m and the context. For small well-
defined algorithmic type problems, I just assume it's intellectual
curiosity or that performance really matters. If the same question was
asked in the context of, say, a typical web application fetching data
from a database and rendering dynamic pages, I migh
s your favorite scripting language?
o Python
o Perl
(5 more choices)
Python is much more than a "scripting language" (whatever this means,
other than a semi-derogatory term used by clueless PHBs). Sorry, I'll
pass.
George
--
http://mail.python.org/mailman/listinfo/python-list
different process unless
RecordTypeFactory is called with the same arguments so that "the same"
class is generated in the other process as well. Essentially what I'm
missing is a hook to call RecordTypeFactory with the same fields when
an instance of the gen. class is to be unp
rong with apply(genital(), females), do you?
>
> `apply()` is deprecated. And ``genital(*females)`` looks a bit odd. :-)
Well, that use case alone is enough to convince anyone that apply
should stay :-)
George
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 30, 9:27 pm, MRAB <[EMAIL PROTECTED]> wrote:
> On Jan 31, 1:09 am, George Sakkis <[EMAIL PROTECTED]> wrote:> On Jan 30, 5:03
> pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>
> > > On Wed, 30 Jan 2008 15:29:45 +0100, Wildemar
sect module to find the
> intervals intersecting a given one.
I haven't actually used it but from the short description this package
seems to fit the bill: http://pypi.python.org/pypi/interval/1.0.0
George
--
http://mail.python.org/mailman/listinfo/python-list
(the result of G) to deserve a special operator ?
George
--
http://mail.python.org/mailman/listinfo/python-list
u don't have
> to wind up all the possible caller signatures to reflect that change.
You might find handy a decorator I've written exactly for this
scenario, reusing default arguments across functions:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440702
George
--
http://mail.python.org/mailman/listinfo/python-list
meworks include (or integrate with) an ORM layer,
which in turn talks to a (relational) database. If you're sold on
ZODB, you may want to evaluate Grok [1], a Web framework built on top
of Zope 3 that doesn't seem to require knowledge of Zope internals.
HTH,
George
[1] http://grok.zope.or
includes attributes defined in superclasses,
classes with __slots__, pseudo-attributes through __getattr__ and
possibly more I've missed.
George
--
http://mail.python.org/mailman/listinfo/python-list
ather than bar" means "bar is never
> chosen, foo is always chosen".
Ok, the fix is easy:
val = BETTER foo THAN bar
;-)
Cobol-strikes-back-ly yours,
George
--
http://mail.python.org/mailman/listinfo/python-list
yield next() if random()<0.5 else
nest(igrow(depth,next,nest,random))
for e in igrow(depth,next,nest,random):
yield e
With this you can just as easily generate nested tuples (or other
containers) instead of lists:
nested = tuple(igrow(10, nest=tuple))
You may even avoid allocating nested containers altogether:
from types import GeneratorType
for x in igrow(10, nest=iter):
if isinstance(x, GeneratorType):
# process nested generator
else:
# x is an 'atom'
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
it even more a violation of principle-of-least-astonishment
> that the '(foo)' form doesn't give a one-element tuple literal.
The reason being, of course, that in this case '(1+2) * 3' would give
a result several orders of magnitude more astonishing, so it's well
worth the slight inconvenience of one-element tuples.
George
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 12, 9:30 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:
> George Sakkis <[EMAIL PROTECTED]> writes:
> > On Feb 12, 7:02 pm, Ben Finney <[EMAIL PROTECTED]>
> > wrote:
> > > That makes it even more a violation of
> > > principle-of-least-astonish
On Feb 13, 4:43 pm, [EMAIL PROTECTED] wrote:
> Readability of the Pickle module. Can one export to XML, from cost
> of speed and size, to benefit of user-readability?
Take a look at gnosis.xml.pickle, it seems a good starting point.
George
--
http://mail.python.org/mailman/listinfo/
On Feb 16, 12:15 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote:
> Ilias Lazaridis wrote:
> > Essence:
>
> Spam spam spam spam...
>
> I just looked at your resume. What is Abstract Project Management?
A branch of Analysis Paralysis Vaporware.
--
http://mail.python.org/mailman/listinfo/python-list
901 - 1000 of 1560 matches
Mail list logo