Re: Things to know about super (was: super() and multiple inheritance failure)

2009-09-27 Thread Dieter Maurer
Michele Simionato writes on Fri, 25 Sep 2009 22:58:32 -0700 (PDT): > ... >You know that in an ideal world I would just > throw > away multiple inheritance, it is just not worth the complication. I am a fan of multiple inheritance: it lets the compliler/language runtime do stupid tasks (implement

Re: Detecting changes to a dict

2009-09-27 Thread CTO
On Sep 28, 1:11 am, Steven D'Aprano wrote: > On Sun, 27 Sep 2009 21:42:10 -0700, CTO wrote: > >> Is there a fast way to see that a dict has been modified? > > ... > > > d = {"a": "b", "c": "d"} > > d2 = d.copy() > > assert d == d2 > > d["e"] = "f" > > assert d == d2 > > > Is this what you're looki

Re: Re: Twisted PB: returning result as soon as ready

2009-09-27 Thread jacopo . pecci
Jean-Paul, thanks a lot for your patient. I have read most of a the “The Twisted Documentation” which I think is very good for Deferred and ok for PB but it is really lacking on the Reactor. In my case it looks like this is key to achieve what I have in mind. I've also just received “Twisted

Re: Why the file mode of .pyc files has x?

2009-09-27 Thread greg
Also, what kind of file system are the files on? Unixes often report the x bit as always being on when the file system doesn't have x bits (e.g. for FAT-based file systems). -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Why the file mode of .pyc files has x?

2009-09-27 Thread greg
Peng Yu wrote: -rw--- 1 pengy lilab 29 2009-09-26 10:10:45 main.py -rwx-- 1 pengy lilab 106 2009-09-26 10:19:17 test.py -rwx-- 1 pengy lilab 339 2009-09-26 10:20:39 test.pyc Doesn't happen for me with 2.5 on Darwin. What python/OS are you using? -- Greg -- http://mail.python.org/

Re: Most "active" coroutine library project?

2009-09-27 Thread greg
Dave Angel wrote: Actually even 64k looked pretty good, compared to the 1.5k of RAM and 2k of PROM for one of my projects, a navigation system for shipboard use. Until you wanted to do hi-res colour graphics, at which point the video memory took up an inconveniently large part of the address s

Re: Detecting changes to a dict

2009-09-27 Thread Steven D'Aprano
On Sun, 27 Sep 2009 21:42:10 -0700, CTO wrote: >> Is there a fast way to see that a dict has been modified? ... > d = {"a": "b", "c": "d"} > d2 = d.copy() > assert d == d2 > d["e"] = "f" > assert d == d2 > > Is this what you're looking for? In general, no. I was hoping for an O(1) check. Yours

Re: Multidimensional arrays/lists

2009-09-27 Thread Simon Forman
On Sun, Sep 27, 2009 at 12:40 PM, Someone Something wrote: > I'm trying to write a little tic-tac-toe program I need a array/list such > that I can represent the tic tac toe board with an x axis and y axis and i > can access each square to find out whether there is an X or an O. I have > absolutel

Re: Detecting changes to a dict

2009-09-27 Thread CTO
On Sep 27, 5:36 am, Steven D'Aprano wrote: > I'm pretty sure the answer to this is No, but I thought I'd ask just in > case... > > Is there a fast way to see that a dict has been modified? I don't care > what the modifications are, I just want to know if it has been changed, > where "changed" mean

Re: UnboundLocalError - (code is short & simple)

2009-09-27 Thread Chris Rebert
On Sun, Sep 27, 2009 at 8:53 PM, pylearner wrote: > --- > > Traceback (most recent call last): >  File "", line 1, in >    toss_winner() >  File "C:/Python26/toss_winner.py", line 7, in toss_winner >    coin_toss = coin_toss() > Unb

Re: UnboundLocalError - (code is short & simple)

2009-09-27 Thread Chris Kaynor
Lets look at what is happening on a few of the lines here: First: from coin_toss import coin_toss imports the module coin_toss and sets the local variable coin_toss to the value of coin_toss in the module coin_toss. Second: coin_toss = coin_toss() calls the function bound to the name coin_toss

Re: Bash shell to Python shell?

2009-09-27 Thread Grant Edwards
On 2009-09-28, Chris Rebert wrote: > On Sun, Sep 27, 2009 at 8:13 PM, edwithad wrote: >> I am sure you have not read a question this basic in some time, but I am >> curious. Using Linux I open a terminal window and type: python. >> >> Does Bash Shell go away and to become a Python Shell, or is it

UnboundLocalError - code is short & simple

2009-09-27 Thread pylearner
System Specs: Python version = 2.6.1 IDLE Computer = Win-XP, SP2 (current with all windows updates) Greetings: I have written code for two things: 1) simulate a coin toss, and 2) assign the toss result to

