Re: Tabs versus Spaces in Source Code

2006-05-15 Thread Harry George
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.

Re: Using python for a CAD program

2006-05-16 Thread Harry George
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-

Re: the tostring and XML methods in ElementTree

2006-05-17 Thread George Sakkis
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

Re: How to customize getattr(obj, prop) function ?

2006-05-17 Thread George Sakkis
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

Re: Beautiful parse joy - Oh what fun

2006-05-17 Thread George Sakkis
for text in columns[2].fetchText(_any_re)) d[field] = value print d George -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about exausted iterators

2006-05-17 Thread George Sakkis
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

Re: Proposal for new operators to python that add syntactic sugar for hierarcical data.

2006-05-17 Thread George Sakkis
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

Feature request: sorting a list slice

2006-05-18 Thread George Sakkis
. 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

Re: Feature request: sorting a list slice

2006-05-18 Thread George Sakkis
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

Re: how could I get all email address in a html page?

2006-05-18 Thread George Sakkis
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

Re: Programming language productivity

2006-05-19 Thread Harry George
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

Re: the tostring and XML methods in ElementTree

2006-05-19 Thread George Sakkis
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

Re: Feature request: sorting a list slice

2006-05-19 Thread George Sakkis
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

Re: python vs perl lines of code

2006-05-20 Thread George Sakkis
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

Re: python vs perl lines of code

2006-05-20 Thread George Sakkis
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

Re: python vs perl lines of code

2006-05-20 Thread George Sakkis
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

Re: python vs perl lines of code

2006-05-21 Thread George Sakkis
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

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-21 Thread George Sakkis
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

Re: groupby

2006-05-22 Thread George Sakkis
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

dict literals vs dict(**kwds)

2006-05-23 Thread George Sakkis
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

Re: dict literals vs dict(**kwds)

2006-05-23 Thread George Sakkis
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'

Re: John Bokma harassment

2006-05-24 Thread George Sakkis
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. -

Re: dict literals vs dict(**kwds)

2006-05-24 Thread George Sakkis
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'

Re: John Bokma harassment

2006-05-24 Thread George Sakkis
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

Re: John Bokma harassment

2006-05-24 Thread George Sakkis
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

Re: how to clear up a List in python?

2006-05-25 Thread George Sakkis
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

Re: __getattr__ and functions that don't exist

2006-05-25 Thread George Sakkis
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

OLAP and pivot tables

2006-05-25 Thread George Sakkis
any interest at all on a pythonic version of something like JOLAP or XMLA ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Array?

2006-05-25 Thread George Sakkis
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

Re: dict literals vs dict(**kwds)

2006-05-26 Thread George Sakkis
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

Re: dict literals vs dict(**kwds)

2006-05-26 Thread George Sakkis
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

Re: dict literals vs dict(**kwds)

2006-05-26 Thread George Sakkis
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

Re: dict literals vs dict(**kwds)

2006-05-26 Thread George Sakkis
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&

Re: PUDGE - Project Status, Alternative Solutions

2006-05-26 Thread George Sakkis
ure if it's stable enough for your needs. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Array? Please help.

2006-05-27 Thread George Sakkis
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

Re: Choosing a new language

2007-12-28 Thread George Neuner
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

Re: Fate of itertools.dropwhile() and itertools.takewhile()

2007-12-30 Thread George Sakkis
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

Re: Bizarre behavior with mutable default arguments

2007-12-30 Thread George Sakkis
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

Re: Choosing a new language

2007-12-30 Thread George Neuner
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

Re: TIOBE declares Python as programming language of 2007!

2008-01-07 Thread George Sakkis
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

Re: Python's great, in a word

2008-01-07 Thread George Sakkis
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

User Group

2008-01-07 Thread George Maggessy
Hi Guys, Is there a python user group in the bay area? Cheers, George -- http://mail.python.org/mailman/listinfo/python-list

Pet Store

2008-01-07 Thread George Maggessy
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

Re: Pet Store

2008-01-08 Thread George Maggessy
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

Re: Python too slow?

2008-01-10 Thread George Sakkis
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

Re: Python too slow?

2008-01-11 Thread George Sakkis
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

Re: Python too slow?

2008-01-11 Thread George Sakkis
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

Re: Python too slow?

2008-01-11 Thread George Sakkis
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

Import and execfile()

2008-01-11 Thread George Sakkis
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

Re: alternating string replace

