Re: Newbie: trying to twist my head around twisted (and python)

2006-10-20 Thread Jean-Paul Calderone
On Fri, 13 Oct 2006 18:44:35 +0200, Jan Bakuwel <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: > >> The return value of eomReceived is used to determine whether to signal to >> the SMTP client whether the message has been accepted. Regardless of your >> application logic, if you are taking

RE: invert or reverse a string... warning this is a rant

2006-10-20 Thread Demel, Jeff
>Demel, Jeff wrote: >> I've been programming professionally for over 10 years, and have never >> once needed to reverse a string. Maybe it's a lack of imagination on >> my part, but I can't think of a single instance this might be necessary. Carl wrote: >Say you're using a function from a thir

Re: invert or reverse a string... warning this is a rant

2006-10-20 Thread Tim N. van der Leeuw
Fredrik Lundh wrote: > Tim N. van der Leeuw wrote: > > > In practice, the short-term fix would be to add a __str__ method to the > > 'reversed' object > > so what should > > str(reversed(range(10))) > > do ? > My idea was that reversed.__str__() would do something like the equivalent of ''.jo

Re: Determining if a file is locked in Windows

2006-10-20 Thread Ricardo Reyes
elake wrote: > Larry Bates wrote: > > elake wrote: > > > I found this thread about a pst file in Windows being locked and I am > > > having the same issue. > > > > > > The problem is that even though I catch the IOError it overwrites the > dst file and makes it 0kb. This is going to be for backing

Re: Determining if a file is locked in Windows

2006-10-20 Thread Ricardo Reyes
elake wrote: > Larry Bates wrote: > > elake wrote: > > > I found this thread about a pst file in Windows being locked and I am > > > having the same issue. > > > > > > The problem is that even though I catch the IOError it overwrites the > dst file and makes it 0kb. This is going to be for backing

Re: pywin32 COM sort in Excel (late binding fails, early binding works) (+py2exe)

2006-10-20 Thread Kevin Grover
On Oct 19, 10:09 am, Thomas Heller <[EMAIL PROTECTED]> wrote: > Thomas- Hide quoted text -- Show quoted text - That's it thanks. A quick google search lead me to: http://www.py2exe.org/index.cgi/IncludingTypelibs Cheers - Kevin -- http://mail.python.org/mailman/listinfo/python-list

Re: invert or reverse a string... warning this is a rant

2006-10-20 Thread egbert
> > John Salerno wrote: > >> I'm not steeped enough in daily programming to argue that it isn't > >> necessary, but my question is why do you need to reverse strings? Is it > >> something that happens often enough to warrant a method for it? String reversal comes in handy when you do palindromes

Re: invert or reverse a string... warning this is a rant

2006-10-20 Thread Istvan Albert
Carl Banks wrote: > Say you're using a function from a third-party library that finds the > first character in a string that meets some requirement. You need to > find the last such character. You seem to imply that invoking a function on a reversed input is somehow a generic solution to the pro

Re: invert or reverse a string... warning this is a rant

2006-10-20 Thread Istvan Albert
egbert wrote: > String reversal comes in handy when you do palindromes. Yes, that's where the big bucks are, the Palindrome Industry. It is the shortsightedness of the Python core developers that keeps the palindrome related functions and algorithms out of the standard library i. -- http://m

Re: FTP over SSL

2006-10-20 Thread Larry Bates
Tor Erik Soenvisen wrote: > Hi, > > Anyone know about existing code supporting FTP over SSL? > I guess pycurl http://pycurl.sourceforge.net/ could be used, but that > requires knowledge of libcurl, which I haven't. > > regards I don't know if it helps at all, but you can do https put of a file o

Re: proper format for this database table

2006-10-20 Thread John Salerno
Carsten Haese wrote: >>> [id] [university] [yearStart] [yearEnd] [degreeEarned] >>> 1 U of I 19711975 BS >>> 1 U of I 19751976 MS >>> 1 U of I 19761977 PhD >>> >> Thanks guys. I do plan to have an id entry for each person as well

Re: proper format for this database table

2006-10-20 Thread John Salerno
Neil Cerutti wrote: > On 2006-10-20, John Salerno <[EMAIL PROTECTED]> wrote: >> Bruno Desthuilliers wrote: >>> John Salerno a écrit : Hi guys. I was wondering if someone could suggest some possible structures for an "Education" table in a database. >>> Wrong newsgroup, then. comp.databa

