Re: python-2.5.2 src rpm

2008-03-10 Thread Martin v. Löwis
> I am trying to install python 2.5.2 onto enterprise linux, and would > like to start with a source rpm package so that I can build the > package locally and make sure I have all necessary dependencies. > > I have been unable to locate a source rpm package for python 2.5.2 or > any version of 2.5

Re: BitVector

2008-03-10 Thread John Machin
On Mar 10, 3:26 pm, DanielJohnson <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to solve a genetic algorithm problem where I want to read > a bitvector of very large size (say 1) and manipulate bits based > on certain algorithms. > > I am a newbie in Python. What data structure are good to r

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread Matt Nordhoff
Paddy wrote: > After profiling their may be other ways to remove a bottleneck, such > as > using existing highly-optimised libraries such as Numpy; Psycho, an > optimising interpreter that can approach C type speeds for Python > code; > and you could create your own C++ based libraries. > > You mi

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread Stefan Behnel
Matt Nordhoff wrote: > For what you do decide to rewrite in C, you can also use a language like > Cython [1] (which is a fork of Pyrex [2]). It looks mostly like Python, > and is translated to C without you having to write all of the > boilerplate Python C API stuff. Of course, not quite as efficie

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread Matt Nordhoff
Stefan Behnel wrote: > And if you really need the efficiency of "well-tuned raw C", it's one function > call away in your Cython code. What do you mean by that? I know nothing about how Cython compares to C in performance, so I said "well-tuned" because it must be possible to write C that is fast

Re: __iter__ yield

2008-03-10 Thread Paul Hankin
On Mar 10, 3:12 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Mar 9, 7:37 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: > > > > > On Mar 9, 8:58 pm, duccio <[EMAIL PROTECTED]> wrote: > > > > Someone knows if it's possible to make this __iter__ function with just > > > one 'yield' intead of two? >

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread Stefan Behnel
Matt Nordhoff wrote: > Stefan Behnel wrote: >> And if you really need the efficiency of "well-tuned raw C", it's one >> function >> call away in your Cython code. > > What do you mean by that? > > I know nothing about how Cython compares to C in performance, so I said > "well-tuned" because it m

Re: unable to install gdal

2008-03-10 Thread luis
On 9 mar, 16:37, luis <[EMAIL PROTECTED]> wrote: > Hi > > On Windows xp sp2 and python 2.4 > > Yesterday I running old versions of gdal, and I try to upgrade > > I download gdalwin32exe150.zip and gdal-python-13.win32-py2.4.exe > I unzip gdalwin32exe150.zip in C:\gdalwin32-1.5 > > I follow install'

Re: Adjust a canvas as the window is resized

2008-03-10 Thread Peter Otten
K Viltersten wrote: > Do i need to set a callback to a canvas > in order to "listen" to the root window > being resized in order to make it adjust > its contents? > > If so, how? If not, how do i make the > canvas draw a line from one corner to > an other? import Tkinter as tk root = tk.Tk() ca

is operator

2008-03-10 Thread Metal Zong
The operator is and is not test for object identity: x is y is true if and only if x and y are the same objects. >>> x = 1 >>> y = 1 >>> x is y True Is this right? Why? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

How to create Python object in C/C++ extension by class name?

2008-03-10 Thread Neil.Fang.CN
Hello I'm trying to write a C++ extension like this: //--- // C++ code class ActorBase {...}; // export ActorBase to Python as a new type class ActorManager { void addNewActor(const char* actorClassName) { ? }

removing escape character

2008-03-10 Thread diljeet kaur
hi i am working on pyqt environment when i write to file, i get some unwanted characters like "ESC" in file how to get rid of these characters? - Looking for last minute shopping deals? Find them fast with Yahoo! Search.-- http://mail.python.org/mail

Re: How to create Python object in C/C++ extension by class name?

2008-03-10 Thread Stefan Behnel
Neil.Fang.CN wrote: > I'm trying to write a C++ extension like this: > > //--- > // C++ code > class ActorBase > {...}; > > // export ActorBase to Python as a new type > > class ActorManager > { > void addNewActor(const char*

Re: is operator

2008-03-10 Thread Matt Nordhoff
Metal Zong wrote: > The operator is and is not test for object identity: x is y is true if > and only if x and y are the same objects. > x = 1 y = 1 x is y > True > > Is this right? Why? Thanks. I believe Python automatically creates and caches int objects for 0-256, so whenever y

