Re: gui application on cross platform

2007-05-28 Thread Stefano Canepa
On 28 Mag, 08:01, james_027 <[EMAIL PROTECTED]> wrote: > Hi, > > I am using delphi to develop gui application, and wish to make a shift > to python. here are some of my question/concern... > > 1. is python develop gui application a cross platform? just like java > swing? Yes. Qt, wxwidgets and pyg

Re: Error in optparse documentation

2007-05-28 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Shatadal wrote: > I think the documentation should be modified so that it is made clear > that %default in the help string behaves as is claimed only in version > 2.4 and higher. Maybe something should be added for clarity but I don't think it's an error in the docs. You

Re: Can python create a dictionary from a list comprehension?

2007-05-28 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, half.italian wrote: > [entries.__setitem__(int(d.date.strftime('%m'))], d.id) for d in > links] > > btw...I was curious of this too. I used 'dir(dict)' and looked for a > method that might do what we wanted and bingo! This is really ugly. Except `__init__()` it's always

Re: gui application on cross platform

2007-05-28 Thread james_027
On May 28, 3:06 pm, Stefano Canepa <[EMAIL PROTECTED]> wrote: > On 28 Mag, 08:01, james_027 <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I am using delphi to develop gui application, and wish to make a shift > > to python. here are some of my question/concern... > > > 1. is python develop gui applica

Re: Newbie question - better way to do this?

2007-05-28 Thread Nis Jørgensen
Steve Howell skrev: > def firstIsCapitalized(word): > return 'A' <= word[0] <= 'Z' For someone who is worried about the impact of non-ascii identifiers, you are making surprising assumptions about the contents of data. Nis -- http://mail.python.org/mailman/listinfo/python-list

Re: Can python create a dictionary from a list comprehension?

2007-05-28 Thread Wim Vogelaar
> Example: > > a = [1,2,3,4,5,6,7,8,9,10] > > aDict = dict([(x,x+1) for x in a if x%2==0]) > > print aDict > When I run this program I get: {8: 9, 2: 3, 4: 5, 10: 11, 6: 7} why this output isn't ordered, giving: {2: 3, 4: 5, 6: 7, 8: 9, 10: 11 } -- http://mail.python.org/mailman/listinfo/pyth

Re: Can python create a dictionary from a list comprehension?

2007-05-28 Thread Maric Michaud
Pierre Quentel a écrit : > On 27 mai, 22:55, erikcw <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I'm trying to turn o list of objects into a dictionary using a list >> comprehension. ... > > entries = dict([ (int(d.date.strftime('%m')),d.id) for d in links] ) > > With Python2.4 and above you can use a

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-28 Thread Maric Michaud
Ben Finney a écrit : > Paul McGuire <[EMAIL PROTECTED]> writes: > >> It is a bit reassuring that I am not the only one who turns a blind >> eye to this part of the PEP, that l_c_w_u bothers others as well. > > I see similar support for lower_case, and opposition to > camelCase. It's nice that we'