Re: invert or reverse a string... warning this is a rant

2006-10-20 Thread skip
egbert> String reversal comes in handy when you do palindromes. Which would by implication make it handy to have in a CS algorithms class and not much else. ;-) Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: invert or reverse a string... warning this is a rant

2006-10-20 Thread Simon Brunning
On 20 Oct 2006 09:34:55 -0700, Istvan Albert <[EMAIL PROTECTED]> wrote: > Yes, that's where the big bucks are, the Palindrome Industry. > > It is the shortsightedness of the Python core developers that keeps the > palindrome related functions and algorithms out of the standard library +1 QOTW --

Re: help with my first use of a class

2006-10-20 Thread James Stroud
Fulvio wrote: > *** > Your mail has been scanned by InterScan MSS. > *** > > > On Friday 20 October 2006 14:34, James Stroud wrote: >> You really don't need classes for this > > I'm in that matter too. Doesn't classes make the main program neater? > Fundam

Re: proper format for this database table

2006-10-20 Thread [EMAIL PROTECTED]
John Salerno wrote: > Carsten Haese wrote: > > >>> [id] [university] [yearStart] [yearEnd] [degreeEarned] > >>> 1 U of I 19711975 BS > >>> 1 U of I 19751976 MS > >>> 1 U of I 19761977 PhD > >>> > >> Thanks guys. I do plan to have

Re: help with my first use of a class

2006-10-20 Thread Simon Brunning
On 10/20/06, James Stroud <[EMAIL PROTECTED]> wrote: > > I don't really have formal programming training, but it is increasingly > becoming my experience that OOP is but one ingredient in a good program. > It can be left out or it can be mixed with other ingredients for a nice > effect. Indeed. Py

cross-linked version of the python documentation

2006-10-20 Thread tom arnall
Is there a cross-linked version of the python documentation available? Is anyone interested in starting a project for such? tom arnall north spit, ca usa -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: cross-linked version of the python documentation

2006-10-20 Thread Simon Brunning
On 10/20/06, tom arnall <[EMAIL PROTECTED]> wrote: > Is there a cross-linked version of the python documentation available? Is > anyone interested in starting a project for such? What do you mean by cross-linked? -- Cheers, Simon B [EMAIL PROTECTED] http://www.brunningonline.net/simon/blog/ --

ZODB and Python 2.5

2006-10-20 Thread Andrew McLean
I'm going to have to delay upgrading to Python 2.5 until all the libraries I use support it. One key library for me is ZODB. I've Googled and can't find any information on the developers' plans. Does anyone have any information that might help? - Andrew -- http://mail.python.org/mailman/list

[ANN]Py++-0.8.2

2006-10-20 Thread Roman Yakovenko
I'm glad to announce the new version of Py++. Download page: http://language-binding.net/pyplusplus/download.html What is it? Py++ is an object-oriented framework for creating a code generator for Boost.Python library. Project home page: http://language-binding.net/pyplusplus/pyplusplus.html Th

Pygtk but no gtk?

2006-10-20 Thread chengiz
I am trying to build an app that requires pygtk so I installed the latter. The app does the following: import pygtk ... import gtk This crashes with ImportError: No module named gtk. I dont know where to get this gtk module from. I assumed pygtk would be it coz the app doesnt mention any dependen

Re: cross-linked version of the python documentation

2006-10-20 Thread tom arnall
Simon Brunning wrote: > On 10/20/06, tom arnall <[EMAIL PROTECTED]> wrote: >> Is there a cross-linked version of the python documentation available? Is >> anyone interested in starting a project for such? > > What do you mean by cross-linked? If the term e.g. 'span()' is used in a discussion of

Re: Pygtk but no gtk?

2006-10-20 Thread Jonathan Smith
[EMAIL PROTECTED] wrote: > I am trying to build an app that requires pygtk so I installed the > latter. The app does the following: > import pygtk > ... > import gtk > > This crashes with > ImportError: No module named gtk. > > I dont know where to get this gtk module from. I assumed pygtk would

Re: ZODB and Python 2.5

2006-10-20 Thread Robert Kern
Andrew McLean wrote: > I'm going to have to delay upgrading to Python 2.5 until all the > libraries I use support it. One key library for me is ZODB. I've Googled > and can't find any information on the developers' plans. Does anyone > have any information that might help? Since the Python de