Re: is operator

2008-03-10 Thread castironpi
> I believe Python automatically creates and caches int objects for 0-256, > so whenever you use them, they refer to the same exact objects. Since > ints are immutable, it doesn't matter. One of the biggest hits on start-up time, by the way. ;) -- http://mail.python.org/mailman/listinfo/python-l

Re: is operator

2008-03-10 Thread Matt Nordhoff
[EMAIL PROTECTED] wrote: >> I believe Python automatically creates and caches int objects for 0-256, >> so whenever you use them, they refer to the same exact objects. Since >> ints are immutable, it doesn't matter. > > One of the biggest hits on start-up time, by the way. ;) Well, the developer

Re: Intelligent Date & Time parsing

2008-03-10 Thread Eddie Corns
[EMAIL PROTECTED] writes: >I'm new to python and I was wondering if there are any intelligent >date/time parsing modules out there. I've looked at strptime (or >whichever it is) and mxDateTime from the eGenix package. I need >something to parse user input for a django app, and it's awesome to be >

Logging Date/Time Format

2008-03-10 Thread Robert Rawlins
Hello Guys, I'm using the python logging module, however I'm not happy with the current date/time format which is used to write the timestamp into the log file. I need the logger to write the stamp without the milliseconds appended too it. This is because I use a 3rd party application to parse

Re: is operator

2008-03-10 Thread John Machin
On Mar 10, 9:11 pm, Matt Nordhoff <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >> I believe Python automatically creates and caches int objects for 0-256, > >> so whenever you use them, they refer to the same exact objects. Since > >> ints are immutable, it doesn't matter. > > > One of t

Edit and continue?

2008-03-10 Thread Bronner, Gregory
I haven't seen much on this for a few years: I'm working on a GUI application that has lots of callbacks. Testing it is very slow and quite boring, as every time I find an error, I have to exit it, restart it, and repeat the series of clicks. It would be really amazing if python supported a reason

RE: Edit and continue?

2008-03-10 Thread Ryan Ginstrom
> On Behalf Of Bronner, Gregory > I'm working on a GUI application that has lots of callbacks. > Testing it is very slow and quite boring, as every time I > find an error, I have to exit it, restart it, and repeat the > series of clicks. It would be really amazing if python > supported a reason

Problem with zipfile and newlines

2008-03-10 Thread Neil Crighton
I'm using the zipfile library to read a zip file in Windows, and it seems to be adding too many newlines to extracted files. I've found that for extracted text-encoded files, removing all instances of '\r' in the extracted file seems to fix the problem, but I can't find an easy solution for binary

Hyphenation with PyHyphen - public mailing list <[EMAIL PROTECTED]> now online

2008-03-10 Thread [EMAIL PROTECTED]
Hi, there is now a public mailing list open to anyone who is interested in discussing issues concerning PyHyphen. Join the list at http://groups.google.com/group/pyhyphen, or visit the project home page at http://pyhyphen.googlecode.com to get the latest sources via Subversion. Regards Leo --

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread castironpi
> >> And if you really need the efficiency of "well-tuned raw C", it's one > >> function > >> call away in your Cython code. > > > What do you mean by that? > > > I know nothing about how Cython compares to C in performance, so I said > > "well-tuned" because it must be possible to write C that is

Re: Checking if a variable is a dictionary

2008-03-10 Thread Bruno Desthuilliers
Guillermo a écrit : > Mamma mia! My head just exploded. I've seen the light. > > So you only need to ·want· to have a protocol? That's amazing... Far > beyond the claim that Python is easy. You define protocols in writing > basically! Even my grandma could have her own Python protocol. > > Okay,

Re: An important message to all jobseekers ,and internet users

2008-03-10 Thread ditto007
http://swingwind.com more high quality placement papers at swingwind.com from 2008 http://swingwind.com/category/tag/placement-papers all IT company placement papers 2008 here -- View this message in context: http://www.nabble.com/An-important-message-to-all-jobseekers-%2Cand-internet-us

Re: Problem with zipfile and newlines

