Re: Class list of a module

2007-01-15 Thread Gabriel Genellina
At Monday 15/1/2007 04:27, you wrote: I want to get all classes of a module in a list. I wrote this code but I wonder if there's not a simpler solution import inspect def getClassList(aModule): return [getattr(aModule, attName) \ for attName in aModule.__dict__ \

Re: How naive is Python?

2007-01-15 Thread John Machin
[EMAIL PROTECTED] wrote: > John> How naive (in the sense that compiler people use the term) is the > John> current Python system? For example: > > John> def foo() : > John> s = "This is a test" > John> return(s) > > John> s2 = foo() > > J

Re: Class list of a module

2007-01-15 Thread bearophileHUGS
Gabriel Genellina: > >import inspect > def getClassList(aModule): > return [cls for cls in vars(aModule).itervalues() > if inspect.isclass(cls)] This is short enough too: from inspect import isclass getclasses = lambda module: filter(isclass, vars(module).itervalues())

Re: How naive is Python?

2007-01-15 Thread Duncan Booth
Roy Smith <[EMAIL PROTECTED]> wrote: > All of those just move around pointers to the same (interned) string. Correct about the pointers, but the string is not interned: Steven D'Aprano <[EMAIL PROTECTED]> wrote: s1 = foo() s2 = foo() s1 == s2, s1 is s2 > (True, True) > > So the

Re: Python web app. (advice sought)

2007-01-15 Thread Torabisu
Duncan Smith wrote: > Hello, > I find myself in the, for me, unusual (and at the moment unique) > position of having to write a web application. I have quite a lot of > existing Python code that will form part of the business logic. This > relies on 3rd party libraries (such as numpy) which

python and MOV or MPEG

2007-01-15 Thread siggi
Hi all, does Python support MPEG or MOV videoclips? I couldn't find anything about it online. Thank you, Siggi -- http://mail.python.org/mailman/listinfo/python-list

Re: pygame and python 2.5

2007-01-15 Thread siggi
Thanks, I'll try that! Siggi "Laurent Pointal" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > siggi a écrit : >> Hi all, >> >> when I rtry to install pygame (pygame-1.7.1release.win32-py2.4.exe, the >> most >> ciurrent version I found) it requires Python 2.4! Will I really ha

Re: Maths error

2007-01-15 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, Tim Roberts <[EMAIL PROTECTED]> writes: |> "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: |> |> >> What I don't know is how much precision this approximation loses when |> >> used in real applications, and I have never found anyone else who has |> >> much of a clu

Re: python and MOV or MPEG

2007-01-15 Thread Diez B. Roggisch
siggi wrote: > Hi all, > > does Python support MPEG or MOV videoclips? I couldn't find anything about > it online. Weak in googling today? Must have been a rough weekend. There are several options, including pymedia and pygame. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Python web app. (advice sought)

2007-01-15 Thread Tim Williams
On 15 Jan 2007 00:52:33 -0800, Torabisu <[EMAIL PROTECTED]> wrote: > > Duncan Smith wrote: > > Hello, > > I find myself in the, for me, unusual (and at the moment unique) > > position of having to write a web application. I have quite a lot of > > existing Python code that will form part of t

Re: Boilerplate in rich comparison methods

2007-01-15 Thread Antoon Pardon
On 2007-01-13, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I'm writing a class that implements rich comparisons, and I find myself > writing a lot of very similar code. If the calculation is short and > simple, I do something like this: > > > class Parrot: > def __eq__(self, other): >

Re: Python web app. (advice sought)

2007-01-15 Thread Torabisu
Tim Williams wrote: > On 15 Jan 2007 00:52:33 -0800, Torabisu <[EMAIL PROTECTED]> wrote: > > > > Duncan Smith wrote: > > > Hello, > > > I find myself in the, for me, unusual (and at the moment unique) > > > position of having to write a web application. I have quite a lot of > > > existing P

Re: getting the name of hyperlinks in a file