Re: FOR statement

2006-10-20 Thread Jordan Greenberg
Lad wrote: > If I have a list > > Mylist=[1,2,3,4,5] > I can print it > > for i in Mylist: >print i > > and results is > 1 > 2 > 3 > 4 > 5 > > > But how can I print it in a reverse order so that I get > 5 > 4 > 3 > 2 > 1 >>> def printreverse(lst): if lst: printrev

why does this unpacking work

2006-10-20 Thread John Salerno
I'm a little confused, but I'm sure this is something trivial. I'm confused about why this works: >>> t = (('hello', 'goodbye'), ('more', 'less'), ('something', 'nothing'), ('good', 'bad')) >>> t (('hello', 'goodbye'), ('more', 'less'), ('something', 'nothing'), ('good', 'bad

Re: Using Python scripts in Windows Explorer

2006-10-20 Thread [EMAIL PROTECTED]
Ben Sizer wrote: > I'd like to be able to drag a file onto a Python script in Windows > Explorer, or send that file to the script via the Send To context-menu > option, so I can then process that file via sys.argc. > > Unfortunately, I can't drag items onto the Python script, because > Windows doe

Re: proper format for this database table

2006-10-20 Thread John Salerno
[EMAIL PROTECTED] wrote: > [Eid] [Sid] [university] [yearStart] [yearEnd] [degreeEarned] > 5 1 U of I 19711975 BS > 6 1 U of I 19751976 MS > 7 1 U of I 19761977 PhD > > where [Eid] is the primary key of the Educat

Re: ZODB and Python 2.5

2006-10-20 Thread Jean-Paul Calderone
On Fri, 20 Oct 2006 14:04:46 -0500, Robert Kern <[EMAIL PROTECTED]> wrote: >Andrew McLean wrote: >> I'm going to have to delay upgrading to Python 2.5 until all the >> libraries I use support it. One key library for me is ZODB. I've Googled >> and can't find any information on the developers' pla

doctest and exposing internals.