2008-03-10 Thread John Machin
On Mar 10, 8:31 pm, "Neil Crighton" <[EMAIL PROTECTED]> wrote: > I'm using the zipfile library to read a zip file in Windows, and it > seems to be adding too many newlines to extracted files. I've found > that for extracted text-encoded files, removing all instances of '\r' > in the extracted file

SQLObject 0.9.5

2008-03-10 Thread Oleg Broytmann
Hello! I'm pleased to announce the 0.9.5, a minor bug fix release of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread Diez B. Roggisch
Roopan wrote: > Hello! > > I am looking at developing an enterprise-grade distributed data > sharing application - key requirements are productivity and platform > portability. > > Will it be sensible to use C++ for performance-critical sections and > Python for all the glue logic. > > Pls comm

Re: Problem with zipfile and newlines

2008-03-10 Thread Duncan Booth
"Neil Crighton" <[EMAIL PROTECTED]> wrote: > I'm using the zipfile library to read a zip file in Windows, and it > seems to be adding too many newlines to extracted files. I've found > that for extracted text-encoded files, removing all instances of '\r' > in the extracted file seems to fix the pr

logging problem

2008-03-10 Thread Abel Ferreira
Hi. I have a problem with python. I dont wanna bother you, but it's seem you had the same error. Did you get solve this problem? I know it's old, but if you remember, tell me. i'm using python's logging facilities in all of my application modules. > my logging.conf file is: > [loggers] > keys=

24 Hour Coding Contest AT BITS-Pilani in Association with Google

2008-03-10 Thread vinod ramachandran
24 HOURS - NATIONWIDE ONLINE ALGORITHM INTENSIVE PROGRAAMING CHALLENGE Are you ready to tickle your grey cells with mind boggling algorithm intensive programming challenge that offers you freedom of programming in around 5 languages?? If yes, Watch out for 24 HOURS, the Nation wide Algorithm Inte

Quality assurance in Python projects containing C modules

2008-03-10 Thread NoelByron
Hello! We are thinking about writing a project for several customers in Python. This project would include (among others) wxPython, a C/C++ module. But what happens if this application generates a segmentation fault on a customers PC. What changes do we have to trace back the source of the error?

parsing directory for certain filetypes

2008-03-10 Thread royG
hi i wrote a function to parse a given directory and make a sorted list of files with .txt,.doc extensions .it works,but i want to know if it is too bloated..can this be rewritten in more efficient manner? here it is... from string import split from os.path import isdir,join,normpath from os imp

Python To C Module Generator Stand-Alone Executable

2008-03-10 Thread Blubaugh, David A.
Does anybody know if the Python To C Module Generator is of any value? Has anyone found or developed a means to convert python source code into c source code, where an algorithm that has been developed in python, can now be converted to C in order to develop a stand alone application? Thanks, Dav

Re: Quality assurance in Python projects containing C modules

2008-03-10 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > Hello! > > We are thinking about writing a project for several customers in > Python. This project would include (among others) wxPython, a C/C++ > module. But what happens if this application generates a segmentation > fault on a customers PC. What changes do we have t

Re: parsing directory for certain filetypes

2008-03-10 Thread sam
royG napisał(a): > i wrote a function to parse a given directory and make a sorted list > of files with .txt,.doc extensions .it works,but i want to know if it > is too bloated..can this be rewritten in more efficient manner? > Probably this should be rewriten and should be very compact. Maybe

Recipies of South INDIA

2008-03-10 Thread Santhosh
If you want to know how to make delicious South Indian foods please visit http://recipesoftamilnadu.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: parsing directory for certain filetypes

2008-03-10 Thread jay graves
On Mar 10, 8:57 am, royG <[EMAIL PROTECTED]> wrote: > i wrote a function to parse a given directory and make a sorted list > of files with .txt,.doc extensions .it works,but i want to know if it > is too bloated..can this be rewritten in more efficient manner? Try the 'glob' module. ... Jay --

Re: parsing directory for certain filetypes

2008-03-10 Thread Robert Bossy
royG wrote: > hi > i wrote a function to parse a given directory and make a sorted list > of files with .txt,.doc extensions .it works,but i want to know if it > is too bloated..can this be rewritten in more efficient manner? > > here it is... > > from string import split > from os.path import isd

Re: Checking if a variable is a dictionary