2008-01-11 Thread George Sakkis
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('

Re: Import and execfile()

2008-01-11 Thread George Sakkis
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

Re: Import and execfile()

2008-01-11 Thread George Sakkis
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&#

Re: DEK's birthday

2008-01-12 Thread George Neuner
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

Re: NotImplimentedError

2008-01-14 Thread George Sakkis
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

Re: super, decorators and gettattribute

2008-01-14 Thread George Sakkis
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

SyntaxError: 'import *' not allowed with 'from .'

2008-01-14 Thread George Sakkis
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

Dynamical scoping

2008-01-14 Thread George Sakkis
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

Re: SyntaxError: 'import *' not allowed with 'from .'

2008-01-14 Thread George Sakkis
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

Re: import from question

2008-01-14 Thread George Sakkis
> 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

Re: NotImplimentedError

2008-01-14 Thread George Sakkis
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

Re: Perl Template Toolkit: Now in spicy new Python flavor

2008-01-15 Thread George Sakkis
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

Re: Data mapper - need to map an dictionary of values to a model

2008-01-15 Thread George Sakkis
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

Re: Data mapper - need to map an dictionary of values to a model

2008-01-15 Thread George Sakkis
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

Re: assigning values in python and perl

2008-01-16 Thread George Sakkis
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

Re: next line (data parsing)

2008-01-16 Thread George Sakkis
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

Re: next line (data parsing)

2008-01-16 Thread George Sakkis
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

Re: assigning values in python and perl

2008-01-16 Thread George Sakkis
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

Re: assigning values in python and perl

2008-01-17 Thread George Sakkis
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

Re: Loop in a loop?

2008-01-17 Thread George Sakkis
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

Re: Loop in a loop?

2008-01-17 Thread George Sakkis
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&

Re: Efficient processing of large nuumeric data file

2008-01-18 Thread George Sakkis
, 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

Default attribute values pattern

2008-01-19 Thread George Sakkis
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

Re: object scope

2008-01-20 Thread George Sakkis
; > 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

Re: is it possible to set namespace to an object.

2008-01-21 Thread George Sakkis
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

Re: Default attribute values pattern

2008-01-21 Thread George Sakkis
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

Re: is it possible to set namespace to an object.

2008-01-21 Thread George Sakkis
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 > > > > &

Re: Transforming ascii file (pseduo database) into proper database

2008-01-21 Thread George Sakkis
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

Re: pairs from a list

2008-01-21 Thread George Sakkis
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

Re: pairs from a list

2008-01-21 Thread George Sakkis
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

Re: pairs from a list

2008-01-22 Thread George Sakkis
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

Re: pairs from a list

2008-01-22 Thread George Sakkis
(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

Re: pairs from a list

2008-01-23 Thread George Sakkis
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"

Re: pairs from a list

2008-01-23 Thread George Sakkis
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

Re: Why not 'foo = not f' instead of 'foo = (not f or 1) and 0'?

2008-01-23 Thread George Sakkis
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

Re: pairs from a list

2008-01-23 Thread George Sakkis
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

Re: Linux Journal Survey

2008-01-23 Thread George Sakkis
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

Pickling dynamically generated classes

2008-01-25 Thread George Sakkis
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

Re: Removing Pubic Hair Methods

2008-01-30 Thread George Sakkis
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

Re: Removing Pubic Hair Methods

2008-01-30 Thread George Sakkis
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

Re: How to identify which numbers in a list are within each others' range

2008-01-31 Thread George Sakkis
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

Re: Python feature request : operator for function composition

2008-02-03 Thread George Sakkis
(the result of G) to deserve a special operator ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it explicitly specified?

2008-02-04 Thread George Sakkis
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

Re: What is the most simple, quicket, yet most powerful python Web-Framework?

2008-02-05 Thread George Sakkis
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

Re: getting all user defined attributes of a class

2008-02-07 Thread George Sakkis
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

Re: Why does list have no 'get' method?

2008-02-07 Thread George Sakkis
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

Re: Critique of first python code

2008-02-08 Thread George Sakkis
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

Re: ways to declare empty set variable

2008-02-12 Thread George Sakkis
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

Re: ways to declare empty set variable

2008-02-12 Thread George Sakkis
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

Re: XML pickle

2008-02-13 Thread George Sakkis
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/

Re: TRAC - Trac, Project Leads, Python, and Mr. Noah Kantrowitz (sanitizer)

2008-02-16 Thread George Sakkis
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

<    5   6   7   8   9   10   11   12   13   14   >