Re: Distributed RVS, Darcs, tech love

2007-10-20 Thread George Neuner
On Sun, 21 Oct 2007 01:20:47 -, Daniel Pitts <[EMAIL PROTECTED]> wrote: >On Oct 20, 2:04 pm, llothar <[EMAIL PROTECTED]> wrote: >> > I love math. I respect Math. I'm nothing but a menial servant to >> > Mathematics. >> >> Programming and use cases are not maths. Many mathematics are >> the wor

Re: TeX pestilence (was Distributed RVS, Darcs, tech love)

2007-10-22 Thread George Neuner
lar its syntax, on esthetical grounds, sucks in >major ways. No one except you thinks TeX is a "computer language". >Btw, a example of item 4 above, is Python's documentation. Fucking >asses and holes. Watch your language, there are children present. George -- for email reply remove "/" from address -- http://mail.python.org/mailman/listinfo/python-list

Re: transforming list

2007-10-23 Thread George Sakkis
need one more append outside the loop (if report_item: report.append(report_item)). > I feel this solution is not that good, can I make this more pythonic?! Sure; get familiar with a swiss-knife module, itertools, and in particular for this task, groupby: from operator import itemgetter from itertools import groupby, chain def group_roster(rows, num_stats=12): # group the rows by their first two elements # Caveat: the rows should already be sorted by # the same key for key,group in groupby(rows, itemgetter(0,1)): stats = [0.0] * num_stats for row in group: if row[2]: stats[int(row[2])-1] = float(row[3]) yield list(chain(key,stats)) if __name__ == '__main__': import csv for row in group_roster(csv.reader(open('roster.txt'))): print row HTH, George -- http://mail.python.org/mailman/listinfo/python-list

Re: Better writing in python

2007-10-24 Thread George Sakkis
On Oct 24, 10:42 am, [EMAIL PROTECTED] wrote: > On Oct 24, 4:15 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: > > > > > On Oct 24, 2:02 pm, [EMAIL PROTECTED] wrote: > > > > On Oct 24, 7:09 am, Alexandre Badez <[EMAIL PROTECTED]> wrote: > > > > > I'm just wondering, if I could write a in a "better" way

Re: Mobile Startup looking for sharp coders

2007-10-24 Thread George Sakkis
On Oct 24, 2:42 pm, Vangati <[EMAIL PROTECTED]> wrote: > Plusmo is Hiring! > > (snipped) > > Recruiting Agencies: Please do not send us unsolicited resumes. > Plusmo does not consider resumes from any agencies. Lame company headhunters: Please do not send us unsolicited spamvertisments irrelevant

Re: about functions question

2007-10-24 Thread George Sakkis
On Oct 25, 2:28 am, NoName <[EMAIL PROTECTED]> wrote: > I try it: > > def b(): > ... > a() > ... > > def a(): > ... > b() > ... > > b() > it's not work. It sure does. Please post full code and error message, something else

Re: python project ideas

2007-10-25 Thread George Sakkis
On Oct 25, 6:12 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Template engines are amongst the things that seem easy enough to look at the > available software and say "bah, I'll write my own in a day", but are complex > enough to keep them growing over years until they become as huge and > inacc

Re: how to creating html files with python

2007-10-27 Thread George Sakkis
his is quite typical, and practically required for web development. As Diez pointed out, your main problem will be which of the dozen or so template packages to pick. Depending on your criteria (expressive power, syntax close to python, performance, stability etc.) you may narrow it down to a h

Re: simple question on dictionary usage

2007-10-28 Thread George Sakkis
x27;E')`` is a little safer than ``s[0] == 'E'`` as the former > returns `False` if `s` is empty while the latter raises an `IndexError`. A string slice is safe and faster though: if s[:1] == 'E'. George -- http://mail.python.org/mailman/listinfo/python-list

Re: A Python 3000 Question

