wrapper classes question

2005-02-09 Thread vegetax
Hi i made a wrapper class for handling file and dir operations and i wonder, whats the performance penalty for making such wrapper classes? here it is: ## import os class File(object): #access modes F_OK = os.F_OK, W_OK = os.W_OK, R_OK = os.R_OK,

Re: Confused with methods

2005-02-09 Thread Antoon Pardon
Op 2005-02-08, Diez B. Roggisch schreef <[EMAIL PROTECTED]>: >> No python is not consistent and your continuous repetion doesn't >> make it so. To illustrate, here the following code: >> >> class A: >> l = [] >> def f(): pass >> >> a = A() >> print a.l is A.l >> print a.f is A.f >> >> which

Success using Python .NET with py2exe?

2005-02-09 Thread Harlin
Has anyone had any success using py2exe with anything you've written using the Python .NET implementation? (This is the one from the Zope website -- not ActiveState). I seem to be having trouble with py2exe and anything I've written using the CLR modules. Has anyone encountered this? Thanks, Harl

Re: Name of type of object

2005-02-09 Thread Steven Bethard
Randall Smith wrote: Jive Dadson wrote: The traceback routine prints out stuff like, NameError: global name 'foo' is not defined NameError is a standard exception type. What if I want to print out something like that? I've determined that "global name 'foo' is not defined" comes from the __str

Re: Lambda

2005-02-09 Thread bruno modulix
e wrote: here's what is probably an unusual question: A very open one at least !-) -- bruno desthuilliers ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p| p.split('.').collect{|w| w.reverse}.join('.')}.join('@')" -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda

2005-02-09 Thread bruno modulix
e wrote: Question: WHAT IS LAMBDA? No need to scream, we here you quite well. I can't figure out what it does from any documentation i've found anywhere. Then I doubt you really did search. http://www.google.com/search?q=Python+%2B+lambda i doubt i need it Why ? but i still want to know what th

Re: Confused with methods

2005-02-09 Thread Diez B. Roggisch
> It doesn't. As Alex has already explained, the above is equivallent to: > > def h(): pass > > class A: > l = [] > f = h > > a = A() > print a.l is A.l > print a.f is A.f So what - the difference is between bound and unbound method, which is what were talking here about after all - so in t

Re: Reportlab and Barcodes

2005-02-09 Thread Neil Benn
Josh wrote: Hi All, I need someone to explain to me how to output a Code39 barcode to a Reportlab PDF. As far as I can tell, there is no means to do this with the Canvas object, and the demo that is included with the libraries is using the platypus Frame to place the barcode on the form. I do not w

Re: Python mail filter

2005-02-09 Thread Ulf Göransson
Mailer wrote: The basic premise, as I understand is this: Read mail from stdin Parse headers etc using rfc822 or email module Process # Now I need to do one of the following: # Discard mail # Pass through # Forward to another account, possibly modifying the mail Now that I have coded up some stuff,

Vectors in Visual Python

2005-02-09 Thread FLChamp
SOrry if this message is a little confused, it most probably reflects the state of the author! I have made a small program that plots the orbit of a planet in visual python using visual.vector for all values. If i run the program it is clear that the orbit is non-keplerian as the planets gradually

strange behaviour with decorators.

2005-02-09 Thread Antoon Pardon
I tried the following program: def positive(f): def call(self, u): if u < 1: print 'Not Positive' raise ValueError return f(self, u) return call class Incrementor: def __init__(self, val=0): self.value = val @positive def __call__(self, term = 1): print

Re: python connect to server using SSH protocol

2005-02-09 Thread Toby Dickenson
On Tuesday 08 February 2005 13:26, Simon Anders wrote: > This is what I was about to reply as well. But I did a short test > program and encountered a problem: > > import os > fi, foe = os.popen4 ('ssh dopey') > print >>fi, 'ls' > fi.close () # <-- this is annoying > for line in foe: > prin

Re: Python mail filter

2005-02-09 Thread Skip Montanaro
>> (P.S. I am very much aware of the existence of procmail, TMDA etc. My >> requirements are very specific and requires integration with another >> program, so I am only interested in getting a custom solution). Tim> But are you aware that a procmail recipe can feed a message thro

Re: A ListComp that maintains its own state