2008-03-10 Thread Andrew Koenig
>> if type(a) is dict: >> print "a is a dictionnary!" > class MyDict(dict): > pass > a = MyDict() > type(a) is dict > => False isinstance(a, dict) => True So the question you need to answer is whether you want to determine whether an object is exactly of type dict, or whether it you a

Re: Writing Memory to File

2008-03-10 Thread Nick Craig-Wood
Stefan Wagner <[EMAIL PROTECTED]> wrote: > I'm trying to do some memory analyzing stuff, i wrote me a small .c so > far to dump the memory to a file for later analysis, > the analyzing part itself is python code. > I wonder if any of you has an idea how to dump the whole memory in > Linux/Wind

Re: is operator

2008-03-10 Thread Gary Herron
Metal Zong wrote: > > The operator is and is not test for object identity: x is y is true if > and only if x and y are the same objects. > > > > >>> x = 1 > > >>> y = 1 > > >>> x is y > > True > > > > Is this right? Why? Thanks. > > > Yes that is true, but it's an implementation defined opti

Re: Python-URL! - weekly Python news and links (Feb 18)

2008-03-10 Thread Piet van Oostrum
> Peter Otten <[EMAIL PROTECTED]> (PO) wrote: >PO> Piet van Oostrum wrote: "Gabriel Genellina" <[EMAIL PROTECTED]> (GG) wrote: >>> >GG> "Given this indispensable process and architecture issue, isn't it obvious GG> that it's totally irrelevant to the system's overall safety

Re: Intelligent Date & Time parsing

2008-03-10 Thread rockingred
On Mar 7, 5:26 pm, [EMAIL PROTECTED] wrote: > On Mar 7, 4:22 pm, [EMAIL PROTECTED] wrote: > [snip]> Although if I end up writing my own I'll sure use > > datetime.parser.parse to get everything left over once you remove > > I mean dateutil.parser.parse. Tomorrow I'll have to leave off the last > Lu

Re: for-else

2008-03-10 Thread Carl Banks
On Mar 8, 5:15 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > I gave a clear and coherent explanation of how while derives from if, > and correspondingly, how while-else derives from if-else, to help those who > want to read and write Python code. Building on the pseudo-snippet above, > one can wr

Re: parsing directory for certain filetypes