2007-10-29 Thread George Sakkis
urn value is >=0 ? That also looks odd in a dynamic language with a "we're all adults here" philosophy and much less hand-holding in areas that matter more (e.g. allowed by default comparisons between instances of different types - at least that's one of the warts Python 3 gets right). George -- http://mail.python.org/mailman/listinfo/python-list

Re: A Python 3000 Question

2007-10-29 Thread George Sakkis
objects, and duck-typing, things like > len() being a function rather than a method make perfect sense. Does the fact that index() or split() are methods make perfect sense as well? I guess after some time using Python it does, but for most unbiased users the distinction seems arbitrary. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Readline and record separator

2007-10-30 Thread George Sakkis
several '\n' and when I use > readline it does NOT read the whole my record. > So If I could change '\n' as a record separator for readline, it > would solve my problem. > Any idea? > Thank you > L. Check out this recipe, it's pretty generic: http://asp

Re: A Python 3000 Question

2007-10-30 Thread George Sakkis
seq)', 'seq = range(100)').timeit() > 0.20332271187463391 > >>> timeit.Timer('seq.__len__()', 'seq = range(100)').timeit() > > 0.48545737364457864 Common mistake; try this instead: timeit.Timer('seqlen()', 'seq = range(100); seqlen=seq.__len__').timeit() George -- http://mail.python.org/mailman/listinfo/python-list

Re: A class question

2007-10-30 Thread George Sakkis
On Oct 28, 6:01 am, Donn Ingle <[EMAIL PROTECTED]> wrote: > Is there a way I can, for debugging, access the instance variable name from > within a class? Shouldn't this be in a FAQ somewhere? It's the second time (at least!) it comes up this week. George -- http://m

Re: A Python 3000 Question

