No module named DBUtils.PooledDB

2007-08-01 Thread cpmishra
Hi all I have used DBUtil with python2.4. when we run to program in dos command ,successfully run but when we run in apache server (locally)with modepython then given error.Pls help me error: No module named DBUtils.PooledDB cp mishra -- http://mail.python.org/mailman/listinfo/python-li

a dict trick

2007-08-01 Thread james_027
hi for example I have this dictionary dict = {'name':'james', 'language':'english'} value = 'sex' in dict and dict['sex'] or 'unknown' is a right pythonic of doing this one? I am trying to get a value from the dict, but if the key doesn't exist I will provide one. THanks james -- http://mail

Re: Equivalent to gzinflate() function in PHP.

2007-08-01 Thread Adam Kubica
On Thu, 02 Aug 2007 08:17:13 +0200, Adam Kubica wrote: > On Wed, 01 Aug 2007 13:54:21 +, kyosohma wrote: > >> On Aug 1, 8:44 am, Adam Kubica <[EMAIL PROTECTED]> wrote: >>> Hellou. >>> >>> Anybody know about code that work equivalent to gzinflate() >>> function used in PHP? >>> >>> I search vi

Re: Equivalent to gzinflate() function in PHP.

2007-08-01 Thread Adam Kubica
On Wed, 01 Aug 2007 13:54:21 +, kyosohma wrote: > On Aug 1, 8:44 am, Adam Kubica <[EMAIL PROTECTED]> wrote: >> Hellou. >> >> Anybody know about code that work equivalent to gzinflate() >> function used in PHP? >> >> I search via google but I don't found anything sensible :-( > > I'm not sure

Re: Emacs + python

2007-08-01 Thread Ben Finney
hg <[EMAIL PROTECTED]> writes: > Are there any cscope & ECB equivalent for Python ? Can you describe these things, for those who don't have any experience of them but may know of an equivalent? -- \"With Lisp or Forth, a master programmer has unlimited power | `\ and expressivene

Re: Is shelve/dbm supposed to be this inefficient?