2008-03-10 Thread sam
Robert Bossy napisał(a): > I leave you the exercice to add .doc files. But I must say (whoever's > listening) that I was a bit disappointed that glob('*.{txt,doc}') didn't > work. "{" and "}" are bash invention and not POSIX standard unfortunately -- UFO Occupation www.totalizm.org -- http:/

Re: parsing directory for certain filetypes

2008-03-10 Thread jay graves
On Mar 10, 9:28 am, Robert Bossy <[EMAIL PROTECTED]> wrote: > Personally, I'd use glob.glob: > > import os.path > import glob > > def parsefolder(folder): > path = os.path.normpath(os.path.join(folder, '*.py')) > lst = [ fn for fn in glob.glob(path) ] > lst.sort() > return lst > Wh

Re: for-else

2008-03-10 Thread rockingred
On Mar 8, 4:15 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "egbert" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | However the loop-else really works more like this: > | .  try to do the loop; > | .  if it starts but is interrupted by a break, > | .  then do something else a

Re: parsing directory for certain filetypes

2008-03-10 Thread Tim Chase
> i wrote a function to parse a given directory and make a sorted list > of files with .txt,.doc extensions .it works,but i want to know if it > is too bloated..can this be rewritten in more efficient manner? > > here it is... > > from string import split > from os.path import isdir,join,normpat

adding Tcl support to an existing install of Python

2008-03-10 Thread John Vines (CISD/HPCD)
All, I need to add Tkinter support, build Tcl/Tk, to an existing RHEL5 python 2.5.1 installation. I know this can be done but I can't remember how :) Can someone lend some help in this area? Thanks in advance, John -- http://mail.python.org/mailman/listinfo/python-list

Re: parsing directory for certain filetypes

2008-03-10 Thread Robert Bossy
jay graves wrote: > On Mar 10, 9:28 am, Robert Bossy <[EMAIL PROTECTED]> wrote: > >> Personally, I'd use glob.glob: >> >> import os.path >> import glob >> >> def parsefolder(folder): >> path = os.path.normpath(os.path.join(folder, '*.py')) >> lst = [ fn for fn in glob.glob(path) ] >>

Re: Quality assurance in Python projects containing C modules

2008-03-10 Thread Stefan Behnel
Duncan Booth wrote: > [EMAIL PROTECTED] wrote: >> We are thinking about writing a project for several customers in >> Python. This project would include (among others) wxPython, a C/C++ >> module. But what happens if this application generates a segmentation >> fault on a customers PC. What changes

Re: Regarding coding style

2008-03-10 Thread rockingred
On Mar 8, 8:27 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: > //    Copyright (C) 2008 Foobar Computer Consulting > // > //    VERSION   PROJECT#     DATE     DESCRIPTION > //    ---       -- > //      1.00     123456    01/04/08   Original creation. > // > > Elev

Re: Converting a string to the most probable type

2008-03-10 Thread rockingred
On Mar 7, 6:12 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Mar 8, 1:53 am, "[EMAIL PROTECTED]" > > > > > > <[EMAIL PROTECTED]> wrote: > > On Mar 6, 9:17 pm, Luis M. González <[EMAIL PROTECTED]> wrote: > > > > On 6 mar, 11:27, Pierre Quentel <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > I w

wxPython/wxWidgets ok for production use ? (was Re: Quality assurance in Python projects containing C modules)

2008-03-10 Thread Malcolm Greene
Stefan, > My personal experience with wxPython has its ups and downs. Specifically when > it comes to crashes, I wouldn't bet my life on it. (but then, the OP I'm new to Python and getting ready to build a small client based application intended to run on Windows and Linux. I was planning on usi

Re: is operator

2008-03-10 Thread Carl Banks
On Mar 10, 10:39 am, Gary Herron <[EMAIL PROTECTED]> wrote: > Metal Zong wrote: > > > The operator is and is not test for object identity: x is y is true if > > and only if x and y are the same objects. > > > >>> x = 1 > > > >>> y = 1 > > > >>> x is y > > > True > > > Is this right? Why? Thanks. >

Re: Regarding coding style

2008-03-10 Thread Roel Schroeven
rockingred schreef: > On Mar 8, 8:27 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: >> //Copyright (C) 2008 Foobar Computer Consulting >> // >> //VERSION PROJECT# DATE DESCRIPTION >> //--- -- >> // 1.00 12345601/04/08 Origi

Re: float / rounding question

2008-03-10 Thread Piet van Oostrum
> Dennis Lee Bieber <[EMAIL PROTECTED]> (DLB) wrote: >DLB> On Fri, 07 Mar 2008 23:12:27 +0100, Piet van Oostrum <[EMAIL PROTECTED]> >DLB> declaimed the following in comp.lang.python: >>> Sorry to come in so late in this discussion. Although it is correct to say >>> that many real numbers tha

Re: Regarding coding style

2008-03-10 Thread rockingred
On Mar 10, 10:26 am, Roel Schroeven <[EMAIL PROTECTED]> wrote: > rockingred schreef: > > > > > > > On Mar 8, 8:27 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: > >> //    Copyright (C) 2008 Foobar Computer Consulting > >> // > >> //    VERSION   PROJECT#     DATE     DESCRIPTION > >> //    ---   --

Re: wxPython/wxWidgets ok for production use ? (was Re: Quality assurance in Python projects containing C modules)

2008-03-10 Thread Mike Driscoll
On Mar 10, 10:27 am, "Malcolm Greene" <[EMAIL PROTECTED]> wrote: > Stefan, > > > My personal experience with wxPython has its ups and downs. Specifically > > when it comes to crashes, I wouldn't bet my life on it. (but then, the OP > > I'm new to Python and getting ready to build a small client ba

defining a method that could be used as instance or static method

2008-03-10 Thread Sam
Hello I would like to implement some kind of comparator, that could be called as instance method, or static method. Here is a trivial pseudo code of what I would like to execute >> class MyClass: ...def __init__(self, value): ...self.value = value ...def comp(self, compValue): ...

Re: Python-URL! - weekly Python news and links (Feb 18)

2008-03-10 Thread Fuzzyman
On Mar 10, 2:33 pm, Piet van Oostrum <[EMAIL PROTECTED]> wrote: > > Peter Otten <[EMAIL PROTECTED]> (PO) wrote: > >PO> Piet van Oostrum wrote: > "Gabriel Genellina" <[EMAIL PROTECTED]> (GG) wrote: > > >GG> "Given this indispensable process and architecture issue, isn't it > obviou

Re: tcp client socket bind problem

2008-03-10 Thread Marc Christiansen
[EMAIL PROTECTED] wrote: > I have a linux box with multiple ip addresses. I want to make my > python client connect from one of the ip addresses. Here is my code, > no matter what valid information I put in the bind it always comes > from the default ip address on the server. Am I doing something w

Re: List as FIFO in for loop

2008-03-10 Thread rockingred
On Mar 8, 5:37 pm, malkarouri <[EMAIL PROTECTED]> wrote: > On Mar 8, 6:24 pm, rockingred <[EMAIL PROTECTED]> wrote: > > > I think it's a bad practice to get into.  Did you intend to do the > > "process" step again over the added variables?  If not I would set a > > new variable, based on your awful

Re: defining a method that could be used as instance or static method

2008-03-10 Thread Diez B. Roggisch
Sam wrote: > Hello > > I would like to implement some kind of comparator, that could be > called as instance method, or static method. Here is a trivial pseudo > code of what I would like to execute > >>> class MyClass: > ...def __init__(self, value): > ...self.value = value > ...

Re: for-else

2008-03-10 Thread Jeffrey Barish
egbert wrote: > The idea of the if-else is: > .  depending on some condition either do this or do something else, > .  don't do them both. Indubitably, this statement is correct for other programming languages. I was initially surprised by loop-else when learning Python because I approached thes

BitVector read-from-file Question

2008-03-10 Thread Michael Wieher
I'm trying to read in data from large binary files using BitVector (thanks btw, for whoever mentioned it on the list, its nice) I'll be reading the data in as requested by the user, in (relatively) small chunks as needed. Problem is I can't read the whole file in at once (its ridiculously large)

Obtaining the PyObject * of a class

2008-03-10 Thread Cooper, Andrew
I',m currently using SWIG to generate a python interface to a C DLL. I'm new to the Python C API and have a question that has been stumping me for the last week. As part of the wrapper process I want to hide some of the complexity with dealing with handles using a python class. But the problem I

Re: defining a method that could be used as instance or static method

2008-03-10 Thread Sam
> Did you try that it doesn't work? because it should. Whenever you do > No... -_- I kept on trying things @staticmethod. Thanks for your hint, it works fine! Sam -- http://mail.python.org/mailman/listinfo/python-list

Re: defining a method that could be used as instance or static method

2008-03-10 Thread Gerard Flanagan
On Mar 10, 4:39 pm, Sam <[EMAIL PROTECTED]> wrote: > Hello > > I would like to implement some kind of comparator, that could be > called as instance method, or static method. Here is a trivial pseudo > code of what I would like to execute > > >> class MyClass: > > ...def __init__(self, value):

Re: Converting a string to the most probable type

2008-03-10 Thread cokofreedom
The trick in the case of when you do not want to guess, or the choices grow too much, is to ask the user to tell you in what format they want it and format according to their wishes. Neatly avoids too much guessing and isn't much extra to add. -- http://mail.python.org/mailman/listinfo/python-lis

Re: Regarding coding style

2008-03-10 Thread [EMAIL PROTECTED]
On Mar 10, 11:30 am, rockingred <[EMAIL PROTECTED]> wrote: > On Mar 10, 10:26 am, Roel Schroeven <[EMAIL PROTECTED]> > wrote: > > > > > rockingred schreef: > > > > On Mar 8, 8:27 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: > > >> //Copyright (C) 2008 Foobar Computer Consulting > > >> // > > >> //

Re: is operator

2008-03-10 Thread Steven D'Aprano
On Mon, 10 Mar 2008 07:39:25 -0700, Gary Herron wrote: > If either is a surprise, then understand that the "is" operator should > probably *never* be used with immutable types. Carl Banks has already mentioned testing for None with "is". The standard idiom for using mutable default arguments goe

Re: Checking if a variable is a dictionary

2008-03-10 Thread Steven D'Aprano
On Mon, 10 Mar 2008 14:29:48 +, Andrew Koenig wrote: > So the question you need to answer is whether you want to determine > whether an object is exactly of type dict, or whether it you are willing > to accept types derived from dict also. Or other mappings that don't inherit from dict but be

Re: for-else

2008-03-10 Thread castironpi
> > The idea of the if-else is: > > . depending on some condition either do this or do something else, > > . don't do them both. > > constructs, I asked myself whether the application of a different idea > resulted in a consistent, sensible interpretation. They could just as easily have defined

Re: tcp client socket bind problem

2008-03-10 Thread castironpi
On Mar 10, 9:40 am, Marc Christiansen <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I have a linux box with multiple ip addresses. I want to make my > > python client connect from one of the ip addresses. Here is my code, > > no matter what valid information I put in the bind it always

Re: error/warning color customization in interactive console?

2008-03-10 Thread yhvh
I've just discovered ipython - An Enhanced Interactive Python, which among other things colorizes output including error codes -- http://mail.python.org/mailman/listinfo/python-list

Re: is operator

2008-03-10 Thread castironpi
On Mar 10, 11:36 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Mon, 10 Mar 2008 07:39:25 -0700, Gary Herron wrote: > > If either is a surprise, then understand that the "is" operator should > > probably *never* be used with immutable types. > > Mutable or immutable, it make

lowercase u before string in "python for windows"

2008-03-10 Thread davidj411
why does this occur when using the python windows extensions? all string are prefixed by a lowercase "u". is there a newsgroup explicitly for python windows extensions? example of output below. SMBIOSBIOSVersion:u'A16' SMBIOSMajorVersion:2 SMBIOSMinorVersion:3 SMBIOSPresent:True SoftwareElementID

Re: lowercase u before string in "python for windows"

2008-03-10 Thread Tim Chase
> why does this occur when using the python windows extensions? all > string are prefixed by a lowercase "u". They are Unicode strings: http://docs.python.org/ref/strings.html > is there a newsgroup explicitly for python windows extensions? Not that I know of, other than what's described here:

Re: lowercase u before string in "python for windows"

2008-03-10 Thread Simon Brunning
On Mon, Mar 10, 2008 at 5:20 PM, davidj411 <[EMAIL PROTECTED]> wrote: > why does this occur when using the python windows extensions? There's nothing Windows specific about this - it just means that you have unicode strings. See , -- Cheers, Simon B. [

Re: Keep a python script running after browser window closed

2008-03-10 Thread sophie_newbie
On Mar 7, 4:33 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Mar 7, 10:28 am, sophie_newbie <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I have a cgi script that performs a very long computation that can > > take several hours to complete. Is there any smart way that I can keep > > this script ru

Re: __iter__ yield

2008-03-10 Thread Boris Borcic
Paul Hankin wrote: > On Mar 10, 3:12 am, George Sakkis <[EMAIL PROTECTED]> wrote: >> On Mar 9, 7:37 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: >> >> >> >>> On Mar 9, 8:58 pm, duccio <[EMAIL PROTECTED]> wrote: Someone knows if it's possible to make this __iter__ function with just one 'yie

execute python script question

2008-03-10 Thread Gabriel Rossetti
Hello, I have been developping something in python that has the following hierarchy : project/src/myPackage/ project/src/myPackage/__init__.py project/src/myPackage/module1.py project/src/myPackage/module2.py project/src/myPackage/test/ project/src/myPackage/test/__init__.py project/src/myPackag

Re: any chance regular expressions are cached?

2008-03-10 Thread mh
John Machin <[EMAIL PROTECTED]> wrote: > Yes they will be cached. great. > But do yourself a favour and check out the > string methods. Nifty... thanks all! -- Mark Harrison Pixar Animation Studios -- http://mail.python.org/mailman/listinfo/python-list

Re: BitVector

2008-03-10 Thread Paul Rubin
John Machin <[EMAIL PROTECTED]> writes: > Bitwise operations like & | ^ << >> etc work on long integers. This > happens at C speed. The problem is if you want to set a bit, you have to allocate a whole new long integer. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to factor using Python?

2008-03-10 Thread Mensanator
On Mar 10, 12:48 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > On 10 mar, 02:08, Nathan Pinno <[EMAIL PROTECTED]> wrote: > > > How do I factor a number? If factoring is actually what you want, the sympy module can do it. >>> n = 85085**3 >>> print n 615969217989125 >>> import sympy >>> f = s

Re: lowercase u before string in "python for windows"

2008-03-10 Thread Mike Driscoll
> > > is there a newsgroup explicitly for python windows extensions? > > Not that I know of, other than what's described here: > > https://sourceforge.net/mail/?group_id=78018 > > -tkc There is a PyWin32 user's group: http://mail.python.org/mailman/listinfo/python-win32 The maintainer of the pr

Re: What c.l.py's opinions about Soft Exception?

2008-03-10 Thread Lie
On Mar 10, 12:12 pm, John Nagle <[EMAIL PROTECTED]> wrote: > Steven D'Aprano wrote: > > On Sat, 08 Mar 2008 22:24:36 -0800, Kay Schluehr wrote: > > >> On 9 Mrz., 06:30, Steven D'Aprano <[EMAIL PROTECTED] > >> cybersource.com.au> wrote: > >> Is it really so exotic that it requires the demand for mor

SV: Adjust a canvas as the window is resized

2008-03-10 Thread K Viltersten
>> Do i need to set a callback to a canvas >> in order to "listen" to the root window >> being resized in order to make it adjust >> its contents? >> >> If so, how? If not, how do i make the >> canvas draw a line from one corner to >> an other? > > import Tkinter as tk > > root = tk.Tk() > canva

Re: BitVector

2008-03-10 Thread Ross Ridge
DanielJohnson <[EMAIL PROTECTED]> wrote: >I am trying to solve a genetic algorithm problem where I want to read >a bitvector of very large size (say 1) and manipulate bits based >on certain algorithms. > >I am a newbie in Python. What data structure are good to read such >huge data set. Are th

Re: Quality assurance in Python projects containing C modules

2008-03-10 Thread Duncan Booth
Stefan Behnel <[EMAIL PROTECTED]> wrote: > Duncan Booth wrote: >> I would start by ensuring that any DLLs you write are written using >> Pyrex or Cython: almost always problems with C libraries called from >> Python are due to faulty reference counting but if you keep all of >> your Python related

Re: wxPython/wxWidgets ok for production use ?

2008-03-10 Thread Stefan Behnel
Malcolm Greene wrote: >> My personal experience with wxPython has its ups and downs. Specifically >> when it comes to crashes, I wouldn't bet my life on it. > > I'm new to Python and getting ready to build a small client based > application intended to run on Windows and Linux. I was planning on

Re: What c.l.py's opinions about Soft Exception?

2008-03-10 Thread [EMAIL PROTECTED]
On Mar 9, 2:21 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Is this soft-exception implemented anywhere, so that one can see what > experiences and best practices have evolved around using it? Lie's idea is to separate exceptions in two groups, those that must be handled and those that don'

Re: Quality assurance in Python projects containing C modules

2008-03-10 Thread Stefan Behnel
Duncan Booth wrote: > Stefan Behnel <[EMAIL PROTECTED]> wrote: >> Duncan Booth wrote: >>> I would start by ensuring that any DLLs you write are written using >>> Pyrex or Cython: almost always problems with C libraries called from >>> Python are due to faulty reference counting but if you keep all

Re: What c.l.py's opinions about Soft Exception?

2008-03-10 Thread Diez B. Roggisch
> The problem with callbacks is that it works only for a small amount of > callbacks, it'd be too messy to have twenty different callbacks. > And the ultimate problem with callbacks is that we can't determine > from the outside whether the operation should continue or breaks at > the point of the c

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread Bob Martin
in 337513 20080310 115744 "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >Roopan wrote: > >> Hello! >> >> I am looking at developing an enterprise-grade distributed data >> sharing application - key requirements are productivity and platform >> p

Re: wxPython/wxWidgets ok for production use ?

2008-03-10 Thread Stef Mientki
Stefan Behnel wrote: > Malcolm Greene wrote: > >>> My personal experience with wxPython has its ups and downs. Specifically >>> when it comes to crashes, I wouldn't bet my life on it. >>> >> I'm new to Python and getting ready to build a small client based >> application intended to run

Re: wxPython/wxWidgets ok for production use ?

2008-03-10 Thread Mike Driscoll
On Mar 10, 2:11 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Malcolm Greene wrote: > >> My personal experience with wxPython has its ups and downs. Specifically > >> when it comes to crashes, I wouldn't bet my life on it. > > > I'm new to Python and getting ready to build a small client based > >

  1   2   >