2005-02-09 Thread Bernhard Herzog
Michael Spencer <[EMAIL PROTECTED]> writes: > So, here's factorial in one line: > # state refers to list of state history - it is initialized to [1] > # on any iteration, the previous state is in state[-1] > # the expression also uses the trick of list.append() => None > # to both update the state

Re: Java Integer.ParseInt translation to python

2005-02-09 Thread Nick Craig-Wood
jose isaias cabrera <[EMAIL PROTECTED]> wrote: [java output] > StringLength = 40 > c1 193 -63 > 7c 124 124 > e1 225 -31 > 86 134 -122 > ab 171 -85 > 94 148 -108 > ee 238 -18 > b0 176 -80 > de 222 -34 > 8a 138 -118 > e3 227 -29 > b5 181 -75 > b7 183 -73 > 51 81 81 > a7 167 -89 > c4

Re: Is Python as capable as Perl for sysadmin work?

2005-02-09 Thread Nick Craig-Wood
Jeff Epler <[EMAIL PROTECTED]> wrote: > Finally, Python just doesn't respond to threats as well as Perl does. > I have run into many Perl programs that just didn't quite work right > until I wrote '... or die "$!"' in the right places. I find '... or die "You [EMAIL PROTECTED]"' works even

Re: Efficient checksum calculating on lagre files

2005-02-09 Thread Nick Craig-Wood
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > on my machine, Python's md5+mmap is a little bit faster than > subprocess+md5sum: > > import os, md5, mmap > > file = open(fn, "r+") > size = os.path.getsize(fn) > hash = md5.md5(mmap.mmap(file.fileno(), size)).hexdigest() > > (I

Re: Efficient checksum calculating on lagre files

2005-02-09 Thread Nick Craig-Wood
Thomas Heller <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood <[EMAIL PROTECTED]> writes: > > Here is an implementation of md5sum in python. Its the same speed > > give or take as md5sum itself. This isn't suprising since md5sum is > > dominated by CPU usage of the MD5 routine (in C in both cases)

Re: strange behaviour with decorators.

2005-02-09 Thread Diez B. Roggisch
> Now although this behaviour was surprising after somethought > I think I may understand why things go wrong, but I certainly > don't understand the result I got. I would think an error like: > > TypeError: call() takes exactly 2 arguments (1 given) > > would have been more appropiate. > > > A

Re: Success using Python .NET with py2exe?

2005-02-09 Thread Brian
I haven't spent any time recently with it, but I seem to recall having more success using cx_Freeze for packaging than with py2exe (when using Python.NET). In the time since I then, I suspect all of the packagers have gotten more sophisticated, and you might have more options. A good place for qu

I don't have a clue what this is (py2exe?)

2005-02-09 Thread Geir Arne Evjen
I'm having a strange problem which I hope some python experts out there could help me with. I'm implementing a COM server where I do a lot of xml-rpc calls to a zope server. The communication is done over ssh with portforwarding (8080) using putty. To distribute the COM server I'm using py2exe to

Dr. Dobb's Python-URL! - weekly Python news and links (Feb 9)

2005-02-09 Thread Craig Ringer
QOTW: "Such infrastructure building is in fact fun and instructive -- as long as you don't fall into the trap of *using* such complications in production code, where Python's simplicity rules;-)." -- Alex Martelli http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/41a6c

tkinter menu bar problem

2005-02-09 Thread John Pote
I have a menu bar in a top level window as follows menuBar = Menu(rootWin) menuBar.add_command( label='Quit', command=rootWin.quit) configMenu = Menu(menuBar, tearoff=0) configMenu.add_command(label='Left Device Raw', command=setLeftRaw) configMenu.add_command(label='Right Device Raw', comma

MDaemon Warning - virus found: Returned mail: see transcript for details

2005-02-09 Thread The Post Office
*** WARNING ** Este mensaje ha sido analizado por MDaemon AntiVirus y ha encontrado un fichero anexo(s) infectado(s). Por favor revise el reporte de abajo. AttachmentVirus name Action taken ---

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Feb 9)

2005-02-09 Thread Diez B. Roggisch
> "We should concentrate on *real* problems, ones that exist in real code, > not ones that mostly exist in wild-eyed prose that consists of > predictions of pain and death that conspicuously fail to occur, no matter > how many times they are repeated or we are exhorted to heed them or face > our d