UnboundLocalError - (code is short & simple)

2009-09-27 Thread pylearner
Python version = 2.6.1 IDLE Computer = Win-XP, SP2 (current with all windows updates) --- Greetings: I have written code for two things: 1) simulate a coin toss, and 2) assign the toss result to a winner. Code for the simulated coin t

Re: Bash shell to Python shell?

2009-09-27 Thread Ned Deily
In article <2009092721134550073-edwit...@hotmailcom>, edwithad wrote: > I am sure you have not read a question this basic in some time, but I > am curious. Using Linux I open a terminal window and type: python. > > Does Bash Shell go away and to become a Python Shell, or is it still a > Bash S

Re: Bash shell to Python shell?

2009-09-27 Thread Chris Rebert
On Sun, Sep 27, 2009 at 8:13 PM, edwithad wrote: > I am sure you have not read a question this basic in some time, but I am > curious. Using Linux I open a terminal window and type: python. > > Does Bash Shell go away and to become a Python Shell, or is it still a Bash > Shell with Python running

Python shared lib

2009-09-27 Thread namekuseijin
So, I was trying to get the yafaray raytracer to work with the 3D package Blender, but it asks for python2.6 and all I got is a 2.5. Actually, quite a lot of other related Blender packages are also migrating to 2.6, so a compilation was inevitable. Then I go: ./configure --prefix=~/ && make &&

Bash shell to Python shell?

2009-09-27 Thread edwithad
I am sure you have not read a question this basic in some time, but I am curious. Using Linux I open a terminal window and type: python. Does Bash Shell go away and to become a Python Shell, or is it still a Bash Shell with Python running inside? Thanks in advance. -- http://mail.python.org/m

Re: is this whiff/wsgi claim true?

2009-09-27 Thread Дамјан Георгиевски
> Hi folks. I just modified the WHIFF concepts index page > > http://aaron.oirt.rutgers.edu/myapp/docs/W1000.concepts > > To include the following paragraph with a startling and arrogant > claim in the final sentence :) mod_wsgi (the apache module) can be configured to automatically run a

Re: Is there a method (similar to str() method in R) that can print the data structure in python?

2009-09-27 Thread John Nagle
Zero Piraeus wrote: : 2009/9/27 Peng Yu : But I want an even simpler solution. I don't want the user to define __pretty__. Is there a tool that can automatically print the content of an object without defining such a member function like __pretty__. Not tested (much): from pprint import ppri

Re: Catch script hangs