2007-10-31 Thread George Sakkis
On Oct 31, 8:44 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-10-30, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > On Oct 30, 11:25 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > >> On 2007-10-30, Eduardo O. Padoan <[EMAIL PROTE

Re: A Python 3000 Question

2007-10-31 Thread George Sakkis
doing it once only. That > is not relevant to the question of whether len() should be a function or > a method. No disagreement here; I didn't bring up performance and it's not at all a reason I consider len() as a function to be a design mistake. What I dispute is Neil's asse

Re: 3 number and dot..

2007-10-31 Thread George Sakkis
panded & splitted (and maybe even commented) with a > VERBOSE, to improve readability, maybe somethign like: > > \d {1,3} > (?=# lockahead assertion > (?: \d {3} )+ $ # non-group > ) > > Bye, > bearophile That's 3 times faster on my box and works f

Re: XML DOM, but in chunks

2007-10-31 Thread George Sakkis
ularly > > like the ElementTree library for accessing the data. Is there a way > > to have ElementTree read only one record of the data at a time? > > Have you tried `iterparse()`? > > Ciao, > Marc 'BlackJack' Rintsch Detailed docs at http://effbot.org/zo

Re: Is it possible to use a instance property as a default value ?

2007-11-01 Thread George Sakkis
f.Buf_wp = 0 @revaluatable def Draw(self, x1 = Deferred('self.Buf_rp'), x2 = Deferred('self.Buf_wp')): return (x1,x2) p = PlotCanvas() p.Buf_rp = 2 p.Buf_wp = -1 print p.Draw(), p.Draw(x2='foo') HTH, George -- http://mail.python.org/mailman/listinfo/python-list

Re: An iterator with look-ahead

2007-01-10 Thread George Sakkis
be sure what a > peek() => None signifies until the next iteration unless you > don't expect None in your sequence. There is a different implementation in the Cookbook already: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/304373 George -- http://mail.python.org/mailman/listinfo/python-list

Fixed keys() mapping

2007-01-11 Thread George Sakkis
s and the implications this may have in the future (e.g. how well does this play with inheritance). Is this a valid use case for type-changing behavior or is there a better, more "mainstream" OO design pattern for this ? I can post the relevant code if necessary. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Fixed keys() mapping

2007-01-11 Thread George Sakkis
For what it's worth, I added it to the Cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/499373 George -- http://mail.python.org/mailman/listinfo/python-list

Re: Boilerplate in rich comparison methods

2007-01-12 Thread George Sakkis
metaclass to generate the boilerate, filling in the gaps. It doesn't impose any constraints on which comparisons you must implement, e.g you may implement __le__ and __eq__, or __gt__ and __ne__, etc. Season to taste. http://rafb.net/p/mpvsIQ37.nln.html George -- http://mail.python.org/mailman/listinfo/python-list

Re: Class list of a module

2007-01-15 Thread George Sakkis
mport isclass > getclasses = lambda module: filter(isclass, vars(module).itervalues()) > > Bye, > bearophile Or even: from inspect import getmembers, isclass def getclasses(module): return [cls for name,cls in getmembers(module,isclass)] George -- http://mail.python.org/mailman/listinfo/python-list

Re: How to determine what exceptions a method might raise?

2007-01-17 Thread George Sakkis
7;s not possible in a dynamic language; that's the price you have to pay for leaving the static typing world". As for the OP's question, since file is a fixed builtin, I think it should be possible to know all the possible exceptions that can be raised; I'm not sure if it's clearly documented though. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterator length

2007-01-18 Thread George Sakkis
; nelements = 0 > for _ in iterator: > nelements += 1 > return nelements > > Is it a good idea to extend the functionalities of the built-in len > function to cover such situation too? > > Bye, > bearophile Is this a rhetorical question ? If not, try this: >>> x = (i for i in xrange(100) if i&1) >>> if leniter(x): print x.next() George -- http://mail.python.org/mailman/listinfo/python-list

mmap caching

2007-01-21 Thread George Sakkis
ied at the user level ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Is any python like linux shell?

2007-01-21 Thread George Sakkis
thon is actually more than a simple shell. Give it a try: http://ipython.scipy.org/. George -- http://mail.python.org/mailman/listinfo/python-list

Re: mmap caching

2007-01-21 Thread George Sakkis
Nick Craig-Wood wrote: > George Sakkis <[EMAIL PROTECTED]> wrote: > > I've been trying to track down a memory leak (which I initially > > attributed erroneously to numpy) and it turns out to be caused by a > > memory mapped file. It seems that mmap caches withou

Re: mmap caching

2007-01-21 Thread George Sakkis
Martin v. Löwis wrote: > George Sakkis schrieb: > > I've been trying to track down a memory leak (which I initially > > attributed erroneously to numpy) and it turns out to be caused by a > > memory mapped file. It seems that mmap caches without limit the chunks > &g

Re: mmap caching

2007-01-22 Thread George Sakkis
Dennis Lee Bieber wrote: > On 21 Jan 2007 13:32:19 -0800, "George Sakkis" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > > The file is written once and then opened as read-only, there's no > > flushing. So if cachi

Re: numpy or _numpy or Numeric?

2007-01-24 Thread George Sakkis
(float, line.split()) for line in open('my_space_separated_file.txt')] This stores the values as a list of lists, each list corresponding to a row in the file. Depending on what you plan to do next with these numbers, this may or may not be the best way to go about it, but since you only mentioned the file reading part, we can't assume much. George -- http://mail.python.org/mailman/listinfo/python-list

Re: My python programs need a GUI, wxPython or PyQt4?

2007-01-24 Thread Harry George
ey do not have the authority to actually define its legal ramifications. Check with your company legal staff. Having said that, I have been troubled by trolltech's approach from the beginning, and therefore stay away from it. PyGTK and wdxPython are solid GUIs, without the legal uncertainty. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list

Re: Python does not play well with others

2007-01-24 Thread Harry George
ust works. Same scripts run on every platform. Bindings available to every C/C++/FORTRAN library I've needed so far. Often the bindings are not complete, but oddly enough the binding developers have chosen to do just the functions I need, so who cares. A clean architecture for adding more f

Re: My python programs need a GUI, wxPython or PyQt4?

2007-01-24 Thread Harry George
on" and any other kind, and I'm not aware of any > case law that does so either. This distinction is also not codified in > the GPL itself anywhere, so it's not a necessary condition of the > license - it is an interpretation by the FSF and that is all. [snip] It is

Re: assertions to validate function parameters

2007-01-25 Thread George Sakkis
ions by running python with '-O' or '-OO'. Optimization flags should never change the behavior of a program, so using assertions for what's part of the normal program behavior (validating user-provided input) is wrong. George -- http://mail.python.org/mailman/listinfo/python-list

Re: dict.keys() ?

2007-01-26 Thread George Sakkis
h the complexity and the error-proneness of having two new similar-but-not-quite-the-same APIs with sets. Not only iteration is arguably the most common operation on a view, but the cost (in extra keystrokes and runtime performance) of populating any container that the user may need from an iterator is pretty low. George -- http://mail.python.org/mailman/listinfo/python-list

[Boost.Graph] graph.vertices property creates new objects

2007-01-29 Thread George Sakkis
s that the vertices iterator creates new vertex objects every time instead of iterating over the existing ones. This essentially prevents, among other things, storing vertices as keys in a dictionary since the hashes of the stored and the new vertex differ although they compare equal. Is this real

Re: Overloading the tilde operator?

2007-02-01 Thread George Sakkis
ation isn't arbitrary. Indeed, and that's because it is arbitrary. Python has the arbitrary limitation that it's not Perl (or C, or Lisp or what have you). George -- http://mail.python.org/mailman/listinfo/python-list

Re: Fixed length lists from .split()?

2007-02-02 Thread George Sakkis
chain(seq, repeat(fill, minlen-len(seq))) >>> list(ipad('one;two;three;four'.split(";"), 7, '')) ['one', 'two', 'three', 'four', '', '', ''] >>> tuple(ipad(xrange(1,5), 7)) (1, 2, 3, 4, None, None, None) George -- http://mail.python.org/mailman/listinfo/python-list

Re: Python does not play well with others

2007-02-02 Thread George Sakkis
nd add Numpy, Zope, Django, PIL, pretty much everything actually. Even better, make CheeseShop just a frontend to a build system that adds and updates automatically submitted packages to the core. Problem solved ! . George -- http://mail.python.org/mailman/listinfo/python-list

Re: How much introspection is implementation dependent?

2007-02-02 Thread George Sakkis
print >print '==== test 2 ' >print adict >print construct(C, adict) > > if __name__ == "__main__": >test() What's the point of this ? You can call C simply by C(**adict). Am I missing something ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Where Does One Begin?

2007-02-02 Thread George Sakkis
On Feb 2, 3:39 pm, Mister Newbie <[EMAIL PROTECTED]> wrote: > I have no programming experience. I want to learn Python so I can make > simple, 2D games. Where should I start? Can you recommend a good book? > > Thank you. http://www.amazon.com/Game-Programming-Python-Development/dp/1584502584 --

Re: Checking default arguments

2007-02-03 Thread George Sakkis
>>> f(1, y='bar') Supplied: {'y': 'bar', 'x': 1} Default: {'z': None} >>> f(1, z=None) Supplied: {'x': 1, 'z': None} Default: {'y': 'bar'} >>> f(1, 'bar', None) Supplied: {'y': 'bar', 'x': 1, 'z': None} Default: {} >>> f(1, 'bar', z=None) Supplied: {'y': 'bar', 'x': 1, 'z': None} Default: {} >>> f(1, z=None, y='bar') Supplied: {'y': 'bar', 'x': 1, 'z': None} Default: {} Regards, George -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling J from Python

2007-02-05 Thread George Sakkis
quot;similar to python" when the following is a program > written in it? Compared to that, even Perl is a wonder of readability... > > (cryptic gibberish snipped) > > http://www.jsoftware.com/jwiki/Essays/The_Ball_Clock_Problem > > Diez Please avoid posting code looking like garbled profanities in c.l.py. This was outright offensive. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling J from Python

2007-02-09 Thread George Sakkis
rophile Here's another one, adapted from the example (in Java) in Wikipedia's entry (http://en.wikipedia.org/wiki/Sierpinski_triangle): N=15 for x in xrange(N,0,-1): print ''.join('* '[x&y!=0] for y in xrange(N+1-x)) George -- http://mail.python.org/mailman/listinfo/python-list

Re: Scripting Visio using Python

2007-02-14 Thread Harry George
se IronPython? An alternative might be to work (cross-platform) wit the vxd (XML) file format. A good reader/writer for that would be handy. -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list

Complex HTML forms

2007-02-17 Thread George Sakkis
s the specific command, and only then they appear (typically by Javascript). When the form is submitted, the selected options are passed in the server in some form that preserves the hierarchy, i.e. not as a flat dict. Is there anything close to such a beast around ? George -- http://mail.python.org/ma

Re: Complex HTML forms

2007-02-18 Thread George Sakkis
On Feb 18, 4:44 am, Gregor Horvath <[EMAIL PROTECTED]> wrote: > George Sakkis schrieb: > > > I'd like to gather advice and links to any existing solutions (e.g. > > libraries, frameworks, design patterns) on general ways of writing > > complex web forms, as oppos

Re: exec "def.." in globals(), locals() does not work

2007-02-19 Thread George Sakkis
is this a typo?). If you insist on using exec (which, again, you have no reason to for this example), take the union of d's globals and locals as f's globals, and store f in d's locals(): from math import * G = 1 def d(): L = 1 g = dict(globals()) g.update(locals()) exec "def f(x): return L + log(G) " in g, locals() return f(1) George -- http://mail.python.org/mailman/listinfo/python-list

Bypassing __setattr__ for changing special attributes

2007-02-19 Thread George Sakkis
f.__class__ is Foo True Is there a way (even hackish) to bypass this, or at least achieve somehow the same goal (change f's class) ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Bypassing __setattr__ for changing special attributes

2007-02-20 Thread George Sakkis
On Feb 20, 7:57 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Mon, 19 Feb 2007 23:18:02 -0800, Ziga Seilnacht wrote: > > George Sakkis wrote: > >> I was kinda surprised that setting __class__ or __dict__ goes through > >> the __setattr__ mechanism, lik

Re: Bypassing __setattr__ for changing special attributes

2007-02-20 Thread George Sakkis
On Feb 20, 3:54 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 20 fév, 05:39, "George Sakkis" <[EMAIL PROTECTED]> wrote: > > > I was kinda surprised that setting __class__ or __dict__ goes through > > the __setattr__ mechanism, like a norm

Re: modifying a list while iterating through

2007-02-25 Thread George Sakkis
ly? seems like a big kludge. Unless I missed something, this is a simple string replacement: ''.join(packet).replace('01110', '011100') George -- http://mail.python.org/mailman/listinfo/python-list

Subprocess timeout

2007-02-28 Thread George Sakkis
ot on 2.4 print os.waitpid(p.pid, 0) What gives ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuples vs Lists: Semantic difference (was: Extract String From Enclosing Tuple)

2007-02-28 Thread George Sakkis
or addition/removal/insertion of elements not making sense for a heterogeneous data structure, have you heard of database schema change ? Heterogeneous data structures are well known for several decades now; they are commonly spelled "records" though, not tuples, and have a more reasonable API to support their semantics. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Dialog with a process via subprocess.Popen blocks forever

2007-03-01 Thread George Trojan
ocess' stdin that causes it to somehow proceed, I can read > from its stdout. > > Thus a useful dialogue is not possible. > > Regards, > -Justin > > > Have you considered using pexpect: http://pexpect.sourceforge.net/ ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: Poor python and/or Zope performance on Sparc

2007-11-03 Thread George Sakkis
;mpstat" are bored at 0% load. You are probably not aware of Python's Global Interpeter Lock: http://docs.python.org/api/threads.html. George -- http://mail.python.org/mailman/listinfo/python-list

Re: overriding methods - two questions

2007-11-16 Thread George Sakkis
the same signature in __init__. For all other methods though, given that you have an instance x so that isinstance(x, ContinuedFraction), the client should be able to say x.foo(arg, kwd=v) without having to know whether x.__class__ is ContinuedFraction. If not, you have a leaky abstraction [1], i.e.

Re: Interfaces.

2007-11-16 Thread George Sakkis
s) are pretty close to interfaces and have been accepted for Python 3 (http:// www.python.org/dev/peps/pep-3119/). Personally I don't see any tangible benefit in having "pure" interfaces in additon to ABCs. George -- http://mail.python.org/mailman/listinfo/python-list

Re: class='something' as kwarg

2007-11-17 Thread George Sakkis
of code for such a common operation. Instead, you can pass a string for attrs instead of a dictionary. The string will be used to restrict the CSS class. """ http://www.crummy.com/software/BeautifulSoup/documentation.html#Searching%20by%20CSS%20class George -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple eval

2007-11-18 Thread George Sakkis
= atom(next, token) next() # Skip key-value delimiter (':') token = next() out[key] = atom(next, token) token = next() if token == ',': token = next() return out raise SyntaxError('malformed expression (%r)' % token) Regards, George -- http://mail.python.org/mailman/listinfo/python-list

Re: overriding methods - two questions

2007-11-19 Thread George Sakkis
On Nov 19, 7:44 am, Bruno Desthuilliers wrote: > George Sakkis a écrit : > > > > > On Nov 16, 5:03 pm, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > > >> On Fri, 16 Nov 2007 18:28:59 +0100, Bruno Desthuilliers wrote: > >

Re: the annoying, verbose self

2007-11-23 Thread George Sakkis
either of these is true for Python. I certainly wouldn't consider better a solution that required declaring local variables (e.g. "local x = 0"). George -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread George Sakkis
osts. To the OP: yes, your use case is quite valid; the keyword you are looking for is "memoize". You can find around a dozen of recipes in the Cookbook and posted in this list; here's one starting point: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413717. HTH, George -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread George Sakkis
> use more of it. If you bothered to click on that link you would learn that memoization can be used to save space too and matches OP's case exactly; even the identity tests work. Self-importance is bad enough by itself, even without the ignorance, but you seem to do great in both. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Need to call functions/class_methods etc using string ref :How

2007-11-26 Thread George Sakkis
ain specific toy language, which might well turn out to be less expressive than necessary for the given problem domain. I guess Lisp/Scheme would be even more suited for this task but then again there's a Web framework (TurboGears), an ORM (SqlAlchemy) an RPC middleware (Pyro) and a dozen more batteries, both standard and 3rd party. Can't think of anything better than Python for this project. George -- http://mail.python.org/mailman/listinfo/python-list

Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread George Sakkis
On Dec 1, 9:06 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > Pythons are big, non-poisonous snakes good for keeping the rats out > of a system I'm looking forward to Spider(TM), the first bug-free language ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: "Python" is not a good name, should rename to "Athon"

2007-12-04 Thread George Sakkis
Never occured to you that the goofiness of the name "Google" is at least an order of magnitude greater than Python. And FYI, Google didn't start out with the popularity it enjoys today, it gained it *despite* the silly name. Thanks God it was created by geeks and not clueless PHBs like

Re: Python surpasses Perl in TIOBE index

2007-12-04 Thread George Sakkis
tually mean something), but this has more to do with Perl's fall than Python's increase: http://www.tiobe.com/tiobe_index/Perl.html. Even more amazing is the rate C++ is losing ground: http://www.tiobe.com/tiobe_index/C__.html George -- http://mail.python.org/mailman/listinfo/python-list

Re: Python surpasses Perl in TIOBE index

2007-12-04 Thread George Sakkis
On Dec 4, 11:07 am, Paul Rudin <[EMAIL PROTECTED]> wrote: > George Sakkis <[EMAIL PROTECTED]> writes: > > Even more amazing is the rate C++ is losing ground: > >http://www.tiobe.com/tiobe_index/C__.html > > I don't really find surprising that low level lan

Re: Python surpasses Perl in TIOBE index

2007-12-05 Thread George Sakkis
rowing too: http://www.ohloh.net/languages/compare?measure=commits&percent=&l0=perl&l1=php&l2=python&l3=-1&l4=-1&commit=Update George -- http://mail.python.org/mailman/listinfo/python-list

Re: Job Offer: Python Ninja or Pirate!

2007-12-10 Thread George Sakkis
ect magic! :-) > > Output should be: > > | Chicago: 3 > | Fort Lauderdale: 1 > | Jersey City And South Florida: 1 > | New York: 1 Alas, it's not: AttributeError: 'module' object has no attribute 'dom' Here's a working version, optimized for char length (one line, 241 chars): import urllib as U,elementtree.ElementTree as E;c=[E.parse(U.urlopen('http://api.etsy.com/feeds/xml_user_details.php? id=%d'%u)).findtext('//city')for u in 71234,729,42346,77290,729,729];print'\n'.join('%s: %s'% (i,c.count(i))for i in set(c)) George -- http://mail.python.org/mailman/listinfo/python-list

Re: Job Offer: Python Ninja or Pirate!

2007-12-11 Thread George Sakkis
On Dec 10, 11:07 pm, Stargaming <[EMAIL PROTECTED]> wrote: > On Mon, 10 Dec 2007 19:27:43 -0800, George Sakkis wrote: > > On Dec 10, 2:11 pm, Stargaming <[EMAIL PROTECTED]> wrote: > >> On Mon, 10 Dec 2007 16:10:16 +0200, Nikos Vergas wrote: > > >> [snip]

Re: Is a "real" C-Python possible?

2007-12-12 Thread George Sakkis
nt; the inverse is not true though: time and time again people cared about some syntax for properties without any change so far. The result is a handful of different ways to spell out properties; python 2.6 will add yet another variation (http://mail.python.org/pipermail/ python-dev/2007-October/075

Re: Is a "real" C-Python possible?

2007-12-12 Thread George Sakkis
t comparable to the decorator syntax sugar, if not more. Alas, it was too much ahead of its time.. who knows, it might revive on some 3.x version. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Is a "real" C-Python possible?

2007-12-12 Thread George Sakkis
> def fget(self): > return self._foo > def fset(self, value): > self._foo = value That's almost identical to a recipe I had written once upon a time, without requiring a syntax change: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410698 George --

Re: Is a "real" C-Python possible?

2007-12-12 Thread George Sakkis
efinition Pythonic since it was conceived by the BDFL.It is also certainly an improvement over the current common practice of polluting the class namespace with private getters and setters. Still it's a kludge compared to languages with builtin support for properties. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Is a "real" C-Python possible?

2007-12-12 Thread George Sakkis
On Dec 12, 2:23 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On Dec 12, 2007 12:53 PM, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > On Dec 12, 1:12 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > > > > Kay Schluehr

Re: efficient data loading with Python, is that possible possible?

2007-12-12 Thread George Sakkis
nd) is not supported. > > I hope I am missing something. I really like Python but if there is no > way to process data efficiently, that seems to be a problem. 20 times slower because of garbage collection sounds kinda fishy. Posting some actual code usually helps; it's hard to tell for sure otherwise. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for Java programmer

2007-12-14 Thread George Sakkis
eal of exposure to language and class library, So it would > be great if anyone would suggest such framework as well. > > Looking forward for suggestions Python community! You may want to check out these first: http://dirtsimple.org/2004/12/python-is-not-java.html http://www.razorvine.ne

Re: Job Offer: Python Ninja or Pirate!

2007-12-14 Thread George Sakkis
On Dec 14, 9:57 am, Stargaming <[EMAIL PROTECTED]> wrote: > On Tue, 11 Dec 2007 08:57:16 -0800, George Sakkis wrote: > > Closer, but still wrong; for some weird reason, __import__ for modules > > in packages returns the top level package by default; you have to use > &

ANN: csvutils 0.1

2007-12-15 Thread George Sakkis
csvutils is a single Python module for easily transforming csv (or csv- like) generated rows. The release is available at http://pypi.python.org/pypi/csvutils/0.1. Regards, George What is csvutils? The standard csv module is very useful for parsing tabular data in CSV

Re: About Rational Number (PEP 239/PEP 240)

2007-12-15 Thread George Sakkis
en't so many or compelling use cases for rationals as for decimals (mainly money counting). George -- http://mail.python.org/mailman/listinfo/python-list

Re: Best idiom to unpack a variable-size sequence

2007-12-18 Thread George Sakkis
ficient and general (e.g. for infinite series) using itertools: from itertools import islice, chain, repeat def unpack(iterable, n, default=None): return islice(chain(iterable,repeat(default)), n) a, b, c = unpack(seq, 3) George -- http://mail.python.org/mailman/listinfo/python-list

Re: New+old-style multiple inheritance

2007-12-19 Thread George Sakkis
andard exception classes were old-style so it's not safe to assume that you only have new style classes to worry about when the very standard library includes lots of legacy code. George -- http://mail.python.org/mailman/listinfo/python-list

Re: New+old-style multiple inheritance

2007-12-19 Thread George Sakkis
or rather 4th party since "they" are the 3rd party here ;-)) module. Even if it's technically possible and the change doesn't break other things, I'd rather not have to maintain a patched version of the stdlib. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a simple way to parse this string ?

2007-12-20 Thread George Sakkis
t pyparsing parser. Here's the relevant thread: http://preview.tinyurl.com/2aeswn. Note that the builtin eval() is around 5x faster than this parser, and from the statement above, 50x faster than the pyparsing solution. George -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a bug in int()?

2007-12-22 Thread George Sakkis
compiles without > complaint. I'm pretty sure any line of the form "name = 0x" was a > product of some form of programmer interruptus. :-) Are you a fiction writer by any chance ? Nice story but I somehow doubt that the number of lines of the form "name = 0x" ever written in Python is greater than a single digit (with zero the most likely one). George -- http://mail.python.org/mailman/listinfo/python-list

Re: 5 queens

2007-12-24 Thread George Sakkis
3] >>> for c in combinations(xrange(4), 3): print c Traceback (most recent call last): File "combs.py", line 54, in for c in combinations(xrange(4), 3): print c File "combs.py", line 12, in combinations for cc in combinations(seq[i+1:], n-1): TypeError: sequence index must be integer, not 'slice' George -- http://mail.python.org/mailman/listinfo/python-list

Re: Speed abilities

2006-04-18 Thread Harry George
e alternative implementations. E.g., multiple processors in parallel, more efficient algorithms, ctypes or pyrex to speed up the python. In terms of the overall project notion-to-delivery duration, implementing in Python might be the right first step on your way to an assembler implementation.

Re: Looking for resources for making the jump from Java to Python easier and more productive

2006-04-24 Thread Harry George
sssibly do the whole job, could it?" If you have a good regression test suite, you are done when it works. If you need help getting on board unittests, see mkpythonproj: http://www.seanet.com/~hgg9140/comp/index.html#L006 -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list

Re: An Atlas of Graphs with Python

2006-05-02 Thread Harry George
hat cites his linguistic > foundations). > > -- Pad. > I used Python for computational linguistics coursework, but not since. Google for "nlp python". E.g.: http://nltk.sourceforge.net/ http://www.logilab.org/projects/hmm http://www.cs.berkeley.edu/~russell/aima/pyt

Decoupling fields from forms in Django

2006-05-10 Thread George Sakkis
ap a DateRangeField to a table column). Any ideas on how to decouple the field from its widget(s), even by tweaking/patching Django itself ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: retain values between fun calls

2006-05-13 Thread George Sakkis
self, a): self.b += a return self.b x = SomeFancyClassName() print x.f(1) print x.f(2) HTH, George -- http://mail.python.org/mailman/listinfo/python-list

Re: count items in generator

2006-05-13 Thread George Sakkis
turn i You can even shadow the builtin len() if you prefer: import __builtin__ def len(iterable): try: return __builtin__.len(iterable) except: i = 0 for x in iterable: i += 1 return i HTH, George -- http://mail.python.org/mailman/listinfo/python-list

Re: do/while structure needed

2006-05-13 Thread George Sakkis
idiom that I could use? > > Thanks. I guess you want something like: while True: random.shuffle(letters) trans_letters = ''.join(letters)[:len(original_set)] if some_compatison(original_set,trans_letters): trans_table = string.maketrans(original_set, trans_letters)

SQl to HTML report generator

2006-05-14 Thread George Sakkis
for report generation ? Thanks, George -- http://mail.python.org/mailman/listinfo/python-list

Re: count items in generator

2006-05-14 Thread George Sakkis
Paul Rubin wrote: > [EMAIL PROTECTED] (Cameron Laird) writes: > > For that matter, would it be an advantage for len() to operate > > on iterables? > >print len(itertools.count()) > > Ouch!! How is this worse than list(itertools.count()) ? -- http://mail.python.org/mailman/listinfo/python-l

Re: count items in generator

2006-05-14 Thread George Sakkis
Delaney, Timothy (Tim) wrote: > George Sakkis wrote: > > > Paul Rubin wrote: > > > >> [EMAIL PROTECTED] (Cameron Laird) writes: > >>> For that matter, would it be an advantage for len() to operate > >>> on iterables? > >> > >>

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