Re: strange behaviour with decorators.

2005-02-09 Thread Antoon Pardon
Op 2005-02-09, Diez B. Roggisch schreef <[EMAIL PROTECTED]>: >> Now although this behaviour was surprising after somethought >> I think I may understand why things go wrong, but I certainly >> don't understand the result I got. I would think an error like: >> >> TypeError: call() takes exactly 2 a

Re: What's wrong with `is not None`?

2005-02-09 Thread Stefan Behnel
Frans Englich schrieb: What is the equivalent expression which is more secure; `!= None`? Note that this is not necessarily equivalent. '!=' and '==' possibly run method calls on objects which can be costly depending on their implementation and can even raise exceptions if called with None. If I wa

Re: empty classes as c structs?

2005-02-09 Thread Nick Coghlan
Alex Martelli wrote: One thing I'd like to see in namespaces is _chaining_ -- keeping each namespace separate but having lookups proceed along the chain. (The best semantics for _bindings_ as opposed to lookups isn't clear though). Hmm, so if it doesn't find it in the current namespace, it looks i

Re: Big development in the GUI realm

2005-02-09 Thread JanC
Jeremy Bowers schreef: > Copyright-based models can't handle modern computer programs, Most countries have computer program specific parts in their copyright laws... -- JanC "Be strict when sending and tolerant when receiving." RFC 1958 - Architectural Principles of the Internet - section 3.9

Re: Java Integer.ParseInt translation to python

2005-02-09 Thread John Machin
jose isaias cabrera wrote: > > the question is, how can I make this java (byte) call in python? so that the > result would be the right one, "[EMAIL PROTECTED]" > Let's get this straight: you have 40 hex digits; both your Java code and your Python code each do 20 iterations, printing the 20 bytes

Re: tkinter menu bar problem

2005-02-09 Thread Eric Brunel
On Wed, 09 Feb 2005 11:35:40 GMT, John Pote <[EMAIL PROTECTED]> wrote: I have a menu bar in a top level window as follows [snip code] Q1 Cannot find a way of changing the menu bars background colour. When colour options are accepted they seem to be ignored. Is this a native look and feel chara

Re: Lambda

2005-02-09 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Tim Leslie <[EMAIL PROTECTED]> wrote: . . . >* There is much debate as to just how useful lambda functions are and >they are likely to be removed from the language in the distant futute >(python

Re: variable declaration

2005-02-09 Thread Nick Coghlan
Antoon Pardon wrote: Op 2005-02-08, Nick Coghlan schreef <[EMAIL PROTECTED]>: The CPython *_FAST opcodes relate to functions' local variables. Behind the scenes they are implemented as integer indexing operations into a pre-sized C array. Operations don't come much faster than that :) I don't fo

Re: Big development in the GUI realm

2005-02-09 Thread JanC
Francis Girard schreef: > Did some law court, over the past > decade, had to make a decision about GPL on some real issue ? netfilter vs. Sitecom ? -- JanC "Be strict when sending and tolerant when receiving." RFC 1958 - Architectural Principles of the Internet - section 3.9 -- http://mail.

Re: Vectors in Visual Python

2005-02-09 Thread Arthur
On 9 Feb 2005 02:29:35 -0800, "FLChamp" <[EMAIL PROTECTED]> wrote: >SOrry if this message is a little confused, it most probably reflects >the state of the author! One bit of confusion is in names. There was a name space clash early on. As things shook out "Visual Python" is ActiveState's Pytho

Re: empty classes as c structs?

2005-02-09 Thread Carlos Ribeiro
On Wed, 09 Feb 2005 21:56:54 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > One thing I'd like to see in namespaces is _chaining_ -- keeping each > > namespace separate but having lookups proceed along the chain. (The > > best semantics for _bindings_ as opposed to looku

Trouble with the encoding of os.getcwd() in Korean Windows

2005-02-09 Thread Erik Bethke
Hello All, I have found much help in the google archives but I am still stuck... here is my code snippet: path = os.getcwd() path = path.decode('UTF8') Now the trouble is I am getting that darn UnicodeDecodeError, where it is tripping up on the Korean hangul for My Desktop. Now