2009-09-27 Thread Sean DiZazzo
On Sep 27, 3:40 pm, Bakes wrote: > Due to an ftp server issue, my python script sometimes hangs whilst > downloading, unable to receive any more data. Is there any way that I > could have python check, maybe through a thread or something, whether > it has hanged (or just, if it's still active afte

Re: How to run python script in emacs

2009-09-27 Thread devilkin
On 9月27日, 下午12时43分, Nobody wrote: > On Sat, 26 Sep 2009 08:54:49 -0700, devilkin wrote: > > I'm just starting learning python, and coding in emacs. I usually > > split emacs window into two, coding in one, and run script in the > > other, which is not very convenient. anyone can help me with it? i

Re: Is there a method (similar to str() method in R) that can print the data structure in python?

2009-09-27 Thread Zero Piraeus
: 2009/9/27 Peng Yu : >>> But I want an even simpler solution. I don't want the user to define >>> __pretty__. Is there a tool that can automatically print the content >>> of an object without defining such a member function like __pretty__. Not tested (much): from pprint import pprint def exam

Re: Is there a method (similar to str() method in R) that can print the data structure in python?

2009-09-27 Thread Peng Yu
On Sun, Sep 27, 2009 at 1:20 PM, Simon Forman wrote: > On Sun, Sep 27, 2009 at 12:14 PM, Peng Yu wrote: >> On Sat, Sep 26, 2009 at 2:05 PM, Robert Kern wrote: >>> On 2009-09-26 09:32 AM, Peng Yu wrote: Hi, I am looking for a method in python that is similar to the function >>

Re: itools 0.60.2 released

2009-09-27 Thread David Calman
you mean MobileMe? go back to comp.sys.mac.misc -- From: ""J. David Ibáñez"" Sent: Wednesday, June 03, 2009 1:49 AM Newsgroups: comp.lang.python.announce To: Subject: itools 0.60.2 released itools 0.60.2 (2009/06/03) ==

Re: Catch script hangs

2009-09-27 Thread exarkun
On 10:40 pm, ba...@ymail.com wrote: Due to an ftp server issue, my python script sometimes hangs whilst downloading, unable to receive any more data. Is there any way that I could have python check, maybe through a thread or something, whether it has hanged (or just, if it's still active after 10

Catch script hangs

2009-09-27 Thread Bakes
Due to an ftp server issue, my python script sometimes hangs whilst downloading, unable to receive any more data. Is there any way that I could have python check, maybe through a thread or something, whether it has hanged (or just, if it's still active after 10 seconds, stop it?). I have looked at

Re: Multidimensional arrays/lists

2009-09-27 Thread Rhodri James
On Sun, 27 Sep 2009 17:40:57 +0100, Someone Something wrote: I'm trying to write a little tic-tac-toe program I need a array/list such that I can represent the tic tac toe board with an x axis and y axis and i can access each square to find out whether there is an X or an O. I have absolut

Re: Multidimensional arrays/lists

2009-09-27 Thread Gary Herron
Someone Something wrote: I'm trying to write a little tic-tac-toe program I need a array/list such that I can represent the tic tac toe board with an x axis and y axis and i can access each square to find out whether there is an X or an O. I have absolutely no idea how to do this in python and

Multidimensional arrays/lists

2009-09-27 Thread Someone Something
I'm trying to write a little tic-tac-toe program I need a array/list such that I can represent the tic tac toe board with an x axis and y axis and i can access each square to find out whether there is an X or an O. I have absolutely no idea how to do this in python and I really, really, don't want

Re: user authorization (with one time login) in a Python desktop application ?

2009-09-27 Thread Stef Mientki
Tim Golden wrote: Steven D'Aprano wrote: On Sun, 27 Sep 2009 16:11:52 +0200, Stef Mientki wrote: I've a Python desktop application, running under Widows, that stores the data in a central SQLite database. Depending on the user login on the system, some of the data from the database is allowe

Re: unexplainable python

2009-09-27 Thread Terry Reedy
dads wrote: Thank you for the help, it's amazing what you can't spot. It seems the harder you look the less likely you're to find the issue. Fresh eyes make the world of difference. To Matt and John: No this certainly isn't homework, I'm 29 and in full time work. I decided to learn to program a

Re: Is there a method (similar to str() method in R) that can print the data structure in python?

2009-09-27 Thread Simon Forman
On Sun, Sep 27, 2009 at 12:14 PM, Peng Yu wrote: > On Sat, Sep 26, 2009 at 2:05 PM, Robert Kern wrote: >> On 2009-09-26 09:32 AM, Peng Yu wrote: >>> >>> Hi, >>> >>> I am looking for a method in python that is similar to the function >>> str() in R, if you are familiar with R, >>> >>> If you have

ANN: SIP v4.9 Released (Python Bindings Generator)

2009-09-27 Thread Phil Thompson
SIP v4.9 has been released and can be downloaded from http://www.riverbankcomputing.com/software/sip/. SIP is a tool for generating Python modules that wrap C or C++ libraries. It is similar to SWIG. It is used to generate PyQt and PyKDE. The SIP license is similar to the Python License and is a

ANN: PyQt v4.6 Released

2009-09-27 Thread Phil Thompson
PyQt v4.6 has been released and is available from http://www.riverbankcomputing.com/software/pyqt/. PyQt is a comprehensive set of bindings for the Qt application and UI framework from Nokia. It supports the same platforms as Qt (Windows, Linux and MacOS/X). PyQt supports Python v3 and Python v2

Re: user authorization (with one time login) in a Python desktop application ?

2009-09-27 Thread Martin P. Hellwig
Stef Mientki wrote: What you want is pretty hard as long as the data source is not centrally protected with a password. That is you have a database on a server you only access, there is a central db but access to it is restricted to the admin, everybody else has a unique login name and a 'per

Re: user authorization (with one time login) in a Python desktop application ?

2009-09-27 Thread Tim Golden
Tim Golden wrote: Steven D'Aprano wrote: [... snip further stuff from Stephen whose name I can't even copy from three lines above :) Sorry, Steven. TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a method (similar to str() method in R) that can print the data structure in python?

2009-09-27 Thread Peng Yu
On Sat, Sep 26, 2009 at 2:05 PM, Robert Kern wrote: > On 2009-09-26 09:32 AM, Peng Yu wrote: >> >> Hi, >> >> I am looking for a method in python that is similar to the function >> str() in R, if you are familiar with R, >> >> If you have no idea of R, what I want is to print the class >> informati

Re: user authorization (with one time login) in a Python desktop application ?

2009-09-27 Thread Tim Golden
Steven D'Aprano wrote: On Sun, 27 Sep 2009 16:11:52 +0200, Stef Mientki wrote: I've a Python desktop application, running under Widows, that stores the data in a central SQLite database. Depending on the user login on the system, some of the data from the database is allowed and other data is

Re: Business issues regarding adapting Python

2009-09-27 Thread Martin P. Hellwig
Nash wrote: If I rephrase the question: In an absense of steady Python Developers; can there be a viable strategy involving training? Or will it be much safer going with an already common developer pool. Please note that my goal is not to promote python but to make a sound business decision. Us

Re: pep370 python 2.6?

2009-09-27 Thread Christian Heimes
Neal Becker wrote: > Is pep370 (per-user site-packages) available on 2.6? Yes -- http://mail.python.org/mailman/listinfo/python-list

Re: user authorization (with one time login) in a Python desktop application ?

2009-09-27 Thread geremy condra
On Sun, Sep 27, 2009 at 11:42 AM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > On Sun, 27 Sep 2009 16:11:52 +0200, Stef Mientki wrote: > > > hello, > > > > I've a Python desktop application, running under Widows, that stores the > > data in a central SQLite database. > > > > De

Re: Detecting changes to a dict

2009-09-27 Thread geremy condra
On Sun, Sep 27, 2009 at 5:36 AM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > I'm pretty sure the answer to this is No, but I thought I'd ask just in > case... > > Is there a fast way to see that a dict has been modified? I don't care > what the modifications are, I just want t

Re: What does the list_folders() method of mailbox.Maildir actually ?do (if anything)?

2009-09-27 Thread tinnews
Tim Roberts wrote: > tinn...@isbd.co.uk wrote: > > > >My maildir hierarchy is created by mutt which is a *very* standards > >compliant MUA, surely standard python libraries should work with > >standard maildirs not some wierd extension thereof. > > The Maildir specification does not allow for sub

Re: user authorization (with one time login) in a Python desktop application ?

2009-09-27 Thread Steven D'Aprano
On Sun, 27 Sep 2009 16:11:52 +0200, Stef Mientki wrote: > hello, > > I've a Python desktop application, running under Widows, that stores the > data in a central SQLite database. > > Depending on the user login on the system, some of the data from the > database is allowed and other data is forb

Re: Detecting changes to a dict

2009-09-27 Thread Simon Forman
On Sun, Sep 27, 2009 at 5:36 AM, Steven D'Aprano wrote: > I'm pretty sure the answer to this is No, but I thought I'd ask just in > case... > > Is there a fast way to see that a dict has been modified? I don't care > what the modifications are, I just want to know if it has been changed, > where "

Re: unexplainable python

2009-09-27 Thread D'Arcy J.M. Cain
On Sat, 26 Sep 2009 23:31:25 -0700 John Nagle wrote: > dads wrote: > > Sorry forgot to mention I'm using python 2.6 > > This looks like a homework assignment. So what? He supplied code and showed what he tried so far didn't he? I suppose he could have said that it was homework but maybe it

Re: Business issues regarding adapting Python

2009-09-27 Thread Duncan Booth
Nash wrote: > If I rephrase the question: In an absense of steady Python Developers; > can there be a viable strategy involving training? Or will it be much > safer going with an already common developer pool. My experience has been that: a) Python developers come from the better end of the pro

Re: Business issues regarding adapting Python

2009-09-27 Thread Krishnakant
On Sun, 2009-09-27 at 10:57 -0400, Simon Forman wrote: > On Sun, Sep 27, 2009 at 10:48 AM, Nash wrote: > > On Sep 27, 4:13 pm, "Martin P. Hellwig" > > wrote: > >> Nash wrote: > >> > >> > >> I think normal market rules will apply to Pakistan too, if your desired > >> trade has not the quantity yo

Re: Business issues regarding adapting Python

2009-09-27 Thread Simon Forman
On Sun, Sep 27, 2009 at 10:48 AM, Nash wrote: > On Sep 27, 4:13 pm, "Martin P. Hellwig" > wrote: >> Nash wrote: >> >> >> I think normal market rules will apply to Pakistan too, if your desired >> trade has not the quantity you wish, the price per item should get >> higher. Net result should be t

Re: Business issues regarding adapting Python

2009-09-27 Thread Nash
On Sep 27, 4:13 pm, "Martin P. Hellwig" wrote: > Nash wrote: > > > I think normal market rules will apply to Pakistan too, if your desired > trade has not the quantity you wish, the price per item should get > higher. Net result should be that more quantity will be available due to > increased in

Re: unicode text file

2009-09-27 Thread Mark Tolonen
"Junaid" wrote in message news:0267bef9-9548-4c43-bcdf-b624350c8...@p23g2000vbl.googlegroups.com... I want to do replacements in a utf-8 text file. example f=open("test.txt","r") #this file is uft-8 encoded raw = f.read() txt = raw.decode("utf-8") You can use the codecs module to open and d

Re: unicode text file

2009-09-27 Thread MRAB
Junaid wrote: I want to do replacements in a utf-8 text file. example f=open("test.txt","r") #this file is uft-8 encoded raw = f.read() txt = raw.decode("utf-8") txt.replace{'English', ur'ഇംഗ്ലീഷ്') #replacing raw unicode string, but not working txt = txt.replace{'English', ur'ഇംഗ്ലീഷ്') f

user authorization (with one time login) in a Python desktop application ?

2009-09-27 Thread Stef Mientki
hello, I've a Python desktop application, running under Widows, that stores the data in a central SQLite database. Depending on the user login on the system, some of the data from the database is allowed and other data is forbidden. I can read the current logged in user. The authorization f

pep370 python 2.6?

2009-09-27 Thread Neal Becker
Is pep370 (per-user site-packages) available on 2.6? -- http://mail.python.org/mailman/listinfo/python-list

Re: Doubley imported module caused devastating bug

2009-09-27 Thread Francis Carr
> I would like to propose that it be made impossible in the Python > source to import two instances of the same module. A fully-automatic solution is more difficult than it might seem at first: http://www.python.org/dev/peps/pep-0328/ But there is a simple code-discipline solution: never ever us

Re: unicode text file

2009-09-27 Thread Vlastimil Brom
2009/9/27 Junaid : > I want to do replacements in a utf-8 text file. example > > f=open("test.txt","r") #this file is uft-8 encoded > > raw = f.read() > txt = raw.decode("utf-8") > > txt.replace{'English', ur'ഇംഗ്ലീഷ്') #replacing raw unicode string, > but not working > > f.write(txt) > f.close() >

Re: unexplainable python

2009-09-27 Thread dads
Thank you for the help, it's amazing what you can't spot. It seems the harder you look the less likely you're to find the issue. Fresh eyes make the world of difference. To Matt and John: No this certainly isn't homework, I'm 29 and in full time work. I decided to learn to program about a year ag

unicode text file

2009-09-27 Thread Junaid
I want to do replacements in a utf-8 text file. example f=open("test.txt","r") #this file is uft-8 encoded raw = f.read() txt = raw.decode("utf-8") txt.replace{'English', ur'ഇംഗ്ലീഷ്') #replacing raw unicode string, but not working f.write(txt) f.close() f.flush() please, help me thanks --

Re: Most "active" coroutine library project?

2009-09-27 Thread Piet van Oostrum
> Grant Edwards (GE) wrote: >GE> On 2009-09-25, Piet van Oostrum wrote: exar...@twistedmatrix.com (e) wrote: >>> >e> I specifically left out all "yield" statements in my version, since that's >e> exactly the point here. :) With "real" coroutines, they're not necessary - >e> corout

Re: removing a post

2009-09-27 Thread Sjoerd Mullender
You need to put this request to postmas...@python.org. As mailing list administrator I have no access to the archives. On 2009-09-26 05:32, Mike L wrote: hello could you remove this old post, off topic and spam http://www.mail-archive.com/python-list@python.org/msg175722.html thank you

Detecting changes to a dict

2009-09-27 Thread Steven D'Aprano
I'm pretty sure the answer to this is No, but I thought I'd ask just in case... Is there a fast way to see that a dict has been modified? I don't care what the modifications are, I just want to know if it has been changed, where "changed" means a key has been added, or deleted, or a value has

Unable to create scrollable editor window using curses

2009-09-27 Thread Andy Elvey
Hi all - I've been trying to create a simple text editor using the curses module. Doing the basic editor functionality is easy enough (thanks to the built-in textpad library), but I'm having real problems getting the text to scroll up when the bottom of the page is reached. When the user is o

Re: Business issues regarding adapting Python

2009-09-27 Thread Krishnakant
On Sun, 2009-09-27 at 00:13 -0700, Nash wrote: > Hello everyone, > Salam Valicum. I am Krishnakant from Mumbai India and in our country case was exactly the same but now pritty different in just a matter of few years. I have answered your queries inline with your questions so read on. > I'm a big

Re: Got undefined symbol: _PyUnicodeUCS2_AsDefaultEncodedString on OpenSuSE 11.1

2009-09-27 Thread Mark Dickinson
On Sep 25, 10:13 pm, Alejandro Valdez wrote: > The compiler issued some warnings, two of them (related to Unicode) > called my attention: > > In file included from Python/formatter_unicode.c:13: > Python/../Objects/stringlib/formatter.h: In function > ‘unknown_presentation_type’: > Python/../

Re: Business issues regarding adapting Python

2009-09-27 Thread Gregor Horvath
Hi, Am Sun, 27 Sep 2009 00:13:47 -0700 (PDT) schrieb Nash : > I'm a big time python fan and it has helped me write code fast and > push it out quickly. We have a medium sized telecom product written > 90% in Python and 10% in Java. The problem is, in the place where we > work (Pakistan), we can't

Re: Business issues regarding adapting Python

2009-09-27 Thread Roger Binns
Nash wrote: > 3. If we do train people in Python for say a month; are we just > creating a team of mediocre programmers? Someone who has worked with > Python for over an year is much different than someone who has worked > with Python for only a month. In my experience the best way to "train" new

Re: unexplainable python

2009-09-27 Thread Matt Joiner
Yes the needless use of classes further supports that theory. On Sun, Sep 27, 2009 at 4:31 PM, John Nagle wrote: > dads wrote: >> >> Sorry forgot to mention I'm using python 2.6 > >   This looks like a homework assignment. > >                                John Nagle > -- > http://mail.python.or

Business issues regarding adapting Python

2009-09-27 Thread Nash
Hello everyone, I'm a big time python fan and it has helped me write code fast and push it out quickly. We have a medium sized telecom product written 90% in Python and 10% in Java. The problem is, in the place where we work (Pakistan), we can't find Python developers. I asked HR to send me figure