2007-08-01 Thread Marc 'BlackJack' Rintsch
On Wed, 01 Aug 2007 15:47:21 -0800, Joshua J. Kugler wrote: > My original data is 33MB. When each row is converted to python lists, and > inserted into a shelve DB, it balloons to 69MB. Now, there is some > additional data in there namely a list of all the keys containing data (vs. > the keys th

Re: calling superclass __init__ when superclass is object

2007-08-01 Thread Evan Klitzke
On 8/1/07, Evan Klitzke <[EMAIL PROTECTED]> wrote: > Hi list, > > I was reading this article: http://fuhm.net/super-harmful/ and didn't > understand the comment about calling super(Foo, self).__init__() when > Foo inherits only from object. Can someone on the list elaborate more > on why one should

Re: Where do they tech Python officialy ?

2007-08-01 Thread Alex Martelli
Alex Popescu <[EMAIL PROTECTED]> wrote: ... > Have you seen/heard of Jim lately? Cause I haven't. By the time he was > the lead of the AspectJ team his charismatic presence was everywhere (at > least around that project). He wasn't at OSCON this year, but I hope to see him at Pycon next year. I

Re: access the name of my method inside it

2007-08-01 Thread Evan Klitzke
On 8/1/07, james_027 <[EMAIL PROTECTED]> wrote: > Hi, > > On Aug 1, 5:18 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > On Wed, 01 Aug 2007 09:06:42 +, james_027 wrote: > > > for example I have this method > > > > > def my_method(): > > > # do something > > > > > # how do I

DBUtil with modepython

2007-08-01 Thread cpmishra
Hi all I have used DBUtil in mysql databse. when we run to program in dos command ,successfully run but when we run in apache server (locally)with modepython then given error.Pls give me suggation error: No module named DBUtils.PooledDB cp mishra -- http://mail.python.org/mailman/listi

calling superclass __init__ when superclass is object

2007-08-01 Thread Evan Klitzke
Hi list, I was reading this article: http://fuhm.net/super-harmful/ and didn't understand the comment about calling super(Foo, self).__init__() when Foo inherits only from object. Can someone on the list elaborate more on why one should do this? -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mai

Re: beginner in python

2007-08-01 Thread Steve Holden
Beema shafreen wrote: > hi everybody, >I am beginner in python > I have to calculate the euclidean distance between the atoms from a pdb > file > i have written the the code and its shows me some error , > the code: > import re > import string > import math > ab =[] > x_value = [] > y_value =

beginner in python

2007-08-01 Thread Beema shafreen
hi everybody, I am beginner in python I have to calculate the euclidean distance between the atoms from a pdb file i have written the the code and its shows me some error , the code: import re import string import math ab =[] x_value = [] y_value = [] z_value = [] fh = open("1K5N.pdb",'r') for

Re: Error with Tkinter and tkMessageBox

2007-08-01 Thread John McMonagle
Fabio Z Tessitore wrote: > hi all, > > this Tkinter very simple code work fine: > > ## > from Tkinter import * > > win = Tk() > win.mainloop() > ## > > but if I try to open a message box, it happens: > > Exception in Tkinter callback > Traceback

beginner in python

2007-08-01 Thread Beema shafreen
Hi everybody , I am a beginner in python, I have to fetch the redundant entries from a file, code: import re L = [] fh = open('ARCHITECTURE_MAIN.txt','r') for line in fh.readlines(): data =line.strip() # splitted = data.split('#') L.append(data) fh.close() M

Re: encode() question

2007-08-01 Thread Gabriel Genellina
En Tue, 31 Jul 2007 16:41:48 -0300, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> escribió: > On Tue, 31 Jul 2007 10:45:26 -0700, 7stud wrote: >> On Jul 31, 11:18 am, "Gabriel Genellina" <[EMAIL PROTECTED]> >> wrote: >>> str.decode and unicode.encode should NOT exist, or at least issue a >>> warn

Re: sending very large packets over the network

2007-08-01 Thread Gary Herron
Walker Lindley wrote: > OK, I'm back with another networking question. I'm trying to seend > large amounts of information over TCP (the length of data being given > to send() is on the order of 16000 characters in length). > Unfortunately on the receiving end, the packets appear to be > truncat

Re: Extending Python by Adding Keywords & Data types

2007-08-01 Thread Paul McGuire
On Aug 1, 8:08 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > > def add(self,other): > if len(self.contents) < self.capacity: > self.contents.append( other ) > else: > raise ValueError("can't add any more to this Box") > I guess that really should raise a

Re: frequency analysis of a DB column

2007-08-01 Thread Paul McGuire
On Aug 1, 9:21 pm, goldtech <[EMAIL PROTECTED]> wrote: > In Python 2.1 are there any tools to take a column from a DB and do a > frequency analysis - a breakdown of the values for this column? > > Possibly a histogram or a table saying out of 500 records I have one > hundred and two "301" ninety-ei

Re: frequency analysis of a DB column

2007-08-01 Thread Gabriel Genellina
En Wed, 01 Aug 2007 23:21:53 -0300, goldtech <[EMAIL PROTECTED]> escribió: > In Python 2.1 are there any tools to take a column from a DB and do a > frequency analysis - a breakdown of the values for this column? > > Possibly a histogram or a table saying out of 500 records I have one > hundred

Re: What does this thread have to do with classical music,

2007-08-01 Thread Art Deco
ah <[EMAIL PROTECTED]> wrote: >Art Deco wrote: >> ah <[EMAIL PROTECTED]> wrote: >>>Art Deco wrote: ah <[EMAIL PROTECTED]> wrote: >Art Deco wrote: >> ah <[EMAIL PROTECTED]> wrote: >>>Art Deco wrote: Who wrote? >What does that have to do with clas

Re: Floats as keys in dict

2007-08-01 Thread greg
Brian Elmegaard wrote: > However, the dict keys are then floats and I have to round the values > of new possible nodes in each step. Be careful with this. If you have two values that are very close together, but on different sides of a rounding boundary, they will end up as distinct keys even thou

frequency analysis of a DB column

2007-08-01 Thread goldtech
In Python 2.1 are there any tools to take a column from a DB and do a frequency analysis - a breakdown of the values for this column? Possibly a histogram or a table saying out of 500 records I have one hundred and two "301" ninety-eight "212" values and three-hundred "410"? Is SQL the way to for

Re: access the name of my method inside it

2007-08-01 Thread james_027
Hi all! Thanks for all your idea, this community is truly a great one! james -- http://mail.python.org/mailman/listinfo/python-list

Re: Emacs + python

2007-08-01 Thread hg
Edward O'Connor wrote: >> Could anyone put me on the right track to developing Python with emacs >> please : modes to consider, debugging etc hopefully all within emacs. > > Personally, I prefer the python.el that ships with Emacs 22 to the > python-mode.el from python.org. It seems more like oth

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread hg
Fuzzyman wrote: > On Aug 2, 1:46 am, "Greg Donald" <[EMAIL PROTECTED]> wrote: >> On 8/1/07, John K Masters <[EMAIL PROTECTED]> wrote: >> >> > If their support for paid customers is anything like their support for >> > prospective customers then I would leave well alone. >> >> I had no problems wit

Re: Emacs + python

2007-08-01 Thread Edward O'Connor
> Could anyone put me on the right track to developing Python with emacs > please : modes to consider, debugging etc hopefully all within emacs. Personally, I prefer the python.el that ships with Emacs 22 to the python-mode.el from python.org. It seems more like other Emacs major modes. Ted --

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread Fuzzyman
On Aug 2, 1:46 am, "Greg Donald" <[EMAIL PROTECTED]> wrote: > On 8/1/07, John K Masters <[EMAIL PROTECTED]> wrote: > > > If their support for paid customers is anything like their support for > > prospective customers then I would leave well alone. > > I had no problems with their support whatsoeve

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread Greg Donald
On 8/1/07, John K Masters <[EMAIL PROTECTED]> wrote: > If their support for paid customers is anything like their support for > prospective customers then I would leave well alone. I had no problems with their support whatsoever, really good in my opinion. They were very responsive and addressed

Re: What does this thread have to do with classical music,

2007-08-01 Thread ah
Art Deco wrote: > ah <[EMAIL PROTECTED]> wrote: >>Art Deco wrote: >>> ah <[EMAIL PROTECTED]> wrote: Art Deco wrote: > ah <[EMAIL PROTECTED]> wrote: >>Art Deco wrote: >>> Who wrote? >>> >>> What does that have to do with classical music, snuhwolf? >>> W

Re: Is shelve/dbm supposed to be this inefficient?

2007-08-01 Thread Joshua J. Kugler
On Wednesday 01 August 2007 16:08, Thomas Jollans wrote: > Have you considered a directory full of pickle files ? (In effect, > replacing the dbm with the file system) i.e. something like (untested) > > class DirShelf(dict): A very interesting idea. I'll have to see how that plays out performan

Re: Python end of file marker similar to perl's __END__

2007-08-01 Thread Ben Finney
beginner <[EMAIL PROTECTED]> writes: > Thanks everyone for responding. It doesn't look like python has > it. I would definitely miss it. As Steve said, the nice thing about > __END__ is that things below __END__ do not have to have legit > syntax. I think the unaddressed question is: Why is there

Re: Is shelve/dbm supposed to be this inefficient?

2007-08-01 Thread Thomas Jollans
On Thursday 02 August 2007, Joshua J. Kugler wrote: > I am using shelve to store some data since it is probably the best solution > to my "data formats, number of columns, etc can change at any time" > problem. However, I seem to be dealing with bloat. > > My original data is 33MB. When each row

Re: Extending Python by Adding Keywords & Data types

2007-08-01 Thread Paul McGuire
On Aug 1, 3:10 pm, Maximus Decimus <[EMAIL PROTECTED]> wrote: > > Your code snippet was quite simple and it explained me very well than > the tutorial. HAts off to u!! > Thanks! > > I am doing my research in Pervasive space environments filled with > sensors and actuators. I am just trying to mo

Re: Emacs + python

2007-08-01 Thread Ben Finney
Hadron <[EMAIL PROTECTED]> writes: > Could anyone put me on the right track to developing Python with emacs > please : modes to consider, debugging etc hopefully all within emacs. The mode you're looking for is 'python-mode'. Turn it on (M-x python-mode), then read its help (C-h m) for all the co

Re: Where do they tech Python officialy ?

2007-08-01 Thread Alex Popescu
[EMAIL PROTECTED] (Alex Martelli) wrote in news:1i25pjo.1mo5uqc1yxqsjkN% [EMAIL PROTECTED]: > Alex Popescu <[EMAIL PROTECTED]> wrote: >... >> > and you will both learn a lot _and_ acquire "professional experience" >> > that any enlightened employer will recognize as such. >> >> It depends

Re: sending very large packets over the network

2007-08-01 Thread Thomas Jollans
On Thursday 02 August 2007, Walker Lindley wrote: > OK, I'm back with another networking question. I'm trying to seend large > amounts of information over TCP (the length of data being given to send() > is on the order of 16000 characters in length). Unfortunately on the > receiving end, the packet

Is shelve/dbm supposed to be this inefficient?

2007-08-01 Thread Joshua J. Kugler
I am using shelve to store some data since it is probably the best solution to my "data formats, number of columns, etc can change at any time" problem. However, I seem to be dealing with bloat. My original data is 33MB. When each row is converted to python lists, and inserted into a shelve DB,

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread Steve Holden
Paul Boddie wrote: > Steve Holden wrote: >> I can't think of any other products I use where you can contact the >> support team from right inside the software. And get answers without >> paying per-incident support fees! > > Proprietary products, right? A lot of KDE applications have a "Report > B

Representation of new-style instance

2007-08-01 Thread Raj B
Consider a new-style class class rabbit(object): def __init__(self,c): self.color = c r1=rabbit("blue") r2=rabbit("purple") Which C struct in the Python implementation is used to represent the instances c1 and c2 of the new-style class? I understand that when the class 'rabb

Re: Bug in Time module, or in my understanding?

2007-08-01 Thread Joshua J. Kugler
On Wednesday 01 August 2007 14:49, Jay Loden wrote: > Hope some of this helps It did, thanks! j -- Joshua Kugler Lead System Admin -- Senior Programmer http://www.eeinternet.com PGP Key: http://pgp.mit.edu/  ID 0xDB26D7CE -- http://mail.python.org/mailman/listinfo/python-list

Re: split a string of space separated substrings - elegant solution?

2007-08-01 Thread Karthik Gurusamy
On Aug 1, 12:41 am, Helmut Jarausch <[EMAIL PROTECTED]> wrote: > Many thanks to all of you! > It's amazing how many elegant solutions there are in Python. Here is yet another solution. pexpect.split_command_line() >From the documentation: split_command_line(command_line) This splits a comman

Re: Bug in Time module, or in my understanding?

2007-08-01 Thread Joshua J. Kugler
On Wednesday 01 August 2007 14:45, Paul Boddie wrote: > Well, I think that if you inspect the result of strptime, you'll see > that the last element of the time "tuple" - in fact, the tm_isdst > member of a time "structure" - is set to -1: > time.strptime('2007-03-11 02:00:00', '%Y-%m-%d %H:%

Re: force unicode strings

2007-08-01 Thread Paul Boddie
Stefan Behnel wrote: > > I guess you can't afford to wait for Python 3, can you? > > http://www.python.org/dev/peps/pep-3100/#atomic-types No need to: just start python with the -U option: Python 2.4.1 (#2, Oct 4 2006, 16:53:35) [GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2.1)] on linux2 Type "help", "cop

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread Joshua J. Kugler
On Wednesday 01 August 2007 14:15, John K Masters wrote: >> > I have been trying wing for a few days but have noticed that >> > auto-completion does not work on all modules. I submitted this to wing >> > and was told that probably my PYTHONPATH was wrong. >> It may also not work if the IDE isn't su

sending very large packets over the network

2007-08-01 Thread Walker Lindley
OK, I'm back with another networking question. I'm trying to seend large amounts of information over TCP (the length of data being given to send() is on the order of 16000 characters in length). Unfortunately on the receiving end, the packets appear to be truncated. So I wrote some code that contin

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread Paul Boddie
Steve Holden wrote: > > I can't think of any other products I use where you can contact the > support team from right inside the software. And get answers without > paying per-incident support fees! Proprietary products, right? A lot of KDE applications have a "Report Bug..." item in the "Help" me

Re: Bug in Time module, or in my understanding?

2007-08-01 Thread Jay Loden
Joshua J. Kugler wrote: > I am getting results like these with the time module: > import time int(time.mktime(time.strptime('2007-03-11 02:00:00', '%Y-%m-%d %H:%M > %S'))) > 1173610800 int(time.mktime(time.strptime('2007-03-11 03:00:00', '%Y-%m-%d %H:%M > %S'))) > 1173610800 ti

Re: A way to re-organize a list

2007-08-01 Thread beginner
On Aug 1, 1:31 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 01 Aug 2007 01:33:49 +, beginner wrote: > > On Jul 19, 10:05 am, beginner <[EMAIL PROTECTED]> wrote: > >> Hi Everyone, > > >> I have a simple list reconstruction problem, but I don't really know > >> how to do it.

Re: Filemaker interactions

2007-08-01 Thread Ian Witham
On Aug 2, 10:13 am, Jay Loden <[EMAIL PROTECTED]> wrote: > Ian Witham wrote: > > Hello, > > > I'm hoping someone here can put me on the right track with some broad > > concepts here. > > > What I am hoping to achieve is a simple HTML page to be served over > > our company LAN, into which the users

Re: Bug in Time module, or in my understanding?

2007-08-01 Thread Paul Boddie
Joshua J. Kugler wrote: > I am getting results like these with the time module: > > >>> import time > >>> int(time.mktime(time.strptime('2007-03-11 02:00:00', '%Y-%m-%d > >>> %H:%M:%S'))) > 1173610800 > >>> int(time.mktime(time.strptime('2007-03-11 03:00:00', '%Y-%m-%d > >>> %H:%M:%S'))) > 117361

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread James Matthews
I am very happy with there support i concur with what Joshua wrote! I have yet to see a full paying consumer not happy with wingide On 8/1/07, Steve Holden <[EMAIL PROTECTED]> wrote: > > Joshua J. Kugler wrote: > > On Wednesday 01 August 2007 13:53, Robert Dailey wrote: > >> He's secretly an emplo

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread Steve Holden
Joshua J. Kugler wrote: > On Wednesday 01 August 2007 13:53, Robert Dailey wrote: >> He's secretly an employee of Wing IDE in disguise!!! > > Sorry to destroy your conspiracy theories, but no, I've never been employed > by Wing IDE in any fashion, nor have I ever received any monetary > compensati

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread John K Masters
On 13:45 Wed 01 Aug , Joshua J. Kugler wrote: > On Wednesday 01 August 2007 13:28, John K Masters wrote: > > > On 15:34 Tue 31 Jul , Wingware wrote: > >> Hi, > >> > >> I'm happy to announce the first beta release of Wing IDE 3.0. It is > > I've had excellent support from them. I'm sorr

Re: Filemaker interactions

2007-08-01 Thread Jay Loden
Ian Witham wrote: > Hello, > > I'm hoping someone here can put me on the right track with some broad > concepts here. > > What I am hoping to achieve is a simple HTML page to be served over > our company LAN, into which the users (Real Estate Agents) can enter a > property address or reference nu

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread Joshua J. Kugler
On Wednesday 01 August 2007 13:53, Robert Dailey wrote: > He's secretly an employee of Wing IDE in disguise!!! Sorry to destroy your conspiracy theories, but no, I've never been employed by Wing IDE in any fashion, nor have I ever received any monetary compensation from them in any form. Just a s

Bug in Time module, or in my understanding?

2007-08-01 Thread Joshua J. Kugler
I am getting results like these with the time module: >>> import time >>> int(time.mktime(time.strptime('2007-03-11 02:00:00', '%Y-%m-%d %H:%M %S'))) 1173610800 >>> int(time.mktime(time.strptime('2007-03-11 03:00:00', '%Y-%m-%d %H:%M %S'))) 1173610800 >>> time.strftime('%Y-%m-%d %H:%M:%S', time.lo

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread Robert Dailey
He's secretly an employee of Wing IDE in disguise!!! On 8/1/07, Joshua J. Kugler <[EMAIL PROTECTED]> wrote: > > On Wednesday 01 August 2007 13:28, John K Masters wrote: > > > On 15:34 Tue 31 Jul , Wingware wrote: > >> Hi, > >> > >> I'm happy to announce the first beta release of Wing IDE 3.0.

Re: Awkward format string

2007-08-01 Thread Ian Clark
Gerard Flanagan wrote: > (snip) > > def tostring(data): > return tuple(strftime(x) for x in data[:2]) + data[2:] > Hrmm, not sure that having a function named tostring() that returns a tuple is the best idea. ;) Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread Joshua J. Kugler
On Wednesday 01 August 2007 13:28, John K Masters wrote: > On 15:34 Tue 31 Jul , Wingware wrote: >> Hi, >> >> I'm happy to announce the first beta release of Wing IDE 3.0. It is >> available from http://wingware.com/wingide/beta > If their support for paid customers is anything like their su

Filemaker interactions

2007-08-01 Thread Ian Witham
Hello, I'm hoping someone here can put me on the right track with some broad concepts here. What I am hoping to achieve is a simple HTML page to be served over our company LAN, into which the users (Real Estate Agents) can enter a property address or reference number. My next thought was to have

Re: Awkward format string

2007-08-01 Thread Gerard Flanagan
On Aug 1, 6:11 pm, beginner <[EMAIL PROTECTED]> wrote: > Hi, > > In order to print out the contents of a list, sometimes I have to use > very awkward constructions. For example, I have to convert the > datetime.datetime type to string first, construct a new list, and then > send it to print. The fo

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread John K Masters
On 15:34 Tue 31 Jul , Wingware wrote: > Hi, > > I'm happy to announce the first beta release of Wing IDE 3.0. It is > available from http://wingware.com/wingide/beta > If their support for paid customers is anything like their support for prospective customers then I would leave well alone.

Re: Floats as keys in dict

2007-08-01 Thread Brian Elmegaard
Steve Holden <[EMAIL PROTECTED]> writes: > Alex Martelli wrote: [snip] Thanks a lot for your intersting answers. I will start out taking a look at bisect. -- Brian (remove the sport for mail) http://www.et.web.mek.dtu.dk/Staff/be/be.html http://www.rugbyklubben-speed.dk -- http://mail.python

Re: access the name of my method inside it

2007-08-01 Thread Bruno Desthuilliers
Cousin Stanley a écrit : def my_method(): # do something >>> # how do I get the name of this method # which is my_method here? >>> >>>Why do you need this? There are ways but those >>>are not really good for production code. >>> >> >>I am going to use this in Dja

Re: force unicode strings

2007-08-01 Thread Stefan Behnel
Thomas Guettler wrote: > is it possible to force all non ascii strings to be unicode strings > somehow? > > Sometimes I forget that I need to write u'...' if the string contains > an umlaut. I get an exception in django later. But since the > exception does not show the string it is hard to find i

Re: Emacs + python

2007-08-01 Thread Stefan Behnel
Hadron wrote: > Could anyone put me on the right track to developing Python with emacs > please : modes to consider, debugging etc hopefully all within emacs. > > Any help and shared experiences much appreciated. AFAIR, the Python distribution comes with a Python mode for Emacs. Apart from that

Re: access the name of my method inside it

2007-08-01 Thread Cousin Stanley
>> > def my_method(): >> > >> > # do something >> >> > # how do I get the name of this method >> > # which is my_method here? >> >> Why do you need this? There are ways but those >> are not really good for production code. >> > > I am going to use this in Django. I am trying to impl

Re: Pythonic way for missing dict keys

2007-08-01 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : (snip) > Instead of doing: > > > if callable(function): function() > > you should do: > > try: > function() > except TypeError: > pass There are time where you may want to know if you have a callable without calling it... > That should work for most uses of

Re: Pythonic way for missing dict keys

2007-08-01 Thread Bruno Desthuilliers
John J. Lee a écrit : > Alex Popescu <[EMAIL PROTECTED]> writes: > > >>Zentrader <[EMAIL PROTECTED]> wrote in news:1185041243.323915.161230 >>@x40g2000prg.googlegroups.com: >> >> >>>On Jul 21, 7:48 am, Duncan Booth <[EMAIL PROTECTED]> wrote: >>> >>>[snip...] >>> >>> From the 2.6 PEP #361 (loo

Re: Extending Python by Adding Keywords & Data types

2007-08-01 Thread Maximus Decimus
On Aug 1, 9:08 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Jul 31, 3:28 pm, Maximus Decimus <[EMAIL PROTECTED]> wrote: > > > > > I am using python v2.5 and I am an amateur working on python. I am > > extending python for my research work and would like some help and > > guidance w.r.t this mat

Re: Buffering HTML as HTMLParser reads it?

2007-08-01 Thread Paul McGuire
On Aug 1, 1:31 pm, [EMAIL PROTECTED] wrote: > > I'm thinking maybe somehow have HTMLParser append each character it > reads except for data inside tags in some kind of buffer? This way I > can have the HTML contents read into a buffer, then when I do my own > handle_ overrides, I can also append t

Re: Awkward format string

2007-08-01 Thread [EMAIL PROTECTED]
On Aug 1, 9:42 am, beginner <[EMAIL PROTECTED]> wrote: (snipped) > > e is not complicated. It is a record that have 7 fields. In my program > a function outputs a list of tuples, each is of type e, and now I just > need to send them to a text file. > > I have no problem using classes and I do us

Re: UK Ordnance survey coordinates and Geocoding anyone ?

2007-08-01 Thread John J. Lee
Ken Starks <[EMAIL PROTECTED]> writes: [...] > http://www.magic.gov.uk/ [snip rest of URL...] Cool, I had no idea we still had a department of magic! I'll keep my eyes peeled for Mr. Norrell... John -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic way for missing dict keys

2007-08-01 Thread Chris Mellon
On 7/28/07, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 28 Jul 2007 11:52:48 +, Alex Popescu wrote: > > > [EMAIL PROTECTED] (John J. Lee) wrote in news:[EMAIL PROTECTED]: > > > >> Alex Popescu <[EMAIL PROTECTED]> writes: > >> > >>> Zentrader <[EMAIL PROTECTED]> wrote in > >>> news:1185

Re: Subprocess and pipe-fork-exec primitive

2007-08-01 Thread Rafael V.
Hi Martin, the operating system I'm using is SUSE Linux 10, kernel 2.6.13. You're right, I was missing something. After you told me that it couldn't be Python preforming wait() on SIGCHLD, I decided to investigate further. My application requires access to a Informix database, and uses

Re: Pythonic way for missing dict keys

2007-08-01 Thread John J. Lee
Steve Holden <[EMAIL PROTECTED]> writes: [...] > Yup. Anyway there's a trivial translation for uses of apply. > > apply(f, *args, **kw) => f(*args, **kw) [...] Steve means: apply(f, args, kw) => f(*args, **kw) John -- http://mail.python.org/mailman/listinfo/python-list

Buffering HTML as HTMLParser reads it?

2007-08-01 Thread chrispwd
Hello, I am working on a project where I'm using python to parse HTML pages, transforming data between certain tags. Currently the HTMLParser class is being used for this. In a nutshell, its pretty simple -- I'm feeding the contents of the HTML page to HTMLParser, then I am overriding the appropri

Re: Where do they tech Python officialy ?

2007-08-01 Thread Bruno Desthuilliers
Alex Popescu a écrit : > [EMAIL PROTECTED] (Alex Martelli) wrote in news:1i23wyk.avc945i4dwsiN% > [EMAIL PROTECTED]: > > >>NicolasG <[EMAIL PROTECTED]> wrote: >> ... >> >>>The problem is that I would like to work as a Python programmer but >>>all the job vacancies I can find requires a couple o

Re: Assertion in list comprehension

2007-08-01 Thread Chris Mellon
On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > On Aug 1, 12:35 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > > > I see. In fact I want to whole block surrounded by __debug__ to be > optimized away in non-debug runs. If the logic of my progra

Re: Assertion in list comprehension

2007-08-01 Thread beginner
On Aug 1, 12:38 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On 01 Aug 2007 16:55:53 GMT, Stargaming <[EMAIL PROTECTED]> wrote: > > > > > > > On Wed, 01 Aug 2007 11:28:48 -0500, Chris Mellon wrote: > > > > On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > > >> Hi, > > > >> Does anyone know how to

Re: Assertion in list comprehension

2007-08-01 Thread beginner
On Aug 1, 12:35 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > > > > > > > On Aug 1, 11:28 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > > On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > Does anyone know how to put an asse

Re: Checking object types

2007-08-01 Thread Alex Popescu
"Robert Dailey" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > --=_Part_51775_19953536.1185988361742 > Hi, > > I'm currently interested in creating an __add__() operator for one of > my classes. This class handles both integers and objects its own type, > however I don't know how I c

Re: Strange problems with subprocess

2007-08-01 Thread Michele Petrazzo
[EMAIL PROTECTED] wrote: > This doesn't look like a complete traceback. It doesn't give what the > error was. > Forgot a line, sorry! exceptions.OSError: [Errno 4] Interrupted system call > Mike > Michele -- http://mail.python.org/mailman/listinfo/python-list

Python IMAP web-access

2007-08-01 Thread Damjan
Is there some project that implements web access to an IMAP store? Maybe something AJAXy like http://roundcube.net/?? -- damjan -- http://mail.python.org/mailman/listinfo/python-list

Re: Assertion in list comprehension

2007-08-01 Thread Chris Mellon
On 01 Aug 2007 16:55:53 GMT, Stargaming <[EMAIL PROTECTED]> wrote: > On Wed, 01 Aug 2007 11:28:48 -0500, Chris Mellon wrote: > > > On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > >> Hi, > >> > >> Does anyone know how to put an assertion in list comprehension? I have > >> the following list compreh

Re: Assertion in list comprehension

2007-08-01 Thread Chris Mellon
On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > On Aug 1, 11:28 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > Hi, > > > > > Does anyone know how to put an assertion in list comprehension? I have > > > the following list c

Re: Assertion in list comprehension

2007-08-01 Thread beginner
On Aug 1, 11:28 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > > > > > > > Hi, > > > Does anyone know how to put an assertion in list comprehension? I have > > the following list comprehension, but I want to use an assertion to > > check the content

Re: Assertion in list comprehension

2007-08-01 Thread Marc 'BlackJack' Rintsch
On Wed, 01 Aug 2007 16:55:53 +, Stargaming wrote: >> Thirdly: This sort of testing is precisely what unit tests and/or >> doctests are for. > > Huh? What beginner is doing there seems more like input validation than > testing. Unit or doctests are meant for testing (and in case of doctests,

Checking object types

2007-08-01 Thread Robert Dailey
Hi, I'm currently interested in creating an __add__() operator for one of my classes. This class handles both integers and objects its own type, however I don't know how I can perform special add operations depending on which is passed in. Since I haven't seen any evidence of function overloading,

Re: Awkward format string

2007-08-01 Thread Ian Clark
beginner wrote: > Hi, > > In order to print out the contents of a list, sometimes I have to use > very awkward constructions. For example, I have to convert the > datetime.datetime type to string first, construct a new list, and then > send it to print. The following is an example. > > x=(e

Re: Assertion in list comprehension

2007-08-01 Thread Stargaming
On Wed, 01 Aug 2007 11:28:48 -0500, Chris Mellon wrote: > On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: >> Hi, >> >> Does anyone know how to put an assertion in list comprehension? I have >> the following list comprehension, but I want to use an assertion to >> check the contents of rec_stdl. I e

Re: Awkward format string

2007-08-01 Thread Chris Mellon
On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > On Aug 1, 11:31 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > In order to print out the contents of a list, sometimes I have to use > > > very awkward constructions. For examp

Re: Awkward format string

2007-08-01 Thread Neil Cerutti
On 2007-08-01, beginner <[EMAIL PROTECTED]> wrote: > print >>f, "%s\t%s\t%d\t%f\t%f\t%f\t%d" % > (x.field1..strftime("%Y-%m- %d"), > x.field2..strftime("%Y-%m-%d"), x.field3, x.field4, x.field5, > x.field.6, x.field7) > > This is also tedious and error-prone. Providing a suitable .str or .__repr_

Re: calling a .net application from Python 2.5

2007-08-01 Thread Chris Mellon
Note that for 2.5 you'll want the released snapshot, not the official release. On 8/1/07, James Matthews <[EMAIL PROTECTED]> wrote: > http://pythonnet.sourceforge.net/ > > > On 8/1/07, Acm <[EMAIL PROTECTED] > wrote: > > I am working with Python 2.5. > > > > I would like to know how to call a .NET

Re: Time object?

2007-08-01 Thread Steve Holden
Robert Dailey wrote: > Hi, > > I'm well aware of the datetime module, however it is really inconsistent > and useless to me. In order to do any arithmetic on time objects, I have > to use the 'timedelta' class, which doesn't even allow me to do all the > math I want to do. > > For example, I w

Re: Awkward format string

2007-08-01 Thread beginner
On Aug 1, 11:31 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > > > Hi, > > > In order to print out the contents of a list, sometimes I have to use > > very awkward constructions. For example, I have to convert the > > datetime.datetime type to strin

Re: Awkward format string

2007-08-01 Thread Chris Mellon
On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > Hi, > > In order to print out the contents of a list, sometimes I have to use > very awkward constructions. For example, I have to convert the > datetime.datetime type to string first, construct a new list, and then > send it to print. The following

Re: Python end of file marker similar to perl's __END__

2007-08-01 Thread Neil Cerutti
On 2007-08-01, Cameron Laird <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Neil Cerutti <[EMAIL PROTECTED]> wrote: >>On 2007-08-01, beginner <[EMAIL PROTECTED]> wrote: >>> Thanks everyone for responding. It doesn't look like python has >>> it. I would definitely miss it. As Steve

Re: Assertion in list comprehension

2007-08-01 Thread Chris Mellon
On 8/1/07, beginner <[EMAIL PROTECTED]> wrote: > Hi, > > Does anyone know how to put an assertion in list comprehension? I have > the following list comprehension, but I want to use an assertion to > check the contents of rec_stdl. I ended up using another loop which > essentially duplicates the fu

  1   2   >