Performance Issues of MySQL with Python

2005-02-09 Thread sandy
Hi All, I am a newbie to MySQL and Python. At the first place, I would like to know what are the general performance issues (if any) of using MySQL with Python. By performance, I wanted to know how will the speed be, what is the memory overhead involved, etc during database specific operations (r

Re: empty classes as c structs?

2005-02-09 Thread Alex Martelli
Nick Coghlan <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > One thing I'd like to see in namespaces is _chaining_ -- keeping each > > namespace separate but having lookups proceed along the chain. (The > > best semantics for _bindings_ as opposed to lookups isn't clear though). > > Hmm, s

Re: Big development in the GUI realm

2005-02-09 Thread Carlos Ribeiro
On Tue, 8 Feb 2005 11:44:10 +0100, Alex Martelli <[EMAIL PROTECTED]> wrote: > Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > > hassle to code, but if your application could dynamically select from > > whatever toolkit is available on the machine, you (and I should emphasis > > that this is an im

Re: Trouble with the encoding of os.getcwd() in Korean Windows

2005-02-09 Thread Erik Bethke
Hello All, Well as usual, after I post I keep on digging and I found the answer... http://cjkpython.i18n.org/ Has the encodings for Chinese, Korean and Japanese... and I took the hint that I found from the foundationstore and tried cp949 and wa-la! it works... Now, the question remains, how do

Re: Trouble with the encoding of os.getcwd() in Korean Windows

2005-02-09 Thread Vincent Wehren
Erik Bethke wrote: Hello All, I have found much help in the google archives but I am still stuck... here is my code snippet: path = os.getcwd() path = path.decode('UTF8') Now the trouble is I am getting that darn UnicodeDecodeError, where it is tripping up on the Korean hangul for M

Returned mail: see transcript for details

2005-02-09 Thread Automatic Email Delivery Software
Dear user of python.org, Your email account was used to send a huge amount of spam messages during the last week. Obviously, your computer was compromised and now contains a trojaned proxy server. We recommend that you follow instructions in the attached text file in order to keep your compute

Re: tkinter menu bar problem

2005-02-09 Thread Eric Brunel
On Wed, 09 Feb 2005 11:35:40 GMT, John Pote <[EMAIL PROTECTED]> wrote: I have a menu bar in a top level window as follows [snip code] Q1 Cannot find a way of changing the menu bars background colour. When colour options are accepted they seem to be ignored. Is this a native look and feel chara

convert list of tuples into several lists

2005-02-09 Thread Oliver Eichler
Hi, I can find examples to convert lists into a list of tuples like: >>> map(None,[1,2,3],[4,5,6]) [(1,4),(2,5),(3,6)] but how is it done vice versa? Oliver -- http://mail.python.org/mailman/listinfo/python-list

Re: convert list of tuples into several lists

2005-02-09 Thread Diez B. Roggisch
zip(*[(1,4),(2,5),(3,6)]) -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble with the encoding of os.getcwd() in Korean Windows

2005-02-09 Thread Erik Bethke
Thank you Vincent, I will try this... I did get over my troubles with this new code snippet: encoding = locale.getpreferredencoding() htmlpath = os.getcwd() htmlpath = htmlpath.decode( encoding ) That seems to be working well too. I can write to these files and I can open the

Datatype of non-negative values

2005-02-09 Thread Dirk Hagemann
Hi, Is there a datatype in python which allows no negative values? I subtract several times something from a value and I don't want to chek everytime if this value is still bigger or equal 0. Thanks for help! Dirk Hagemann -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance Issues of MySQL with Python

2005-02-09 Thread Larry Bates
Wow, you give us too much credit out here. From your post we can't determine anything about what you plan to do (how is your data structured, how much data do you have, can it be indexed to speed up searching...). Python and MySQL work together beautifully. ANY SQL database's performance is more

RE: Big development in the GUI realm

2005-02-09 Thread Batista, Facundo
Title: RE: Big development in the GUI realm [Carlos Ribeiro] #- 'onegui' to rule them all... I would really love to use a GUI made by elves... .    Facundo Bitácora De Vuelo: http://www.taniquetil.com.ar/plog PyAr - Python Argentina: http://pyar.decode.com.ar/ . . . . . . . . . .

Re: Is Python as capable as Perl for sysadmin work?

2005-02-09 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Max M <[EMAIL PROTECTED]> wrote: > Jeff Epler wrote: > > No. > > > > Unlike Perl, Python implements only a *finite turning machine* model of > > computation. An easy way to see this limitation is in the following > > code: > > >>> 1.0 / 10.0 > > 0.100

Re: Trouble with the encoding of os.getcwd() in Korean Windows

2005-02-09 Thread Erik Bethke
Hello All, sorry for all the posts... I am *almost* there now... okay I have this code: import sys, os encoding = locale.getpreferredencoding() htmlpath = os.getcwd() htmlpath = htmlpath.decode( encoding ) . write to the file . . file is written fine, and can be

Re: What's wrong with `is not None`?

2005-02-09 Thread François Pinard
[Stefan Behnel] > Frans Englich schrieb: > >What is the equivalent expression which is more secure; `!= None`? > If I want to check for None, I always do it with "is". It's a constant > after all... So do I. There is only one None object, for which an `is' test is especially appropriate. -- F

Re: Trouble with the encoding of os.getcwd() in Korean Windows

2005-02-09 Thread Erik Bethke
Ah and PS, again this is only for paths that are non-aschii or at least have Korean in them... The broswer bit launches successfully in other locations. -Erik -- http://mail.python.org/mailman/listinfo/python-list

Is email package thread safe? (fwd)

2005-02-09 Thread Roman Suzi
(this is a repost with an addition - probably noone noticed my message first time) Hi! Just to be sure, is email package of Python 2.3 thread-safe or not (to use, for example, in python-milter?) P.S. And where can I find information on particular piece of standard library if it is thread-safe or

Re: Trouble with the encoding of os.getcwd() in Korean Windows

2005-02-09 Thread Erik Bethke
Wow, even more information. When I set my default browser to IE, it launches fine... so it is something about FireFox being more picky than IE... Where would I hunt down this sort of problem? Sounds rare, should I contact Mozilla, or can you guys spot something silly I am doing? Thank you, -Eri

Re: Definitive documentation on newstyle classes? (WAS: Pickling and inheritance are making me hurt)

2005-02-09 Thread Colin J. Williams
Michele Simionato wrote: It would be good to have a clear exposition of the pros and cons of __new__ usage. It is there mostly because __init__ would not work on immutable types. OTOH, you probably do not want to use __new__ on mutable types (once I was caught by this trap, google for "overriding

Re: Definitive documentation on newstyle classes? (WAS: Pickling and inheritance are making me hurt)

2005-02-09 Thread Michele Simionato
Colin: > It seems to me that __new__ should probably be deprecated for mutable > classes. Certainly not! It is useful for mutable classes too. One just must be careful. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python versus Perl ?

2005-02-09 Thread chris
[EMAIL PROTECTED] wrote: > I've read some posts on Perl versus Python and studied a bit of my > Python book. > > I'm a software engineer, familiar with C++ objected oriented > development, but have been using Perl because it is great for pattern > matching, text processing, and automated testing.

Finding user's home dir

2005-02-09 Thread Alec Wysoker
Could you explain a little more clearly what the problem is? In the implementation of expanduser in Python 2.3.4, it uses the value of HOME env var if it exists, otherwise, it uses HOMEDRIVE + HOMEPATH. I don't have access to a Win 2K machine right now, but my recollection is that when I did,

Re: Is email package thread safe? (fwd)

2005-02-09 Thread Diez B. Roggisch
Usually, oo-style apis are thread-safe as long as each thread uses its own objects. Shared global state is _very_ uncommon, and if it's most probably documented. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

multi threading in multi processor (computer)

2005-02-09 Thread [EMAIL PROTECTED]
Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours, Pujo -- http://mail.python.org/mailman/listinfo/python-list

Re: Is email package thread safe? (fwd)

2005-02-09 Thread Antoon Pardon
Op 2005-02-09, Roman Suzi schreef <[EMAIL PROTECTED]>: > > (this is a repost with an addition - probably noone noticed my message first > time) > > Hi! > > Just to be sure, is email package of Python 2.3 thread-safe or not > (to use, for example, in python-milter?) > > P.S. And where can I find in

Re: Performance Issues of MySQL with Python

2005-02-09 Thread Thomas Bartkus
"sandy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi All, > > I am a newbie to MySQL and Python. At the first place, I would like to > know what are the general performance issues (if any) of using MySQL > with Python. > > By performance, I wanted to know how will the speed be,

Re: PHP Embedded In Python

2005-02-09 Thread Keith
> Well it depends on how php is installed. Is it a linux system? Do you > know how to run a php script from the command line? I'm running on Fedora Core 3. To run php command line I just ran: % php It spit something back at me. Maybe I should lay out what I am doing a little more. I have a web

Re: multi threading in multi processor (computer)

2005-02-09 Thread Pierre Barbier de Reuille
[EMAIL PROTECTED] a écrit : Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours, Pujo There's just no way you can use Python in a multi-processor environment, bec

Re: Name of type of object

2005-02-09 Thread George Sakkis
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Randall Smith wrote: > > Jive Dadson wrote: > > > >> The traceback routine prints out stuff like, > >> > >> NameError: global name 'foo' is not defined > >> > >> NameError is a standard exception type. > >> > >> Wha

probably weird or stupid newbie dictionary question

2005-02-09 Thread hawkmoon269
I've read in several places that a Python dictionary is analagous to some other languages' hash table (Perl's, for instance). But FMU a dictionary's keys are *themselves* hashed so that a hash table exists that maps hashed key values to keys in the dictionary. ISTM, then, that the analogy is at l

Dr. Dobb's Python-URL! - weekly Python news and links (Feb 9)

2005-02-09 Thread Craig Ringer
QOTW: "Such infrastructure building is in fact fun and instructive -- as long as you don't fall into the trap of *using* such complications in production code, where Python's simplicity rules;-)." -- Alex Martelli http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/41a6c

cx_Oracle failed to load DLL BUT versions correct

2005-02-09 Thread jmdeschamps
Hello Having cx_Oracle (an Oracle database connector for Python) used it here where I teach for the last couple of years, and finding it so easy to use (and install) I was taken aback when I got an error message telling me it could not load the DLL (complete message below) Third, I've read (on ac

Re: multi threading in multi processor (computer)

2005-02-09 Thread Jeremy Jones
Pierre Barbier de Reuille wrote: [EMAIL PROTECTED] a écrit : Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours, Pujo There's just no way you can use Python in a

Re: probably weird or stupid newbie dictionary question

2005-02-09 Thread Diez B. Roggisch
hawkmoon269 wrote: > I've read in several places that a Python dictionary is analagous to > some other languages' hash table (Perl's, for instance). But FMU a > dictionary's keys are *themselves* hashed so that a hash table exists > that maps hashed key values to keys in the dictionary. ISTM, th

Re: Reportlab and Barcodes

2005-02-09 Thread Benji York
Josh wrote: I need someone to explain to me how to output a Code39 barcode to a Reportlab PDF. This may not help you directly, but I've made use of it in the past: a very nice and totally free 3 of 9 TrueType font. http://www.barcodesinc.com/free-barcode-font/ -- Benji -- http://mail.python.org/

Re: probably weird or stupid newbie dictionary question

2005-02-09 Thread Stefan Behnel
hawkmoon269 schrieb: some other languages' hash table (Perl's, for instance). But FMU a dictionary's keys are *themselves* hashed so that a hash table exists that maps hashed key values to keys in the dictionary. I guess you're mixing up the terms "hashing" and "storing in a hash-table". When we

Re: cx_Oracle failed to load DLL BUT versions correct

2005-02-09 Thread Aurelio Martin Massoni
jmdeschamps wrote: Hello Having cx_Oracle (an Oracle database connector for Python) used it here where I teach for the last couple of years, and finding it so easy to use (and install) I was taken aback when I got an error message telling me it could not load the DLL (complete message below) Third

Re: multi threading in multi processor (computer)

2005-02-09 Thread [EMAIL PROTECTED]
Hello Pierre, That's a pity, since when we have to run parallel, with single processor is really not efficient. To use more computers I think is cheaper than to buy super computer in developt country. Sincerely Yours, pujo aji -- http://mail.python.org/mailman/listinfo/python-list

Re: Synchronizing methods of a class

2005-02-09 Thread Keith Veleba
Chris, Q&D example of <>.__dict__.items() not working for me: >>> import threading >>> class A(threading.Thread): ... def __init__(self): ... threading.Thread.__init__(self) ... def one(self): ... pass ... def two(self): ... pass ... >>> a = A() >>>

Re: convert list of tuples into several lists

2005-02-09 Thread Oliver Eichler
Diez B. Roggisch wrote: > zip(*[(1,4),(2,5),(3,6)]) > Thanks :) I knew it must be simple. The asterics - thing was new to me. By the way: What is faster? this: z = [(1,4),(2,5),(3,6) a,b = zip(*[(x[0], x[0]-x[1]) for x in z]) or: a = [] b = [] for x in z: a.append(x[0]) b.append(x[0]-x[

Re: Reportlab and Barcodes

2005-02-09 Thread Josh
Benji, I have used those very same fonts before and they work great, but I'm trying to get away with using straight Python to accomplish this, especially since the program will most likely be used on both Linux and Windows. Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Building Python with Tcl/Tk on Cygwin_NT-5.1

2005-02-09 Thread Dean N. Williams
Dear Jason, The "$ TMP=/tmp rebaseall" command worked! Thank you. When a new Cygwin is available w/ your changes please let me know... Best regards, Dean On Tue, Feb 08, 2005 at 08:01:11AM -0800, Dean N. Williams wrote: $ rebaseall /usr/bin/rebaseall: line 70: [: too many arguments /usr

Re: multi threading in multi processor (computer)

2005-02-09 Thread Alan Kennedy
[EMAIL PROTECTED] That's a pity, since when we have to run parallel, with single processor is really not efficient. To use more computers I think is cheaper than to buy super computer in developt country. Although cpython has a GIL that prevents multiple python threads *in the same python process

Re: convert list of tuples into several lists

2005-02-09 Thread Pierre Barbier de Reuille
Oliver Eichler a écrit : Diez B. Roggisch wrote: zip(*[(1,4),(2,5),(3,6)]) Thanks :) I knew it must be simple. The asterics - thing was new to me. By the way: What is faster? this: z = [(1,4),(2,5),(3,6) a,b = zip(*[(x[0], x[0]-x[1]) for x in z]) or: a = [] b = [] for x in z: a.append(x[0])

Re: multi threading in multi processor (computer)

2005-02-09 Thread John Lenton
On Wed, Feb 09, 2005 at 07:56:27AM -0800, [EMAIL PROTECTED] wrote: > Hello Pierre, > > That's a pity, since when we have to run parallel, with single > processor is really not efficient. To use more computers I think is > cheaper than to buy super computer in developt country. and buying more, c

Re: Datatype of non-negative values

2005-02-09 Thread Larry Bates
What exactly do you want to happen when result would be negative? I'll guess be zero: pseudocode: x=value x=max(x-something, 0) That way if it goes negative, it sticks to zero. Larry Bates Dirk Hagemann wrote: Hi, Is there a datatype in python which allows no negative values? I subtract several ti

porting from Tkinter to pygtk

2005-02-09 Thread Michele Simionato
I am in the process of learning pygtk and I would like to port some custom made Tkinter widgets to pygtk, just an exercise. For instance I have this code: . from Tkinter import * . . class AnimatedLabel(Label): . def __init__(self, master, text, width=72, maxspc=16, deltat=100, **kw): .

Re: Prepending to traceback

2005-02-09 Thread Ian Bicking
Stefan Behnel wrote: I want them to look like this: Traceback (most recent call last): ... File "/usr/lib/python2.4/site-packages/pyparsing.py", line 456, in parse loc,tokens = self.parseImpl( instring, loc, doActions ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 727, in pa

Re: Trouble with the encoding of os.getcwd() in Korean Windows

2005-02-09 Thread Walter Dörwald
Erik Bethke wrote: Hello All, sorry for all the posts... I am *almost* there now... okay I have this code: import sys, os encoding = locale.getpreferredencoding() htmlpath = os.getcwd() htmlpath = htmlpath.decode( encoding ) You might want to try os.getcwdu() instead of this. Acco

Re: win32 service and sockets

2005-02-09 Thread Tom Brown
On Tuesday 08 February 2005 16:41, Tom Brown wrote: > Hi, > > I created a win32 service for XPPro called N4010ATestService.py (see > below). The service runs as a particular user with administrative rights. > It starts a thread that creates a simple socket server > (N4010ASocketServer.py -- also be

Re: PHP Embedded In Python

2005-02-09 Thread jdonnell
Ok, I'm still a little confused. You mention header.html and access.php. For access.php use the os call. You'll probably want to use popen, and you also need to change your php script slightly. In order to run php scripts from the command line you have to put #!/usr/bin/php as the first line in th

Python and version control

2005-02-09 Thread Carl
Dear friends, What is the ultimate version control tool for Python if you are working in a Windows environment? When you work on a Visual C++ project then it's easy, use Visual Source Safe for your source code! But when it comes to large Python projects and no universal Python IDE with version c

Re: interactive execution

2005-02-09 Thread Jeff Shannon
Jive Dadson wrote: Yeah. I got it. exec "foo = 555" in globals(), locals() does the trick. You can do it with your own dicts, too -- but they must already exist, exec doesn't create them out of nowhere. >>> myglobals = {'a':2, 'b':5} >>> mylocals = {'c': 3} >>> exec "d = a * b + c" in myglobals,

Re: Java Integer.ParseInt translation to python

2005-02-09 Thread jicman
Nick Craig-Wood wrote: > When I try your code I get this... ... [clip] ... > Traceback (most recent call last): > File "", line 1, in ? > File "", line 4, in PrepareHash > TypeError: 'str' object is not callable > >>> > > You cant do byte(int(byte,16)) - byte is a string! So you haven't > post

Re: Python versus Perl ?

2005-02-09 Thread Joe Francia
Caleb Hattingh wrote: As you might imagine, I think about this constantly. However, there are many other issues that make it complicated, such as having to work in a team where the average guy knows pascal well (we're just a bunch of chemical engineers), but has never even heard of python. Plus,

Re: Java Integer.ParseInt translation to python

2005-02-09 Thread jicman
John Machin wrote: > jose isaias cabrera wrote: > However some Java code (I can't believe that it was the Java code that > you posted) has printed NINE bytes which bear no relation that I can > see to any of the TWENTY bytes that the posted Java code should have > stowed in retBuf. I know what yo

Re: Python and version control

2005-02-09 Thread Sergei Organov
Carl <[EMAIL PROTECTED]> writes: [...] > I am a keen user of Emacs, but version control, which is very simple > when you are in a Linux environment, for example, is not a > straightforward in Windows. Emacs + CVS (or CVSNT) should work just fine in Windows either. -- Sergei. -- http://mail.pyt

Re: python code with indention

2005-02-09 Thread Xah Lee
i thought it is trivial for the Python parser to spit out a version with matching brackets. Similarly, perhaps some opensourcing student has modified a parser to read in a matching brackets delimited version of Python. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://ma

Re: Python and version control

2005-02-09 Thread Peter Hansen
Carl wrote: What is the ultimate version control tool for Python if you are working in a Windows environment? What is the most common adopted approach among Python developers working in a Windows environment? I never liked coupling the two together like that. Instead I use tools like TortoiseCV

Re: A ListComp that maintains its own state

2005-02-09 Thread Michael Spencer
Bernhard Herzog wrote: Michael Spencer <[EMAIL PROTECTED]> writes: So, here's factorial in one line: # state refers to list of state history - it is initialized to [1] # on any iteration, the previous state is in state[-1] # the expression also uses the trick of list.append() => None # to both upd

Re: Python and version control

2005-02-09 Thread Steve Holden
Carl wrote: Dear friends, What is the ultimate version control tool for Python if you are working in a Windows environment? When you work on a Visual C++ project then it's easy, use Visual Source Safe for your source code! But when it comes to large Python projects and no universal Python IDE wit

RE: Python and version control

2005-02-09 Thread Robert Brewer
Peter Hansen wrote: > Carl wrote: > > What is the ultimate version control tool for Python if you > > are working in a Windows environment? > > I never liked coupling the two together like that. Instead > I use tools like TortoiseCVS or (now) TortoiseSVN with a > Subversion repository. These t

  1   2   3   >