Re: os.path.walk not pruning descent tree (and I'm not happy with that behavior?)

2007-05-28 Thread Maric Michaud
I'm really sorry, for all that private mails, thunderbird is awfully stupid dealing with mailing lists folder. Gabriel Genellina a écrit : > En Sun, 27 May 2007 22:39:32 -0300, Joe Ardent <[EMAIL PROTECTED]> escribió: > > > - iterate backwards: > > for i in range(len(names)-1, -1, -1): >f

Flags of the world

2007-05-28 Thread Tim Churches
http://shaheeilyas.com/flags/ Scroll to the bottom to see why this is not entirely off-topic. Are there other public examples in which Python has been used to harvest and represent public information in useful and/or interesting ways? Ideas for some more? Tim C -- http://mail.python.org/mailma

Re: gui application on cross platform

2007-05-28 Thread Gabriel Genellina
En Mon, 28 May 2007 04:28:50 -0300, james_027 <[EMAIL PROTECTED]> escribió: > I am using delphi to develop gui application, and wish to make a shift > to python. here are some of my question/concern... Explore the Python wiki, specially and Choosin

Re: unit testing

2007-05-28 Thread Nis Jørgensen
Steve Howell skrev: > And, really, if > you're not doing automated tests on your application > now, you don't know what you're missing. Quote of the day, IMO. Nis -- http://mail.python.org/mailman/listinfo/python-list

Re: Can python create a dictionary from a list comprehension?

2007-05-28 Thread Gabriel Genellina
En Mon, 28 May 2007 05:20:16 -0300, Wim Vogelaar <[EMAIL PROTECTED]> escribió: >> Example: >> >> a = [1,2,3,4,5,6,7,8,9,10] >> >> aDict = dict([(x,x+1) for x in a if x%2==0]) >> >> print aDict >> > > When I run this program I get: > {8: 9, 2: 3, 4: 5, 10: 11, 6: 7} > > why this output isn't orde

Re: Can python create a dictionary from a list comprehension?

2007-05-28 Thread Wim Vogelaar
> > why this output isn't ordered, giving: > {2: 3, 4: 5, 6: 7, 8: 9, 10: 11 } > > I made the original list two elements longer: a = [1,2,3,4,5,6,7,8,9,10,11,12] and to my surprise the output is now ordered, giving: {2: 3, 4: 5, 6: 7, 8: 9, 10: 11, 12: 13} I am running ActiveState ActivePytho

Re: os.path.walk not pruning descent tree (and I'm not happy with that behavior?)

2007-05-28 Thread Gabriel Genellina
En Mon, 28 May 2007 05:25:18 -0300, Maric Michaud <[EMAIL PROTECTED]> escribió: > Gabriel Genellina a écrit : >> - iterate backwards: >> >> for i in range(len(names)-1, -1, -1): >>fname = names[i] >>if fname[:1]=='.': >> names.remove(fname) >> > > This is not about iterating backwar

Sci.linalg.lu permuation error

2007-05-28 Thread Luke
I'm trying to use Scipy's LU factorization. Here is what I've got: from numpy import * import scipy as Sci import scipy.linalg A=array([[3., -2., 1., 0., 0.],[-1., 1., 0., 1., 0.],[4., 1., 0., 0., 1.]]) p,l,u=Sci.linalg.lu(A,permute_l = 0) now, according to the documentation: **

Re: Can python create a dictionary from a list comprehension?

2007-05-28 Thread half . italian
On May 28, 12:25 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, half.italian > wrote: > > > [entries.__setitem__(int(d.date.strftime('%m'))], d.id) for d in > > links] > > > btw...I was curious of this too. I used 'dir(dict)' and looked for a > > method that migh

Re: What's the best way to iniatilize a function

2007-05-28 Thread Gregor Horvath
Jack schrieb: > I didn't call del explicitly. I'm expecting Python to call it when > the program exits. I put a logging line in __del__() but I never > see that line printed. It seems that __del__() is not being called > even when the program exits. Any idea why? > > http://effbot.org/pyfaq/my-

Re: gui application on cross platform

2007-05-28 Thread Matt van de Werken
james_027 wrote: > Hi, > > I am using delphi to develop gui application, and wish to make a shift > to python. here are some of my question/concern... > > 1. is python develop gui application a cross platform? just like java > swing? > 2. delphi makes things easy for me like coding for a specific

Re: Can python create a dictionary from a list comprehension?

2007-05-28 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Do you think we just shouldn't use list comprehensions to build > dictinaries at all? Or is Stefan's solution acceptable (and pythonic)? Use list comprehensions where you need the resulting list; if you want nothing but the side effects, use a for loop. [Stefan Sonnenb

Re: Can python create a dictionary from a list comprehension?

2007-05-28 Thread Gabriel Genellina
En Mon, 28 May 2007 05:37:12 -0300, Wim Vogelaar <[EMAIL PROTECTED]> escribió: > I made the original list two elements longer: a = > [1,2,3,4,5,6,7,8,9,10,11,12] > > and to my surprise the output is now ordered, giving: {2: 3, 4: 5, 6: 7, > 8: > 9, 10: 11, 12: 13} > > I am running ActiveState

Issue of redirecting the stdout to both file and screen

2007-05-28 Thread 人言落日是天涯,望极天涯不见家
I wanna print the log to both the screen and file, so I simulatered a 'tee' class Tee(file): def __init__(self, name, mode): file.__init__(self, name, mode) self.stdout = sys.stdout sys.stdout = self def __del__(self): sys.stdout = self.stdout self

Re: Unsubscribing from the mailing list

2007-05-28 Thread Ben Finney
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > I do not know if this is the correct group to ask this question. But > since mailman is python-based I thought i would ask here. There are a great many Python-based applications; this forum is for discussing the Python language and closely-related

Re: Unsubscribing from the mailing list

2007-05-28 Thread Tina I
[EMAIL PROTECTED] wrote: > Hi All, > > I do not know if this is the correct group to ask this question. But > since mailman is python-based I thought i would ask here. > > I had subscribed to a mailing list called [EMAIL PROTECTED] > adventitiously. I then wanted to reverse my decision and so tri

xmlrpclib hangs execution

2007-05-28 Thread Arno Stienen
Perhaps I should be a bit more specific. When using this code to connect to a remote XML-RPC server (C++, xmlrpc++0.7 library): import xmlrpclib server = xmlrpclib.Server("http://10.10.101.62:29500";) print server.Connection_Request("roberto") the Python command

stdout and threads

2007-05-28 Thread Troels Thomsen
Hello All I have trouble printing to stdout from a thread and main program. Not only will it look strange when they try to print at the same time, that is ok, but i think i see lock-ups. (strange exceptions in Tkinker etc) Or is it an issue with IDLE ? Should I implement a lock'ed / queued ver

Re: conditionally creating functions within a class?

2007-05-28 Thread [EMAIL PROTECTED]
On 26 mai, 04:14, Steve Holden <[EMAIL PROTECTED]> wrote: (snip) > one of the primary ideas behind object > orientation is that the class defines the same methods for all instances. > While this is effectively the standard behaviour in class-based OOPLs, I would definitively not present this as "o

Re: python -- prolog bridge error

2007-05-28 Thread [EMAIL PROTECTED]
On May 27, 8:40 pm, yuce <[EMAIL PROTECTED]> wrote: > Hello, > > PySWIP requires "libpl.dll" to be on the path. There are two ways to > do this: > > 1) Add 'bin' directory of SWI-Prolog to the PATH (it's C:\Program Files > \pl\bin on my system), > > 2) Or, copy 'libpl.dll' and 'pthreadVC.dll' to C:

Re: Issue of redirecting the stdout to both file and screen

2007-05-28 Thread Peter Otten
人言落日是天涯,望极天涯不见家 wrote: > I wanna print the log to both the screen and file, so I simulatered a > 'tee' > > class Tee(file): > > def __init__(self, name, mode): > file.__init__(self, name, mode) > self.stdout = sys.stdout > sys.stdout = self > > def __del__(self):

Re: Can python create a dictionary from a list comprehension?

2007-05-28 Thread Duncan Booth
"Wim Vogelaar" wrote: > >> >> why this output isn't ordered, giving: >> {2: 3, 4: 5, 6: 7, 8: 9, 10: 11 } >> >> > > I made the original list two elements longer: a = > [1,2,3,4,5,6,7,8,9,10,11,12] > > and to my surprise the output is now ordered, giving: {2: 3, 4: 5, 6: > 7, 8: 9, 10: 11, 12:

Re: Issue of redirecting the stdout to both file and screen

2007-05-28 Thread Gabriel Genellina
En Mon, 28 May 2007 06:17:39 -0300, 人言落日是天涯,望极天涯不见家 <[EMAIL PROTECTED]> escribió: > I wanna print the log to both the screen and file, so I simulatered a > 'tee' > > class Tee(file): > > def __init__(self, name, mode): > file.__init__(self, name, mode) > self.stdout = sys.std

Formal interfaces with Python

2007-05-28 Thread Florian Lindner
Hello, some time ago I've heard about proposals to introduce the concecpt of interfaces into Python. I found this old and rejected PEP about that: http://www.python.org/dev/peps/pep-0245/ What is the current status of that? Thanks, Florian -- http://mail.python.org/mailman/listinfo/python-list

Re: speeding things up with C++

2007-05-28 Thread bullockbefriending bard
thanks! i'll look into this. On May 27, 5:35 am, Che Guevara <[EMAIL PROTECTED]> wrote: > On May 26, 11:19 am, bullockbefriending bard <[EMAIL PROTECTED]> > wrote: > > > However, I hope someone reading this will be able to tell me that I'm > > being a total pessimist and that in fact it isn't very

FTP not Returning (Python on Series 60 Nokia)

2007-05-28 Thread Eisl Thomas
Hi! Do you already have found a solution for the FTP.storbinary hang-up-problem? I am writing a program who connects himself a lot of times to a FTP-Server, but in about 1 of 100 cases, it gets stuck in the storbinary command although the connection seems to work. I have already tried to set a

Re: speeding things up with C++

2007-05-28 Thread bullockbefriending bard
I wonder if Jython might be the answer? Java is going to be faster than Python for the time-critical part of my program. Does anybody have experience getting data structures like nested lists / tuples into a java routine from a running jython program (and then back again)? -- http://mail.python.o

pyAntTasks

2007-05-28 Thread kilnhead
I am trying to use pyAntTasks in Eclipse. I have followed the example in the ibm doc, but I get the following error: [taskdef] Could not load definitions from resource pyAntTasks.properties. It could not be found. I have added pyAntTasks to my classpath and AntHome directory. Anybody have any i

Re: Issue of redirecting the stdout to both file and screen

2007-05-28 Thread Peter Otten
Gabriel Genellina wrote: > En Mon, 28 May 2007 06:17:39 -0300, ??? > <[EMAIL PROTECTED]> escribió: > >> I wanna print the log to both the screen and file, so I simulatered a >> 'tee' >> >> class Tee(file): >> >> def __init__(self, name, mode): >> file.__init__(self, name,

Good idea to use a class as function with __new__?

2007-05-28 Thread glomde
Hi, I am implementing som code generation and want to to use some variant of the template method pattern. What I came up with is to have a class with the common part in a method and the subclasses can then override the Customize methods to do their own special part. Now to the question I use the

Re: Flags of the world

2007-05-28 Thread Ben Finney
Tim Churches <[EMAIL PROTECTED]> writes: > http://shaheeilyas.com/flags/ > > Scroll to the bottom to see why this is not entirely off-topic. I fail to see what it has to do with the thread you're replyiing to, which is a discussion of creating a dictionary from a list comprehension. If you want

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-28 Thread John J. Lee
Paul McGuire <[EMAIL PROTECTED]> writes: [...] > http://mail.python.org/pipermail/python-dev/2005-December/058750.html > > At first, Guido seemed ambivalent, and commented on the > contentiousness of the issue, but it seems that the "non-English > speakers can more easily find word breaks marked w

Re: What's the best way to iniatilize a function

2007-05-28 Thread Steven D'Aprano
On Mon, 28 May 2007 11:01:26 +0200, Gregor Horvath wrote: > Jack schrieb: > >> I didn't call del explicitly. I'm expecting Python to call it when >> the program exits. I put a logging line in __del__() but I never >> see that line printed. It seems that __del__() is not being called >> even when

Re: Ancient projectiles (was: Muzzle Velocity (was: High resolution sleep (Linux))

2007-05-28 Thread John J. Lee
Roy Smith <[EMAIL PROTECTED]> writes: > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Cameron Laird) > wrote: > > > Hmmm; now you've got me curious. What *were* the first > > composite projectiles? > > Fetchez la Vache! :-) -- http://mail.python.org/mailman/listinfo/python-list

Python-URL! - weekly Python news and links (May 28)

2007-05-28 Thread Gabriel Genellina
QOTW: "Good God! Is there *anything* that python does not already do? I hardly feel the need to write programs anymore ... Its really 80% like of the questions that are asked here get answered along the lines of: import some_fancy_module solution = some_fancy_module.exactly_the_right_func

Re: itertools.groupby

2007-05-28 Thread Carsten Haese
On Sun, 2007-05-27 at 18:12 -0700, Steve Howell wrote: > [...] there is no way > that "uniquekeys" is a sensible variable [...] That's because the OP didn't heed the advice from the docs that "Generally, the iterable needs to already be sorted on the same key function." > http://informixdb.blogsp

Re: What's the best way to iniatilize a function

2007-05-28 Thread Steven D'Aprano
On Sun, 27 May 2007 23:20:49 -0700, Jack wrote: > Thanks Steven, for the reply. Very helpful. I've got a lot to learn in > Python :) > > Some questions: > >> (1) Python can automatically free most data structures and close open >> files, but if your needs are more sophisticated, this approach m

Re: What's the best way to iniatilize a function

2007-05-28 Thread Laurent Pointal
Jack wrote: >>> 2. what's the right way to call mylib_exit()? I put it in __del__(self) >>> but it is not being called in my simple test. >> >> instance.__del__ is only called when there are no references to the >> instance. > > I didn't call del explicitly. I'm expecting Python to call it when >

Re: Error in optparse documentation

2007-05-28 Thread Shatadal
On May 28, 2:19 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Shatadal > wrote: > > > I think the documentation should be modified so that it is made clear > > that %default in the help string behaves as is claimed only in version > > 2.4 and higher. > > Maybe so

Re: Newbie question - better way to do this?

2007-05-28 Thread Steve Howell
--- Nis Jørgensen <[EMAIL PROTECTED]> wrote: > Steve Howell skrev: > > > def firstIsCapitalized(word): > > return 'A' <= word[0] <= 'Z' > > For someone who is worried about the impact of > non-ascii identifiers, > you are making surprising assumptions about the > contents of data. > The f

Re: itertools.groupby

2007-05-28 Thread Carsten Haese
On Sun, 2007-05-27 at 20:28 -0700, Paul Rubin wrote: >fst = operator.itemgetter(0) >snd = operator.itemgetter(1) > >def bates(fd): > # generate tuples (n,d) of lines from file fd, > # where n is the record number. Just iterate through all lines > # of the file, stamping

Can string be callable as a method ?

2007-05-28 Thread Jia Lu
Hi all I tried to scan a directory and __import__ all modules , imported module: help imported module: __init__ imported module: hi imported module: thanks and I scaned all methods in them, and put them to a list like: [['f_chelp', 'f_help'], [], ['f_exclaim', 'f_hi', 'random'], ['f_thanks', 'r

Re: a bug in python windows service?

2007-05-28 Thread momobear
On May 27, 11:25 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sun, 27 May 2007 09:07:36 -0300, momobear <[EMAIL PROTECTED]> escribió: > > >> Instead of extending join(), write a specific method to signal the > >> quitEvent or just let the caller signal it. And I don't see in this > >> ex

Re: gui application on cross platform

2007-05-28 Thread johnf
james_027 wrote: > Hi, > > I am using delphi to develop gui application, and wish to make a shift > to python. here are some of my question/concern... > > 1. is python develop gui application a cross platform? just like java > swing? > 2. delphi makes things easy for me like coding for a specifi

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-28 Thread Steven Bethard
John J. Lee wrote: > Paul McGuire <[EMAIL PROTECTED]> writes: > [...] >> http://mail.python.org/pipermail/python-dev/2005-December/058750.html >> >> At first, Guido seemed ambivalent, and commented on the >> contentiousness of the issue, but it seems that the "non-English >> speakers can more easil

Re: Can string be callable as a method ?

2007-05-28 Thread Steven D'Aprano
On Mon, 28 May 2007 06:45:47 -0700, Jia Lu wrote: > Hi all > I tried to scan a directory and __import__ all modules , > > imported module: help > imported module: __init__ > imported module: hi > imported module: thanks > > and I scaned all methods in them, and put them to a list like: > > [['

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Raymond Hettinger <[EMAIL PROTECTED]> wrote: > + The operation of \function{groupby()} is similar > to the \code{uniq} > filter > + in \UNIX{}. [...] Thanks! The comparison of groupby() to "uniq" really clicks with me. To the extent that others like the Unix command line analogy for u

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-28 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: > Stefan Sonnenberg-Carstens wrote: > > Paul McGuire schrieb: > >> I'm starting a new thread for this topic, so as not to hijack the one > >> started by Steve Howell's excellent post titled "ten small Python > >> programs".

gettext backwards

2007-05-28 Thread SPE - Stani's Python Editor
I am developping an international application for which I use gettext. An user can fill in certain fields with variable names which are also localized, eg: filename _('filename') = 'bestandsnaam' #for dutch As an english user might save this configuration, I want that eg a Dutch user can open thi

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Paul Rubin <"http://phr.cx"@NOSPAM.invalid> wrote: > [...] > Here's yet another example that came up in something > I was working on: > you are indexing a book and you want to print a list > of page numbers > for pages that refer to George Washington. If > Washington occurs on > several conse

Re: Newbie question - better way to do this?

2007-05-28 Thread Nis Jørgensen
Steve Howell skrev: > --- Nis Jørgensen <[EMAIL PROTECTED]> wrote: > >> Steve Howell skrev: >> >>> def firstIsCapitalized(word): >>> return 'A' <= word[0] <= 'Z' >> For someone who is worried about the impact of >> non-ascii identifiers, >> you are making surprising assumptions about the >> co

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-28 Thread Steve Howell
--- Roy Smith <[EMAIL PROTECTED]> wrote: > It's certainly easier to parse ip_address as > compared to IPAddress. > Same with snmp_manager vs SNMPManager. > Somebody earlier was actually advocating something called proper_case, in which you can capitalize certain letters for clarity, like test

Re: itertools.groupby

2007-05-28 Thread 7stud
On May 27, 6:50 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > On May 27, 2:59 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > > > These docs need work. Please do not defend them; > > please suggest improvements. > > FWIW, I wrote those docs. Suggested improvements are > welcome; however, I thi

Re: ten small Python programs

2007-05-28 Thread Stef Mientki
Steve Howell wrote: > I've always thought that the best way to introduce new > programmers to Python is to show them small code > examples. > This is really a nice piece of missing Python. Sorry I didn't follow this thread accurately, but have you considered to produce an example environment li

Re: ten small Python programs

2007-05-28 Thread Kay Schluehr
Just for the amusement of the audience. The following is a reusable testscript: >>> def add_money(amounts): ... pennies = sum([round(int(amount * 100)) for amount in amounts]) ... return float(pennies / 100.0) ... >>> add_money([0.13, 0.02]) == 0.15 0.14999 >>> add_money([0.13,

Re: Issue of redirecting the stdout to both file and screen

2007-05-28 Thread Gabriel Genellina
En Mon, 28 May 2007 09:10:40 -0300, Peter Otten <[EMAIL PROTECTED]> escribió: > Gabriel Genellina wrote: > >> En Mon, 28 May 2007 06:17:39 -0300, ??? >> <[EMAIL PROTECTED]> escribió: >> >>> def __init__(self, name, mode): >>> file.__init__(self, name, mode) >>> se

Re: Newbie question - better way to do this?

2007-05-28 Thread Steve Howell
--- Nis Jørgensen <[EMAIL PROTECTED]> wrote: > > I disagree that word.istitle is the correct idiom - > from the naming of > the function in the original example, I would guess > "word[0].isupper" > would do the trick. > That would return something like this: You want to add parens: wor

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-28 Thread Sergei Organov
Roy Smith <[EMAIL PROTECTED]> writes: [...] > On the other hand, I'm convinced that words_with_underscores, is easier to > read. This is especially true when abbreviations creep into variable > names. It's certainly easier to parse ip_address as compared to IPAddress. > Same with snmp_manager

Re: speeding things up with C++

2007-05-28 Thread Kay Schluehr
On May 26, 11:19 am, bullockbefriending bard <[EMAIL PROTECTED]> wrote: > I've done all the requisite profiling and thought fairly deeply about > the efficiency of my python code, but am still going to have to speed > up the innermost guts of what I am doing. > > Essentially, I need to pass a list

Re: Good idea to use a class as function with __new__?

2007-05-28 Thread Gabriel Genellina
En Mon, 28 May 2007 09:17:30 -0300, glomde <[EMAIL PROTECTED]> escribió: > I am implementing som code generation and want to to use some variant > of the template method pattern. > > What I came up with is to have a class with the common part > in a method and the subclasses can then override the

Re: ten small Python programs

2007-05-28 Thread Steve Howell
--- Stef Mientki <[EMAIL PROTECTED]> wrote: > Steve Howell wrote: > > I've always thought that the best way to introduce > new > > programmers to Python is to show them small code > > examples. > > > This is really a nice piece of missing Python. > Thanks. > The wxPython demo program is wr

vte examples and installation

2007-05-28 Thread Fabian Braennstroem
Hi, I am looking for simple vte examples mainly for pygtk. Can anyone point me in the right direction or is there a better terminal emulation for pygtk? It would be nice, if there exist a good howto for installing vte up for the use of python; esp. for an old redhat/scientific linux machine... I a

Re: Good idea to use a class as function with __new__?

2007-05-28 Thread glomde
Gabriel Genellina wrote: > def __call__(self, *args, **kwds): > return self.__TemplateMethod(*args, **kwds) > > x = Template()(prefix="foo") > or perhaps: > x = Template(prefix="foo")() > > I think the extra () improves readability - it's clear that x comes from a > function call, it

Build problems with sqlite on OSX

2007-05-28 Thread Darrin Thompson
I'm attempting to build python 2.5.1 fat binaries on OSX and statically link to a newer sqlite than what ships with OSX. (3.3.17). I'm getting "Bus Error" early when I run my app. If I turn on a lot of malloc debugging options and run under gdb I get this trace: (gdb) info threads * 1 process 189

Re: Formal interfaces with Python

2007-05-28 Thread Terry Reedy
"Florian Lindner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hello, | some time ago I've heard about proposals to introduce the concecpt of | interfaces into Python. I found this old and rejected PEP about that: | http://www.python.org/dev/peps/pep-0245/ | | What is the current

Re: speeding things up with C++

2007-05-28 Thread bullockbefriending bard
thanks. i'll definitely look into this. On May 28, 10:48 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On May 26, 11:19 am, bullockbefriending bard <[EMAIL PROTECTED]> > wrote: > > > > > I've done all the requisite profiling and thought fairly deeply about > > the efficiency of my python code, but

Re: itertools.groupby

2007-05-28 Thread Raymond Hettinger
On May 28, 8:34 am, 7stud <[EMAIL PROTECTED]> wrote: > >- there are two more examples on the next page. those two > > examples also give sample inputs and outputs. > > I didn't see those. Ah, there's the rub. The two sections of examples and recipes are there for a reason. This isn't a beginne

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Carsten Haese <[EMAIL PROTECTED]> wrote: > On Sun, 2007-05-27 at 18:12 -0700, Steve Howell > wrote: > > [...] there is no way > > that "uniquekeys" is a sensible variable [...] > > That's because the OP didn't heed the advice from > the docs that > "Generally, the iterable needs to already b

Re: Tix and OS X

2007-05-28 Thread Jeff Reavis
On May 26, 8:51 pm, Kevin Walzer <[EMAIL PROTECTED]> wrote: > Jeff Reavis wrote: > > Does python not ship with Tix for OS X? I know there was an issue with > > 2.5.0 and Tix on Windows, and upgrading to 2.5.1 fixed it. > > Unfortunately, I seem to have the same issue with OS X and 2.5.1. The > > er

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Raymond Hettinger <[EMAIL PROTECTED]> wrote: > That's not for everyone, so it isn't a loss if > someone sticks > with writing plain, clear everyday Python instead of > an itertool. > I know most of the module is fairly advanced, and that average users can mostly avoid it, but this is a very

Re: Why isn't this query working in python?

2007-05-28 Thread Gabriel Genellina
En Mon, 28 May 2007 14:53:57 -0300, Dennis Lee Bieber <[EMAIL PROTECTED]> escribió: > On Sun, 27 May 2007 20:35:28 -0400, Carsten Haese <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> On Sun, 2007-05-27 at 16:39 -0400, [EMAIL PROTECTED] wrote: >> > > sql = ""

Re: ten small Python programs

2007-05-28 Thread Stef Mientki
> >> The wxPython demo program is written as an >> interactive tutorial, >> with a few hundred examples, nicely ordered in >> groups. >> The user can view the demo, the code and the help >> text. >> The user can also change the code and see the >> results right away. >> > > Do you have a link? w

User input with a default value that can be modified

2007-05-28 Thread Etienne Hilson
Hello the list :-) I do a little program that permit the user to manage list of sentences. This program runs into a linux shell. The user can add, modify and delete the sentences. What I want to do is : When the user want to modify one sentence, I would like to do this : Modify your sentence :

ANN: IPyKit, the standalone IPython prompt

2007-05-28 Thread Ville Vainio
Some of you might want to play with IPyKit, especially you need a swiss-army-knife Python prompt on a (win32) machine where you don't really want to install anything (python, pyreadline, ipython, PATH settings...). It's basically a py2exe'd "preconfigured" IPython. http://ipython.scipy.org/moin/I

Re: expat parser

2007-05-28 Thread Stefan Behnel
Sebastian Bassi wrote: > I have this code: > > import xml.parsers.expat > def start_element(name, attrs): >print 'Start element:', name, attrs > def end_element(name): >print 'End element:', name > def char_data(data): >print 'Character data:', repr(data) > p = xml.parsers.expat.Parser

Re: ten small Python programs

2007-05-28 Thread Steve Howell
--- Stef Mientki <[EMAIL PROTECTED]> wrote: > > > >> It would even be nicer, if everybody could drop > >> her/his examples > >> in a standard way, so they would be automatically > >> incorporated in > >> something like the wxPython interactive demo. > >> > > > > Can you elaborate? > > Well if y

Re: User input with a default value that can be modified

2007-05-28 Thread half . italian
On May 28, 11:52 am, "Etienne Hilson" <[EMAIL PROTECTED]> wrote: > Hello the list :-) > > I do a little program that permit the user to manage list of sentences. > This program runs into a linux shell. > The user can add, modify and delete the sentences. > > What I want to do is : > > When the user

Re: itertools.groupby

2007-05-28 Thread Raymond Hettinger
> > That's not for everyone, so it isn't a loss if > > someone sticks > > with writing plain, clear everyday Python instead of > > an itertool. > > I know most of the module is fairly advanced, and that > average users can mostly avoid it, but this is a very > common-antipattern that groupby() solv

Re: User input with a default value that can be modified

2007-05-28 Thread half . italian
On May 28, 11:52 am, "Etienne Hilson" <[EMAIL PROTECTED]> wrote: > Hello the list :-) > > I do a little program that permit the user to manage list of sentences. > This program runs into a linux shell. > The user can add, modify and delete the sentences. > > What I want to do is : > > When the user

Re: itertools.groupby

2007-05-28 Thread Alex Martelli
Steve Howell <[EMAIL PROTECTED]> wrote: ... > for has_chars, frags in itertools.groupby(lines, > lambda x: len(x) > 0): Hmmm, it appears to me that itertools.groupby(lines, bool) should do just the same job, just a bit faster and simpler, no? Alex -- http://mail.python.org/mailman/listinfo/p

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-28 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Historically, it's only Java and the Windows world (including non- > standard Windows-style C++) that use forcedCase significantly (C# > draws from both). I remember meeting that style first in the X Window System (now commonly known as X11, but it w

Re: itertools.groupby

2007-05-28 Thread Gordon Airporte
7stud wrote: > Bejeezus. The description of groupby in the docs is a poster child > for why the docs need user comments. Can someone explain to me in > what sense the name 'uniquekeys' is used this example: > This is my first exposure to this function, and I see that it does have some uses in

Re: ten small Python programs

2007-05-28 Thread Stef Mientki
Steve Howell wrote: > --- Stef Mientki <[EMAIL PROTECTED]> > wrote: It would even be nicer, if everybody could drop her/his examples in a standard way, so they would be automatically incorporated in something like the wxPython interactive demo. >>> Can you elaborate? >

Re: itertools.groupby

2007-05-28 Thread Paul Rubin
Gordon Airporte <[EMAIL PROTECTED]> writes: > This is my first exposure to this function, and I see that it does > have some uses in my code. I agree that it is confusing, however. > IMO the confusion could be lessened if the function with the current > behavior were renamed 'telescope' or 'compact

Tkinter error

2007-05-28 Thread BartlebyScrivener
Finally started trying to build a simple gui form for inserting text data into a mysql db of quotations. I found this nice Tkinter tutorial, http://www.ibiblio.org/obp/py4fun/gui/tkPhone.html but midway I'm getting an error. from Tkinter import * >>> win = Tk() >>> f = Frame(win) >>> b1 = But

Re: ten small Python programs

2007-05-28 Thread Steve Howell
--- Stef Mientki <[EMAIL PROTECTED]> > > > I don't know MoinMoin, > but the answer is Yes (although maybe not for your > ten snippets). > First of all I think all programmers keep there own > collection of code snippets, > which much more valuable then "all the code code > snippets from everyone"

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Paul Rubin <"http://phr.cx"@NOSPAM.invalid> wrote: > > > But that is what groupby does, except its notion of > uniqueness is > limited to contiguous runs of elements having the > same key. It occurred to me that we could also rename the function uniq(), or unique(), after its Unix counterpa

Re: Tkinter error

2007-05-28 Thread Peter Otten
BartlebyScrivener wrote: > Finally started trying to build a simple gui form for inserting text > data into a mysql db of quotations. > > I found this nice Tkinter tutorial, > > http://www.ibiblio.org/obp/py4fun/gui/tkPhone.html > > but midway I'm getting an error. > > from Tkinter import * >

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > > That's not for everyone, so it isn't a loss if > > > someone sticks > > > with writing plain, clear everyday Python > instead of > > > an itertool. > > > > I know most of the module is fairly advanced, and > that > > average users can mostly

Re: itertools.groupby

2007-05-28 Thread Steve Howell
--- Alex Martelli <[EMAIL PROTECTED]> wrote: > Steve Howell <[EMAIL PROTECTED]> wrote: >... > > for has_chars, frags in itertools.groupby(lines, > > lambda x: len(x) > 0): > > Hmmm, it appears to me that itertools.groupby(lines, > bool) should do > just the same job, just a bit faster and si

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-28 Thread Steven D'Aprano
On Mon, 28 May 2007 14:12:33 -0700, Alex Martelli wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> Historically, it's only Java and the Windows world (including non- >> standard Windows-style C++) that use forcedCase significantly (C# >> draws from both). > > I remember meeting that st

Re: itertools.groupby

2007-05-28 Thread Paul Rubin
Raymond Hettinger <[EMAIL PROTECTED]> writes: > I think the OP would have been better-off with plain > vanilla Python such as: > >See http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/259173 But that recipe generates the groups in a random order depending on the dict hashing, instead of

  1   2   >