2007-01-15 Thread Laurent Rahuel
Hi, I guess you should take a look at BeautifulSoup (http://www.crummy.com/software/BeautifulSoup/). And take a clooser look at the findAll method. http://www.crummy.com/software/BeautifulSoup/documentation.html#The%20basic%20find%20method %20findAll(name,%20attrs,%20recursive,%20text,%20limit,%2

Problem with win32pipe.popen2

2007-01-15 Thread diego
I'm trying to understand how popen2 works. Found in this group, that popen2.popen2 can cause trouble so i chose win32pipe.popen2. have a look a the listing of 2 files: ekmain.py: ** import win32pipe (stdin1, stdout1) = win32pipe.popen2("test1.py") stdin1.write("1\n") print stdout1.rea

Mail System Error - Returned Mail

2007-01-15 Thread asn_update
The original message was received at Mon, 15 Jan 2007 12:44:10 +0200 from adobe.com [142.121.237.185] - The following addresses had permanent fatal errors - [email protected] - Transcript of session follows - ... while talking to 184.246.123.62: 554 ... Message is too large 5

Problem with findinf wx modules solved

2007-01-15 Thread siggi
I included the "...\wxDemos" path in PYTHONPATH. Everthing fine now! "siggi" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > "Tim Roberts" wrote: >>> >>>when I do >>>sys.path in IDLE (winXP), i get a horrendously long list of >>>paths, paths I may have used during a lot of tr

Re: Class list of a module

2007-01-15 Thread Laurent . LAFFONT-ST
> Looks rather simple to me... Anyway, you could avoid calling getattr > twice, if you iterate over vars(aModule).itervalues() > def getClassList(aModule): > return [cls for cls in vars(aModule).itervalues() > if inspect.isclass(cls)] > (And note that there is no need for using \ at the l

Re: Python web app. (advice sought)

2007-01-15 Thread Michele Simionato
Duncan Smith wrote: > Hello, > I find myself in the, for me, unusual (and at the moment unique) > position of having to write a web application. I have quite a lot of > existing Python code that will form part of the business logic. This > relies on 3rd party libraries (such as numpy) which

Re: python and MOV or MPEG

2007-01-15 Thread siggi
Diez B. Roggisch wrote: > siggi wrote: > >> Hi all, >> >> does Python support MPEG or MOV videoclips? I couldn't find anything >> about it online. > > Weak in googling today? Must have been a rough weekend. > > There are several options, including pymedia and pygame. > > Diez Thanks, Diez. I fo

Re: python and MOV or MPEG

2007-01-15 Thread Godson
On 1/15/07, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: siggi wrote: > Hi all, > > does Python support MPEG or MOV videoclips? I couldn't find anything about > it online. Weak in googling today? Must have been a rough weekend. There are several options, including pymedia and pygame. Diez --

Re: Python web app. (advice sought)

2007-01-15 Thread bruno . desthuilliers
Duncan Smith a écrit : > Hello, > I find myself in the, for me, unusual (and at the moment unique) > position of having to write a web application. I have quite a lot of > existing Python code that will form part of the business logic. This > relies on 3rd party libraries (such as numpy) wh

Re: indentation in python

2007-01-15 Thread Wolfgang Grafen
Dan Bishop wrote: > On Jan 13, 8:49 pm, "lee" <[EMAIL PROTECTED]> wrote: >> Can anyone tell me the basics about indentation in python..how we >> use it in loops and constructs..etc > > It's just like indentation in other languages, except that it's > syntactically required. > The indent r

Conditional validation of documents (ignoring IDREFs)

2007-01-15 Thread zgolus
I'm working with one extra large XML file which consists of many parts. Every part can be considered a stand-alone document with references to other parts (IDs and IDREFs). I would like to be able to validate every such part against a DTD but ignoring errors which arise from broken references. Can

Re: python and MOV or MPEG

2007-01-15 Thread Bjoern Schliessmann
siggi wrote: > Thanks, Diez. I forgot to mention that I am learning Python with > python 2.5 on WinXP. And both pymedia and pygame require somewhat > older versions of python, 1.3 and 2.4, respectively. 1.3? I've found both for 2.4, and in one site's forum some guy offers windows binaries for 2.

Re: python and MOV or MPEG

2007-01-15 Thread siggi
"Bjoern Schliessmann" wrote: > 1.3? I've found both for 2.4, and in one site's forum some guy > offers windows binaries for 2.5. The links, please! Thank you, siggi "Bjoern Schliessmann" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > siggi wrote: > >> Thanks, Diez. I fo

Re: Python web app. (advice sought)

2007-01-15 Thread Istvan Albert
Duncan Smith wrote: > I've had a look at Django, Turbogears and Plone, and at the moment I am > torn between Turbogears and Plone. I Plone is not suited for the type of application you are building (as others have pointed out in this thread). Take a second look at TurboGears (or CherryPy for t

check if there is data in stdin without blocking

2007-01-15 Thread hg
Hi, Is there a way ? ... select ? hg -- http://mail.python.org/mailman/listinfo/python-list

Re: How naive is Python?

2007-01-15 Thread skip
John> Sorry, Skip, but I find that very hard to believe. The foo() John> function would take quadratic time if it were merely adding on John> pieces of constant size -- however len(str(i)) is not a constant, John> it is O(log10(i)), so the time should be John> super-quadratic.

Default event handlers in wxPython

2007-01-15 Thread Tom Wright
Hi all I'm writing my first wxPython app and am having a problem with event handlers. I've set up a multi-part status bar and would like all the tooltips, menu help strings etc. to go into the second part of it. Is there some easy way of doing this? I've not found one, so have set up the follow

Re: check if there is data in stdin without blocking

2007-01-15 Thread hg
hg wrote: > Hi, > > Is there a way ? ... select ? > > > > hg PS: import sys import select l_r = select.select([sys.stdin],[],[],0) gives me: File "select.py", line 2, in ? import select File "/home/philippe/Desktop/select.py", line 4, in ? l_r = select.select([sys.stdin],[],[],0

Re: check if there is data in stdin without blocking

2007-01-15 Thread Laurent Pointal
hg a écrit : > hg wrote: > >> Hi, >> >> Is there a way ? ... select ? >> >> >> >> hg > PS: > > import sys > import select > > l_r = select.select([sys.stdin],[],[],0) > > gives me: > File "select.py", line 2, in ? > import select > File "/home/philippe/Desktop/select.py", line 4, in ? >

Re: check if there is data in stdin without blocking

2007-01-15 Thread hg
Laurent Pointal wrote: > hg a écrit : >> hg wrote: >> >>> Hi, >>> >>> Is there a way ? ... select ? >>> >>> >>> >>> hg >> PS: >> >> import sys >> import select >> >> l_r = select.select([sys.stdin],[],[],0) >> >> gives me: >> File "select.py", line 2, in ? >> import select >> File "/ho

Re: check if there is data in stdin without blocking

2007-01-15 Thread Paul Boddie
hg wrote: > import select [...] > File "/home/philippe/Desktop/select.py", line 4, in ? Consider which module Python is trying to import here: the standard library select module or your own program? Paul -- http://mail.python.org/mailman/listinfo/python-list

__getattr__ equivalent for a module

2007-01-15 Thread Maksim Kasimov
Hi, in any python class it is possible to define __getattr__ method so that if we try to get some value of not actually exists instance attribute, we can get some default value. For example: class MyClass: def __getattr__(self, attname): if attname.startswith('a'):

Re: Conflicting needs for __init__ method

2007-01-15 Thread Mark Dickinson
On Jan 14, 7:49 pm, "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > Mark wrote:[a lot of valid, but long concerns about types that return > an object of their own type from some of their methods] > > I think that the best solution is to use an alternative constructor > in your arithmetic methods. Th

Re: __getattr__ equivalent for a module

2007-01-15 Thread Leif K-Brooks
Maksim Kasimov wrote: > so my question is: how to tune up a module get default attribute if we > try to get access to not actually exists attribute of a module? You could wrap it in an object, but that's a bit of a hack. import sys class Foo(object): def __init__(self, wrapped): s

Re: Conflicting needs for __init__ method

2007-01-15 Thread Mark Dickinson
On Jan 14, 10:43 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 14 Jan 2007 15:32:35 -0800, dickinsm wrote: > > (You could include the normalization in __init__, but that's wasteful > Is it really? Have you measured it or are you guessing? Is it more or less > wasteful than any other so

Re: check if there is data in stdin without blocking

2007-01-15 Thread hg
Paul Boddie wrote: > hg wrote: >> import select > > [...] > >> File "/home/philippe/Desktop/select.py", line 4, in ? > > Consider which module Python is trying to import here: the standard > library select module or your own program? > > Paul Argh ;-) thanks -- http://mail.python

Re: How naive is Python?

2007-01-15 Thread skip
John> Sorry, Skip, but I find that very hard to believe. The foo() John> function would take quadratic time if it were merely adding on John> pieces of constant size -- however len(str(i)) is not a constant, John> it is O(log10(i)), so the time should be super-quadratic. me> S

Re: __getattr__ equivalent for a module

2007-01-15 Thread Maksim Kasimov
Hi Leif, many thanks - it works Leif K-Brooks wrote: > Maksim Kasimov wrote: >> so my question is: how to tune up a module get default attribute if we >> try to get access to not actually exists attribute of a module? > > You could wrap it in an object, but that's a bit of a hack. > > import s

Looking for Job

2007-01-15 Thread fhk6431
Hi, Any one looking for job.. I need someone good at phyton to do black box and white box testing Contact me at [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

catching signals in an object

2007-01-15 Thread hg
Hi, I need to catch a signal "SIGUSR1" in an object ... and I need the signal def that traps is to access the object context ... is that possible ? (*nix and windows) ex: class test: def __init__(self): self.Set_Signal() def Set_Signal(self): imp

Re: How naive is Python?

2007-01-15 Thread John Nagle
[EMAIL PROTECTED] wrote: > John> Sorry, Skip, but I find that very hard to believe. The foo() > John> function would take quadratic time if it were merely adding on > John> pieces of constant size -- however len(str(i)) is not a constant, > John> it is O(log10(i)), so the time shoul

Re: catching signals in an object

2007-01-15 Thread robert
hg wrote: > Hi, > > I need to catch a signal "SIGUSR1" in an object ... and I need the signal > def that traps is to access the object context ... is that possible ? > (*nix and windows) > > ex: > > class test: > def __init__(self): > self.Set_Signal() > > def S

can't get import to work!

2007-01-15 Thread corsairdgr
I am brand new to jython/python. I want to use my own Java class from within a Jython script. In Java, I created a class called Fubar and put this in a jar file called testit.jar. The Fubar class is in the just.for.fun package and this path shows up in the testit.jar file. I then modified

Segfault with tktreectrl on python-2.5 on linux

2007-01-15 Thread klappnase
Hello, I use the tktreectrl Tk extension (http://tktreectrl.sourceforge.net) through the python wrapper module (http://klappnase.zexxo.net/TkinterTreectrl/index.html). With python-2.5 it seems that each time some text is inserted into the treectrl widget a segfault occurs (on linux, on windows2000

compile your python programs with rpython

2007-01-15 Thread Simon Burton
The pypy'ers have written a brief description on using rpython to create standalone executables: http://codespeak.net/pypy/dist/pypy/doc/standalone-howto.html This is definately worth playing around with, it's very nice writing (r)python code that gets executed as if it were c code. Simon. --

Re: check if there is data in stdin without blocking

2007-01-15 Thread Gabriel Genellina
At Monday 15/1/2007 05:55, hg wrote: Well I'm testing under Linux but need support under Windows ... is there any way to poll stdin somehow under both plateform ? I think you may want this portable getch function: -- Gabriel Ge

Re: compile your python programs with rpython

2007-01-15 Thread Bjoern Schliessmann
Simon Burton wrote: > The pypy'ers have written a brief description on > using rpython to create standalone executables: > > http://codespeak.net/pypy/dist/pypy/doc/standalone-howto.html > > This is definately worth playing around with, it's very nice > writing (r)python code that gets executed

Re: Looking for Job

2007-01-15 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Any one looking for job.. I need someone good at phyton Sorry, you'll only sporadically find people competent with plants here. Regards, Björn -- BOFH excuse #83: Support staff hung over, send aspirin and come back LATER. -- http://mail.python.org/mailman/listin

Re: How can I integrate RPC with WSGI ???

2007-01-15 Thread Bruno Desthuilliers
வினோத் a écrit : > How can I integrate RPC You mean xmlrpc or Soap ? > with WSGI ??? > is any methods for it?? > What's your problem exactly ? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to write code to get focuse the application which is open from server

2007-01-15 Thread vithi
Dennis, I am sorry that was a typing error. I try like that app.Print.OK.Click() but it was not working. The printer window was not IdentifiedIs their any method I can use to achive the same goal. How the window title was used as class name?. Could you please help me to solve this problem. thanks t

Re: How to write code to get focuse the application which is open from server

2007-01-15 Thread vithi
Dennis, I am sorry that was a typing error. I try like that app.Print.OK.Click() but it was not working. The printer window was not IdentifiedIs their any method I can use to achive the same goal. How the window title was used as class name?. Could you please help me to solve this problem. thanks t

Re: Segfault with tktreectrl on python-2.5 on linux

2007-01-15 Thread Anton Hartl
Hi, On 2007-01-15, klappnase <[EMAIL PROTECTED]> wrote: > Some people sent me mail describing the same problem, so I think it is > not a problem with my installation of python-2.5. The treectrl widget > itself works well when running from Tcl or from python2.4, so i suspect > that it is a bug in

Re: How to write code to get focuse the application which is open from server

2007-01-15 Thread Gabriel Genellina
At Monday 15/1/2007 15:53, vithi wrote: I am sorry that was a typing error. I try like that app.Print.OK.Click() but it was not working. The printer window was not IdentifiedIs their any method I can use to achive the same goal. How the window title was used as class name?. Could you please help

Re: Type casting a base class to a derived one?

2007-01-15 Thread Frederic Rentsch
Chris Mellon wrote: > On 11 Jan 2007 15:01:48 +0100, Neil Cerutti <[EMAIL PROTECTED]> wrote: > >> On 2007-01-11, Frederic Rentsch <[EMAIL PROTECTED]> wrote: >> >>> If I derive a class from another one because I need a few extra >>> features, is there a way to promote the base class to the >

Re: check if there is data in stdin without blocking

2007-01-15 Thread hg
Gabriel Genellina wrote: > At Monday 15/1/2007 05:55, hg wrote: > >>Well I'm testing under Linux but need support under Windows ... is there >>any way to poll stdin somehow under both plateform ? > > I think you may want this portable getch function: >

Watch log

2007-01-15 Thread Salvatore Di Fazio
Hi guys, I've an application that writes a log file. I need to write an application with python that will read this file. I would like wait until a new line will be write in the file. Something like the "watch cat Log" command on Linux os. How can I check the eof and restart the reading? -- ht

Re: How naive is Python?

2007-01-15 Thread John Machin
[EMAIL PROTECTED] wrote: > John> Sorry, Skip, but I find that very hard to believe. The foo() > John> function would take quadratic time if it were merely adding on > John> pieces of constant size -- however len(str(i)) is not a constant, > John> it is O(log10(i)), so the time should b

Anyone has a nice "view_var" procedure ?

2007-01-15 Thread Stef Mientki
hello, Is there some handy/ nice manner to view the properties of some variable ? As a newbie, I often want to see want all the properties of a var, and also some corner values (large arrays) etc. Probably it's not so difficult, but I don't see how to distinguish for example between a string and

Re: Newbie - converting csv files to arrays in NumPy - Matlab vs. Numpy comparison

2007-01-15 Thread Travis E. Oliphant
oyekomova wrote: > Thanks to everyone for their excellent suggestions. I was able to > acheive the following results with all your suggestions. However, I am > unable to cross file size of 6 million rows. I would appreciate any > helpful suggestions on avoiding memory errors. None of the solutions

Re: Maths error

2007-01-15 Thread Rhamphoryncus
Nick Maclaren wrote: > The problem with it is that it is an unrealistically pessimal model, > and there are huge classes of algorithm that it can't handle at all; > anything involving iterative convergence for a start. It has been > around for yonks (I first dabbled with it 30+ years ago), and it

Re: Maths error

2007-01-15 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, "Rhamphoryncus" <[EMAIL PROTECTED]> writes: |> |> I've been experimenting with a fixed-point interval type in python. I |> expect many algorithms would require you to explicitly |> round/collapse/whatever-term the interval as they go along, essentially |> making i

Re: Watch log

2007-01-15 Thread Bjoern Schliessmann
Salvatore Di Fazio wrote: > I would like wait until a new line will be write in the file. > > Something like the "watch cat Log" command on Linux os. Why not read the file continuously and only do something if a new line is complete (i. e. a newline char is detected)? > How can I check the eof

Re: Watch log

2007-01-15 Thread Salvatore Di Fazio
Bjoern Schliessmann ha scritto: > Why not read the file continuously and only do something if a new > line is complete (i. e. a newline char is detected)? How can I read the file continuously? -- http://mail.python.org/mailman/listinfo/python-list

Re: Conflicting needs for __init__ method

2007-01-15 Thread Ben Finney
[EMAIL PROTECTED] writes: > Suppose you're writing a class "Rational" for rational numbers. The > __init__ function of such a class has two quite different roles to > play. That should be your first clue to question whether you're actually needing separate functions, rather than trying to force

ReportLab - Frames - Images

2007-01-15 Thread Chuck
I have been trying all day to get this to work. My complete code is below. I can get my text into the PDF, I can get my image in the PDF. What I can't get to work is frames so that the image (logo) appears to the right of the text. The image always appears first and then the text below on the next

download win32file

2007-01-15 Thread jim-on-linux
Where can I download win32file / win32ui? The links below are broken. Mark Hammond should be made aware of this. URL below has two links that send you no place http://mail.python.org/pipermail/python-list/2002-October/167638.html Links: http://starship.python.net/crew/mhammond/win32/Downlo

The curious behavior of integer objects

2007-01-15 Thread Jim B. Wilson
Am I nuts? Or only profoundly confused? I expected the this little script to print "0": class foo(int): def __init__(self, value): self = value & 0xF print foo(0x10) Instead, it prints "16" (at least on python 2.4.4 (Linux) and 2.5 (Wine). Jim Wilson GNV, FL -- http://mail.python.org/ma

Re: download win32file

2007-01-15 Thread hg
jim-on-linux wrote: > > > Where can I download win32file / win32ui? > > The links below are broken. Mark Hammond should > be made aware of this. > > > URL below has two links that send you no place > http://mail.python.org/pipermail/python-list/2002-October/167638.html > > > Links: > http:

whats wrong with my reg expression ?

2007-01-15 Thread Gert Cuykens
rex2=re.compile('^"(?P[^]*)"$',re.M) File "/usr/lib/python2.5/re.py", line 180, in compile return _compile(pattern, flags) File "/usr/lib/python2.5/re.py", line 233, in _compile raise error, v # invalid expression sre_constants.error: unexpected end of regular expression ? -- http:/

[ANN] Py2Py 0.0.1 - python code reformatter, initial dev release

2007-01-15 Thread Andrey Khavryuchenko
Folks, We release development preview snapshot of Py2Py code reformatter [1]. It is a byproduct of the PyBeast project aimed to create the python mutation tester. Now Py2Py code reformatter ignores all comments and 80-char line length requirement. Nevertheless, it produces the same AST as the or

Re: whats wrong with my reg expression ?

2007-01-15 Thread James Stroud
Gert Cuykens wrote: > rex2=re.compile('^"(?P[^]*)"$',re.M) > > File "/usr/lib/python2.5/re.py", line 180, in compile >return _compile(pattern, flags) > File "/usr/lib/python2.5/re.py", line 233, in _compile >raise error, v # invalid expression > sre_constants.error: unexpected end of reg

Re: The curious behavior of integer objects

2007-01-15 Thread Calvin Spealman
As it turns out, this has little to do with integers and the operations you are trying to do on them. I'll explain in more detail. Integers are immutable, which you may already know. This presents a problem with subclassing them and using the usual special method __init__, because the int object h

Re: The curious behavior of integer objects

2007-01-15 Thread Robert Kern
Jim B. Wilson wrote: > Am I nuts? Or only profoundly confused? I expected the this little script > to print "0": > > class foo(int): > def __init__(self, value): > self = value & 0xF That statement only rebinds the local name self to something else. It does not modify the object at all or

Re: The curious behavior of integer objects

2007-01-15 Thread Gabriel Genellina
At Monday 15/1/2007 19:28, Jim B. Wilson wrote: Am I nuts? Or only profoundly confused? I expected the this little script to print "0": class foo(int): def __init__(self, value): self = value & 0xF print foo(0x10) Instead, it prints "16" (at least on python 2.4.4 (Linux) and 2.5 (Wine).

Re: download win32file

2007-01-15 Thread jim-on-linux
On Monday 15 January 2007 10:37, hg wrote: > jim-on-linux wrote: > > Where can I download win32file / win32ui? > > > > The links below are broken. Mark Hammond > > should be made aware of this. > > > > > > URL below has two links that send you no > > place > > http://mail.python.org/pipermail/pyth

Re: whats wrong with my reg expression ?

2007-01-15 Thread Gabriel Genellina
At Monday 15/1/2007 19:41, Gert Cuykens wrote: rex2=re.compile('^"(?P[^]*)"$',re.M) [^set-of-forbidden-characters] -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías s

Re: download win32file

2007-01-15 Thread Bill Tydeman
?? Do I have to download pywin32 to get win32ui, or win32file, or win32api Yes -- There is no reason for any individual to have a computer in his home. Ken Olsen, President, Digital Equipment, 1977 US computer engineer & industrialist (1926 - ) -- http://mail.python.org/mailm

Re: download win32file

2007-01-15 Thread jim-on-linux
On Monday 15 January 2007 18:02, Bill Tydeman wrote: > > ?? Do I have to download pywin32 to get > > win32ui, or win32file, or win32api > > Yes Got it. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Anyone has a nice "view_var" procedure ?

2007-01-15 Thread Gabriel Genellina
At Monday 15/1/2007 17:45, Stef Mientki wrote: Is there some handy/ nice manner to view the properties of some variable ? As a newbie, I often want to see want all the properties of a var, and also some corner values (large arrays) etc. You can try dir(x), vars(x). If you want a "nice print",

Re: can't get import to work!

2007-01-15 Thread Gabriel Genellina
At Monday 15/1/2007 14:35, [EMAIL PROTECTED] wrote: from just.for.fun import Fubar This doesn't work. The following error is displayed: ImportError: No module named for You can't have a module named "for", it's a reserved word. Try using "For" instead (or any other legal name!). --

Re: ReportLab - Frames - Images

2007-01-15 Thread Robin Becker
Chuck wrote: > I have been trying all day to get this to work. My complete code is > below. I can get my text into the PDF, I can get my image in the PDF. > What I can't get to work is frames so that the image (logo) appears to > the right of the text. The image always appears first and then the te

Re: whats wrong with my reg expression ?

2007-01-15 Thread Gert Cuykens
thx PS i also cant figure out what is wrong here ? rex=re.compile('^"(?P[^"]*)"$',re.M) for v in l: v=rex.match(v).group('value') v=v.replace('""','"') return(l) v=rex.match(v).group('value') AttributeError: 'NoneType' object has no attribute '

Re: download win32file

2007-01-15 Thread hg
jim-on-linux wrote: > On Monday 15 January 2007 10:37, hg wrote: >> jim-on-linux wrote: >> > Where can I download win32file / win32ui? >> > >> > The links below are broken. Mark Hammond >> > should be made aware of this. >> > >> > >> > URL below has two links that send you no >> > place >> > http

Re: Anyone has a nice "view_var" procedure ?

2007-01-15 Thread Adam
Stef Mientki wrote: > hello, > > Is there some handy/ nice manner to view the properties of some variable ? > As a newbie, I often want to see want all the properties of a var, > and also some corner values (large arrays) etc. > > Probably it's not so difficult, > but I don't see how to distingui

Cygwin Python/PIL TCL/TK fork rebase solution

2007-01-15 Thread Ross Patterson
I recently was forced to build PIL under Cygwin Python 2.4.3 and ran into the Cygwin fork/rebase issue with TCL/TK yet again. Unfortunately, none of the rebase workarounds I found through my copious STFWing worked this time. Through trial and error I found that the following worked: rebase -b 0x1

Re: Problem with win32pipe.popen2

2007-01-15 Thread Gabriel Genellina
At Monday 15/1/2007 07:24, diego wrote: I'm trying to understand how popen2 works. Found in this group, that popen2.popen2 can cause trouble so i chose win32pipe.popen2. have a look a the listing of 2 files: ekmain.py: ** import win32pipe (stdin1, stdout1) = win32pipe.popen2("test1

Re: Conflicting needs for __init__ method

2007-01-15 Thread fumanchu
Steven D'Aprano wrote: > > class Rational(object): > > def __init__(self, numerator, denominator): > > print "lots of heavy processing here..." > > # processing ints, floats, strings, special case arguments, > > # blah blah blah... > > self.numerator = numerator

Re: whats wrong with my reg expression ?

2007-01-15 Thread Gabriel Genellina
At Monday 15/1/2007 20:43, Gert Cuykens wrote: PS i also cant figure out what is wrong here ? rex=re.compile('^"(?P[^"]*)"$',re.M) for v in l: v=rex.match(v).group('value') v=v.replace('""','"') return(l) v=rex.match(v).group('value') Attribu

Re: ReportLab - Frames - Images

2007-01-15 Thread Chuck
Thanks for the help. I made you changes but it still puts the picture above the text, not beside the text. I also found a user group at http://news.gmane.org/gmane.comp.python.reportlab.user . It may be the same. I have now posted there. Chuck -- http://mail.python.org/mailman/listinfo/python-l

Re: How naive is Python?

2007-01-15 Thread John Bauman
[EMAIL PROTECTED] wrote: > Actually, it isn't until I work my way back to 2.3 that I start to see > quadratic behavior: Yes, that's because the behavior was changed for 2.4, so it wouldn't be quadratic in this case. -- http://mail.python.org/mailman/listinfo/python-list

Can't find module named 'svn' in python

2007-01-15 Thread [EMAIL PROTECTED]
Hi, i have a simple test which tries to load 'svn' moddule. # python -c "from svn import client" Traceback (most recent call last): File "", line 1, in ? ImportError: No module named svn I have checked I have sub-directories 'libsvn', 'svn' under /usr/local/lib/svn-python/ cd /usr/local/lib/s

Re: Watch log

2007-01-15 Thread Larry Bates
Salvatore Di Fazio wrote: > Hi guys, > I've an application that writes a log file. > I need to write an application with python that will read this file. > > I would like wait until a new line will be write in the file. > > Something like the "watch cat Log" command on Linux os. > > How can I ch

Re: Anyone has a nice "view_var" procedure ?

2007-01-15 Thread Larry Bates
Stef Mientki wrote: > hello, > > Is there some handy/ nice manner to view the properties of some variable ? > As a newbie, I often want to see want all the properties of a var, > and also some corner values (large arrays) etc. > > Probably it's not so difficult, > but I don't see how to distingui

for v in l:

2007-01-15 Thread Gert Cuykens
is there a other way then this to loop trough a list and change the values i=-1 for v in l: i=i+1 l[i]=v+x something like for v in l: l[v]=l[v]+x -- http://mail.python.org/mailman/listinfo/python-list

Re: for v in l:

2007-01-15 Thread Nanjundi
Try: l = [i+x for i in l] OR l = map(lambda i: i+x, l) -N Gert Cuykens wrote: > is there a other way then this to loop trough a list and change the values > > i=-1 > for v in l: > i=i+1 > l[i]=v+x > > something like > > for v in l: >

Re: Can't find module named 'svn' in python

2007-01-15 Thread Nanjundi
My first thought: Check if you have /usr/local/lib/svn-python/ in your PYTHONPATH environment variable (echo $PYTHONPATH). If its missing, set it in the environment. export PYTHONPATH=$PYTHONPATH:/usr/local/lib/svn-python -N [EMAIL PROTECTED] wrote: > Hi, > > i have a simple test which tries to

Re: for v in l:

2007-01-15 Thread Gabriel Genellina
At Monday 15/1/2007 21:48, Gert Cuykens wrote: is there a other way then this to loop trough a list and change the values i=-1 for v in l: i=i+1 l[i]=v+x for i,value in enumerate(my_list): my_list[i] = compute_new_value(value) See the tutor

assert versus print [was Re: The curious behavior of integer objects]

2007-01-15 Thread Steven D'Aprano
On Mon, 15 Jan 2007 17:50:56 -0500, Calvin Spealman wrote: > assert foo(0x10) == 0 # Assertions are much better tests than prints :-) I dispute that assertion (pun intended). Firstly, print statements work even if you pass the -O (optimize) flag to Python. Your asserts don't. Secondly, a bare

  1   2   >