2006-10-20 Thread Neil Cerutti
I'm using doctest for the first time, and boy is it cool. But I'm nervous about exposing library internals in the docstring. def glk_cancel_char_event(win): """ Cancel a pending request for character input. win must be a valid Glk window. >>> glk_cancel_char_event([]) Gl

Re: why does this unpacking work

2006-10-20 Thread Carsten Haese
On Fri, 2006-10-20 at 15:14, John Salerno wrote: > I'm a little confused, but I'm sure this is something trivial. I'm > confused about why this works: > > >>> t = (('hello', 'goodbye'), > ('more', 'less'), > ('something', 'nothing'), > ('good', 'bad')) > >>> t > (('hello', 'go

Re: why does this unpacking work

2006-10-20 Thread johnzenger
It's just sequence unpacking. Did you know that this works?: pair = ("California","San Francisco") state, city = pair print city # 'San Francisco' print state # 'California' John Salerno wrote: > I'm a little confused, but I'm sure this is something trivial. I'm > confused about why this works:

Re: Using Python scripts in Windows Explorer

2006-10-20 Thread MC
Hi! I use this little batch: @echo off cd \dev\python viewarg.py %* I copy/paste the batch-file on the desktop, like icon. Then, from Win-explorer, drag_and_drop & copy_and_paste run OK. -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: why does this unpacking work

2006-10-20 Thread Carsten Haese
On Fri, 2006-10-20 at 15:37, Carsten Haese wrote: > for x in t: > y,z = t > # do something with y and z Typo here, of course I mean y,z = x. -Carsten -- http://mail.python.org/mailman/listinfo/python-list

Re: I like python.

2006-10-20 Thread MC
Hi! Sorry, I don't understand well english. But, try to rename your script, from .py to .pyw (sample : titi.py ==> titi.pyw). -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Releasing weakrefed objects immediately?

2006-10-20 Thread Matti Airas
Hi all, I've been toying with an idea of dependency-based coding, in which you construct a graph of code dependencies. Say, you have independent variables 'a' and 'b', and a function f(x,y). Now, you can define that a,b are dependencies for f(a,b). Whenever a or b are changed, f(a,b) is marked dir

Steve Holden on running sprints

2006-10-20 Thread skip
Interesting article by Steve Holden on running a sprint: http://www.onlamp.com/pub/a/python/2006/10/19/running-a-sprint.html Stand up and take a bow please, Steve... Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: why does this unpacking work

2006-10-20 Thread Jon Clements
John Salerno wrote: > I'm a little confused, but I'm sure this is something trivial. I'm > confused about why this works: > > >>> t = (('hello', 'goodbye'), > ('more', 'less'), > ('something', 'nothing'), > ('good', 'bad')) > >>> t > (('hello', 'goodbye'), ('more', 'less'), ('

Re: Using Python scripts in Windows Explorer

2006-10-20 Thread Thomas Heller
Ben Sizer schrieb: > I'd like to be able to drag a file onto a Python script in Windows > Explorer, or send that file to the script via the Send To context-menu > option, so I can then process that file via sys.argc. > > Unfortunately, I can't drag items onto the Python script, because > Windows d

Re: Using Python scripts in Windows Explorer

2006-10-20 Thread Gabriel Genellina
At Friday 20/10/2006 12:20, Ben Sizer wrote: I'd like to be able to drag a file onto a Python script in Windows Explorer, or send that file to the script via the Send To context-menu option, so I can then process that file via sys.argc. Unfortunately, I can't drag items onto the Python script,

curious paramstyle qmark behavior

2006-10-20 Thread BartlebyScrivener
With aColumn = "Topics.Topic1"' The first statement "works" in the sense that it finds a number of matching rows. c.execute ("SELECT Author, Quote, ID, Topics.Topic1, Topic2 FROM QUOTES7 WHERE " + aColumn + " LIKE ?", ("%" + sys.argv[1] + "%",)) I've tried about 20 different variations on this

Re: why does this unpacking work

2006-10-20 Thread Gabriel Genellina
At Friday 20/10/2006 16:14, John Salerno wrote: I'm a little confused, but I'm sure this is something trivial. I'm confused about why this works: >>> t = (('hello', 'goodbye'), ('more', 'less'), ('something', 'nothing'), ('good', 'bad')) I understand that t returns a single t

Re: doctest and exposing internals.

2006-10-20 Thread Gabriel Genellina
At Friday 20/10/2006 16:29, Neil Cerutti wrote: The example of correct usage it what's wrong with the docstring. There's no interface for checking if an event is queued in Glk, so I resorted to exposing the internal state main.char_request in the doc string. What are the alternatives? - what

Re: why does this unpacking work

2006-10-20 Thread John Salerno
[EMAIL PROTECTED] wrote: > It's just sequence unpacking. Did you know that this works?: > > pair = ("California","San Francisco") > state, city = pair > print city > # 'San Francisco' > print state > # 'California' Yes, I understand that. What confused me was if it had been written like this:

Re: curious paramstyle qmark behavior

2006-10-20 Thread Jon Clements
BartlebyScrivener wrote: > With > > aColumn = "Topics.Topic1"' > > The first statement "works" in the sense that it finds a number of > matching rows. > > c.execute ("SELECT Author, Quote, ID, Topics.Topic1, Topic2 FROM > QUOTES7 WHERE " + aColumn + " LIKE ?", ("%" + sys.argv[1] + "%",)) > > I've

Re: I like python.

2006-10-20 Thread Fidel
Renaming the file doesn't work. I am on windows... There is a specific line of code that tells python not to bother even opening a window. of any sort for any amount of time. I just don't know what it is and haven't been able to find any reference to it Thanks for the help though. >assuming Wi

Re: curious paramstyle qmark behavior

2006-10-20 Thread Jean-Paul Calderone
On 20 Oct 2006 13:06:58 -0700, BartlebyScrivener <[EMAIL PROTECTED]> wrote: >With > >aColumn = "Topics.Topic1"' > >The first statement "works" in the sense that it finds a number of >matching rows. > >c.execute ("SELECT Author, Quote, ID, Topics.Topic1, Topic2 FROM >QUOTES7 WHERE " + aColumn + " LI

Re: why does this unpacking work

2006-10-20 Thread John Salerno
Carsten Haese wrote: > You seem to have difficulty distinguishing the concept of looping over a > tuple from the concept of unpacking a tuple. I think you're right. It's starting to make more sense now. I think when I saw: for x,y in t I was expecting 't' to be a two-tuple for it to work. May

Re: invert or reverse a string... warning this is a rant

2006-10-20 Thread Carl Banks
Istvan Albert wrote: > Carl Banks wrote: > > > Say you're using a function from a third-party library that finds the > > first character in a string that meets some requirement. You need to > > find the last such character. > > You seem to imply that invoking a function on a reversed input is > s

Re: why does this unpacking work

2006-10-20 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, John Salerno wrote: > [EMAIL PROTECTED] wrote: >> It's just sequence unpacking. Did you know that this works?: >> >> pair = ("California","San Francisco") >> state, city = pair >> print city >> # 'San Francisco' >> print state >> # 'California' > > Yes, I understand that

PSF Infrastructure has chosen Roundup as the issue tracker for Python development

2006-10-20 Thread Brett Cannon
At the beginning of the month the PSF Infrastructure committee announced that we had reached the decision that JIRA was our recommendation for the next issue tracker for Python development.  Realizing, though, that it was a tough call between JIRA and Roundup we said that we would be willing to swi

Re: proper format for this database table

2006-10-20 Thread [EMAIL PROTECTED]
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > > [Eid] [Sid] [university] [yearStart] [yearEnd] [degreeEarned] > > 5 1 U of I 19711975 BS > > 6 1 U of I 19751976 MS > > 7 1 U of I 19761977 PhD > > > > where [Eid

Re: curious paramstyle qmark behavior

2006-10-20 Thread Diez B. Roggisch
BartlebyScrivener schrieb: > With > > aColumn = "Topics.Topic1"' > > The first statement "works" in the sense that it finds a number of > matching rows. > > c.execute ("SELECT Author, Quote, ID, Topics.Topic1, Topic2 FROM > QUOTES7 WHERE " + aColumn + " LIKE ?", ("%" + sys.argv[1] + "%",)) > >

Re: curious paramstyle qmark behavior

2006-10-20 Thread BartlebyScrivener
Thanks, Jon. I'm moving from Access to MySQL. I can query all I want using Python, but so far haven't found a nifty set of forms (ala Access) for easying entering of data into MySQL. My Python is still amateur level and I'm not ready for Tkinkter or gui programming yet. rd -- Jon Cleme

Re: why does this unpacking work

2006-10-20 Thread Gabriel Genellina
At Friday 20/10/2006 17:29, John Salerno wrote: I was expecting 't' to be a two-tuple for it to work. Maybe writing it as: for (x,y) in t sort of helps to show that '(x,y)' is equivalent to one object in 't'. That makes it look a little more cohesive in my mind, I guess, or helps me to see it

Re: I like python.

2006-10-20 Thread Simon Forman
Fidel wrote: > Renaming the file doesn't work. I am on windows... Are you sure? Double-clicking on a *.pyw script file really brings up a window? Is it a GUI window or a console window? I ask because if it's a console window and you're really clicking on a .pyw file then it really should run wi

Re: Decorators and how they relate to Python - A little insight please!

2006-10-20 Thread Jerry
Thanks to everyone that resonded. I will have to spend some time reading the information that you've provided. To Fredrik, unfortunately yes. I saw the examples, but couldn't get my head wrapped around their purpose. Perhaps it's due to the fact that my only experience with programming is PHP,

Re: doctest and exposing internals.

2006-10-20 Thread Neil Cerutti
On 2006-10-20, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > At Friday 20/10/2006 16:29, Neil Cerutti wrote: >>The example of correct usage it what's wrong with the >>docstring. >> >>There's no interface for checking if an event is queued in Glk, >>so I resorted to exposing the internal state main

Re: I like python.

2006-10-20 Thread Jerry
On Oct 20, 2:59 am, Fidel <[EMAIL PROTECTED]> wrote: > Could someone please tell me what I need to put into a python script > to not have a window come up however briefly? Like when I double click > on the script, it will do it's job but won't open a command window > then close it.. I hope that exp

Re: I like python.

2006-10-20 Thread Ant
Fidel wrote: > Renaming the file doesn't work. I am on windows... There is a specific > line of code that tells python not to bother even opening a window. Seriously, renaming the script to .pyw should work from a standard python install. If it doesn't then the file handler for that extension mus

Why can't you pickle instancemethods?

2006-10-20 Thread Chris
Why can pickle serialize references to functions, but not methods? Pickling a function serializes the function name, but pickling a staticmethod, classmethod, or instancemethod generates an error. In these cases, pickle knows the instance or class, and the method, so what's the problem? Pickle doe

Re: PSF Infrastructure has chosen Roundup as the issue tracker for Python development

2006-10-20 Thread BJörn Lindqvist
On 10/20/06, Brett Cannon <[EMAIL PROTECTED]> wrote: > At the beginning of the month the PSF Infrastructure committee announced > that we had reached the decision that JIRA was our recommendation for the > next issue tracker for Python development. Realizing, though, that it was a > tough call bet

Using cElementTree and elementtree.ElementInclude

2006-10-20 Thread Mark
I have an elementtree created with cElementTree. I then use ElementInclude to resolve some xinclude elements. But then I want to move those included elements to be children of the root root.append(included_child) but I get an error message TypeError: 'append() argument 1 must be Element, not i

Re: cross-linked version of the python documentation

2006-10-20 Thread Tuomas
tom arnall wrote: > Is there a cross-linked version of the python documentation available? Is > anyone interested in starting a project for such? > > tom arnall > north spit, ca > usa > pydoc serves as such a cross-linked version of the python *online* documentation TV -- http://mail.python.o

Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-20 Thread jmdeschamps
Kevin Walzer wrote: > I'm a Tcl/Tk developer who has been working, slowly, at learning Python, > in part because Python has better support for certain kinds of > applications that I want to develop than Tcl/Tk does. Naturally, I > thought that I would use Tkinter as the GUI for these programs. How

Selecting sub-images with wxPython

2006-10-20 Thread Odalrick
I have an image displayed with wxPython and I need to let the user designate an area of that image. Something like a rectangle you can move and resize with the mouse, the exact details aren't important. So I'm wondering if there is an easy way to do this, or will I have to muck about with custom pa

Inheriting property functions

2006-10-20 Thread Dustan
Looking at this interactive session: >>> class A(object): def __init__(self, a): self.a = a def get_a(self): return self.__a def set_a(self, new_a): self.__a = new_a a = property(get_a, set_a) >>> class B(A): b = property(get_a, set_a) Tr

Re: proper format for this database table

2006-10-20 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > John Salerno wrote: > > [EMAIL PROTECTED] wrote: > > > > > [Eid] [Sid] [university] [yearStart] [yearEnd] [degreeEarned] > > > 5 1 U of I 19711975 BS > > > 6 1 U of I 19751976 MS > > > 7 1 U of I 1976

Re: why does this unpacking work

2006-10-20 Thread John Salerno
Marc 'BlackJack' Rintsch wrote: > Uhm, you mean:: > > pair = (("California","San Francisco"),) > > Note the extra comma to make that "a tuple in a tuple". > > Ciao, > Marc 'BlackJack' Rintsch You're right! -- http://mail.python.org/mailman/listinfo/python-list

Re: Why can't you pickle instancemethods?

2006-10-20 Thread mdsteele
Chris wrote: > Why can pickle serialize references to functions, but not methods? > > Pickling a function serializes the function name, but pickling a > staticmethod, classmethod, or instancemethod generates an error. In > these cases, pickle knows the instance or class, and the method, so > what's

Re: Inheriting property functions

2006-10-20 Thread Dustan
Dustan wrote: > Looking at this interactive session: > > >>> class A(object): > def __init__(self, a): > self.a = a > def get_a(self): return self.__a > def set_a(self, new_a): self.__a = new_a > a = property(get_a, set_a) > > > >>> class B(A): > b = pro

Re: Inheriting property functions

2006-10-20 Thread mdsteele
Dustan wrote: > B isn't recognizing its inheritence of A's methods get_a and set_a > during creation. > > Why am I doing this? For an object of type B, it makes more sense to > reference the attribute 'b' than it does to reference the attribute > 'a', even though they are the same, in terms of read

Re: Inheriting property functions

2006-10-20 Thread Robert Kern
Dustan wrote: > Looking at this interactive session: > class A(object): > def __init__(self, a): > self.a = a > def get_a(self): return self.__a > def set_a(self, new_a): self.__a = new_a > a = property(get_a, set_a) > > class B(A): > b = pro

Re: Why can't you pickle instancemethods?

2006-10-20 Thread Gabriel Genellina
At Friday 20/10/2006 18:33, Chris wrote: Why can pickle serialize references to functions, but not methods? Because all references must be globally accessible. Pickling a function serializes the function name, but pickling a staticmethod, classmethod, or instancemethod generates an error. In

Re: Flexible Collating (feedback please)

2006-10-20 Thread Ron Adam
Leo Kislov wrote: > Ron Adam wrote: >> Leo Kislov wrote: >>> Ron Adam wrote: >>> locale.setlocale(locale.LC_ALL, '') # use current locale settings >>> It's not current locale settings, it's user's locale settings. >>> Application can actually use something else and you will overwrite >>> that

Re: Inheriting property functions

2006-10-20 Thread mdsteele
Robert Kern wrote: > Inheritance really doesn't work that way. The code in the class suite gets > executed in its own namespace that doesn't know anything about inheritance. > The > inheritance rules operate in attribute access on the class object later. Right. That was what I should have said,

Re: Inheriting property functions

2006-10-20 Thread Gabriel Genellina
At Friday 20/10/2006 19:49, Dustan wrote: > >>> class A(object): > def get_a(self): return self.__a > def set_a(self, new_a): self.__a = new_a > a = property(get_a, set_a) > > > >>> class B(A): > b = property(get_a, set_a) Use instead: b = property(A.get_a, A.s

Detect Unused Modules

2006-10-20 Thread Kamilche
''' DetectUnusedModules.py - Detect modules that were imported but not used in a file. When run directly, this class will check all files in the current directory. ''' import os import tokenize class PrintUnusedModules(object): state = 0 importlist = None linenumbers = None def _

Re: Python with MPI enable C-module

2006-10-20 Thread Mitko Haralanov
On 19 Oct 2006 06:51:00 -0700 "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > 1) Would setting up an environment like this require modifying the > Python interpreter or the C++ module that is being wrapped? What I'm > hoping is that the C++ module can go on happily doing MPI operations > despite

Re: Why can't you pickle instancemethods?

2006-10-20 Thread Chris
[EMAIL PROTECTED] wrote: > Chris wrote: > > Why can pickle serialize references to functions, but not methods? > > > > Pickling a function serializes the function name, but pickling a > > staticmethod, classmethod, or instancemethod generates an error. In > > these cases, pickle knows the instance

Re: I like python.

2006-10-20 Thread Fidel
Although I just noticed that if the extension is .py then it will still open a command window. It does indeed need to have a .pyw extension for this to work. So all of you were correct. it needs to use popen and have .pyw as the extension in order for python not to open a command window. Thank you

Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-20 Thread greg
Paul Rubin wrote: > I have yet to see a gui toolkit which doesn't suck. I'm not sure why > that is. Have you seen PyGUI? It's my attempt at creating a GUI toolkit for Python that doesn't suck. I'd be interested to know if you think I've come anywhere near to succeeding. http://www.cosc.canterbu

Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-20 Thread Greg Ewing
Paul Rubin wrote: > I have yet to see a gui toolkit which doesn't suck. I'm not sure why > that is. Have you seen PyGUI? It's my attempt at creating a GUI toolkit for Python that doesn't suck. I'd be interested to know if you think I've come anywhere near to succeeding. http://www.cosc.canterbu

Re: Pygtk but no gtk?

2006-10-20 Thread chengiz
> my pygtk provides > /usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py, which contains > the gtk module. You should ensure that you have that file, and if not, > find out where to get it. I had the files stored in my local space and my PYTHONPATH was wrong. It seems PYTHONPATH should conta

Re: Inheriting property functions

2006-10-20 Thread Dustan
Robert Kern wrote: > Dustan wrote: > > Looking at this interactive session: > > > class A(object): > > def __init__(self, a): > > self.a = a > > def get_a(self): return self.__a > > def set_a(self, new_a): self.__a = new_a > > a = property(get_a, set_a) > > > > > >

Customize the effect of enumerate()?

2006-10-20 Thread Dustan
Can I make enumerate(myObject) act differently? class A(object): def __getitem__(self, item): if item > 0: return self.sequence[item-1] elif item < 0: return self.sequence[item] elif item == 0:

Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-20 Thread Paul Rubin
greg <[EMAIL PROTECTED]> writes: > Have you seen PyGUI? It's my attempt at creating a GUI toolkit for > Python that doesn't suck. I'd be interested to know if you think > I've come anywhere near to succeeding. > > http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ I hadn't seen it. I just s

Re: Customize the effect of enumerate()?

2006-10-20 Thread Paul Rubin
"Dustan" <[EMAIL PROTECTED]> writes: > Can I make enumerate(myObject) act differently? No. > Why the funny behavior, you ask? For my class A, it doesn't make sense > to number everything the standard programming way. Add an enumerate method to the class then, that does what you want. Maybe dict.

Re: Why can't you pickle instancemethods?

2006-10-20 Thread Steven Bethard
Chris wrote: > Why can pickle serialize references to functions, but not methods? Here's the recipe I use:: def _pickle_method(method): func_name = method.im_func.__name__ obj = method.im_self cls = method.im_class return _unpickle_method, (func_name, obj,

SQLAlchemy and py2exe

2006-10-20 Thread Karlo Lozovina
I've installed SQLAlchemy under Windows (strangely, it didn't install inside ../site-packages/ as a directory, but rather as a SQLAlchemy-0.2.8-py2.4.egg file). I can import it with 'import sqlalchemy' and run my program with WingIDE, SPE and ofcourse in plain old Python shell (ipython actually

Re: Inheriting property functions

2006-10-20 Thread Aahz
In article <[EMAIL PROTECTED]>, Dustan <[EMAIL PROTECTED]> wrote: > class A(object): > def __init__(self, a): > self.a = a > def get_a(self): return self.__a > def set_a(self, new_a): self.__a = new_a > a = property(get_a, set_a) > > class B(A): >

Re: why does this unpacking work

2006-10-20 Thread Paddy
John Salerno wrote: > I'm a little confused, but I'm sure this is something trivial. I'm > confused about why this works: > > >>> t = (('hello', 'goodbye'), > ('more', 'less'), > ('something', 'nothing'), > ('good', 'bad')) > >>> t > (('hello', 'goodbye'), ('more', 'less'), ('so

Re: Webprogr: Link with automatic submit

2006-10-20 Thread Gregor Horvath
Bruno Desthuilliers schrieb: > yes : replace the link with another submit button, then in your > controller check which submit has been successful and take appropriate > action. Thanks ! -- Servus, Gregor -- http://mail.python.org/mailman/listinfo/python-list

Rate my reply

2006-10-20 Thread Paddy
Hi, In answering Johns question I had to approach it from a standpoint of originally not seeing that their could be a difficulty; railing myself in; then re-reading Johns question and trying even harder to put myself in his shoes. What I am interested in is if John and others might just take time o

Re: I like python.

2006-10-20 Thread Fidel
Thank you Jerry. That was exactly what I was looking for. The script in fact does call an external program and give it a command from a randomized list. Specifically it is a random wallpaper setter using the windows version of bsetroot. script scans a directory, creates a list of viable walls and

Re: invert or reverse a string... warning this is a rant

2006-10-20 Thread Steven D'Aprano
On Thu, 19 Oct 2006 20:07:27 -0400, Brad wrote: > Steven D'Aprano wrote: > >> Gah!!! That's *awful* in so many ways. > > Thanks... I'm used to hearing encouragement like that. After a while you > begin to believe that everything you do will be awful, so why even > bother trying? Well obviousl

Re: Looking for assignement operator

2006-10-20 Thread Tommi
Bruno Desthuilliers wrote: > (please don't top-post - corrected) (sorry) > How could it help ? To me they just looked a bit alike: --- op's example --- a = MyInt(10) # Here i need to overwrite the assignement operator a = 12 --- traits' example --- moe = Child() # NOTIFICATION in action moe

Re: invert or reverse a string... warning this is a rant

2006-10-20 Thread Steven D'Aprano
On Thu, 19 Oct 2006 22:22:34 -0300, Gabriel Genellina wrote: >> > (1) The name is bad. "invert" is not the same as "reverse". Here's an >> > invert: 1/2 = 0.5. Your function falsely claims numbers aren't >> > invertable. >> >>Dictionary.com >>invert = to reverse in position, order, direction, or

Re: Using cElementTree and elementtree.ElementInclude

2006-10-20 Thread Fredrik Lundh
Mark wrote: > I have an elementtree created with cElementTree. I then use > ElementInclude to resolve some xinclude elements. But then I want to > move those included elements to be children of the root > > root.append(included_child) > > but I get an error message > > TypeError: 'append() ar

<    1   2   3   >