generator with subfunction calling yield

2006-09-27 Thread andy . leszczynski
Hi, I might understand why this does not work, but I am not convinced it should not - following: def nnn(): print 'inside' yield 1 def nn(): def _nn(): print 'inside' yield 1 print 'before' _nn() print 'after' for i in nnn(): print i for i in nn():

Re: HP open source printer drivers are in Python

2006-01-17 Thread Andy Leszczynski
Andy Leszczynski wrote: > I have a specific question, anybody is familiar? Just wanted to report, that problem is solved :-). But seriously, sorry for enigmatic question. I have had a very weird problem with HPLIP 0.97. Wanted to check out if there is someone familiar with the design of HP

HP open source printer drivers are in Python

2006-01-12 Thread Andy Leszczynski
I have a specific question, anybody is familiar? A. -- http://mail.python.org/mailman/listinfo/python-list

adding vectors

2005-12-19 Thread Andy Leszczynski
Hi, Short question: why (1,"abc",0.3)+(2,"def",10.2) != (3,"abcdef",10.5)? How to elegantly achieve (3,"abcdef",10.5) as a result of addition ... Andy -- http://mail.python.org/mailman/listinfo/python-list

Re: ?: in Python

2005-12-17 Thread Andy Leszczynski
Steven D'Aprano wrote: > On Wed, 14 Dec 2005 20:17:28 -0500, Andy Leszczynski wrote: > > >>I can tell you what is not elegant in the if else: approach. It is >>logically a one operation while you are forced to use varaible "a" >>twice. Fundamental f

Re: ?: in Python

2005-12-14 Thread Andy Leszczynski
Steven D'Aprano wrote: > On Wed, 14 Dec 2005 14:09:10 -0500, Andy Leszczynski wrote: > > >>How can do elegantly in Python: >> >>if condition: >>a=1 >>else: >>a=2 >> >>like in C: >> >>a=condition?1:2 > > &g

Re: ?: in Python

2005-12-14 Thread Andy Leszczynski
Lawrence Oluyede wrote: > Il 2005-12-14, Andy Leszczynski <[EMAIL PROTECTED]> ha scritto: > >>How can do elegantly in Python: >> >>if condition: >>a=1 >>else: >>a=2 >> >>like in C: >> >>a=condition?1:2 >> >

?: in Python

2005-12-14 Thread Andy Leszczynski
How can do elegantly in Python: if condition: a=1 else: a=2 like in C: a=condition?1:2 -- http://mail.python.org/mailman/listinfo/python-list

attaching to running python program with the debugger?

2005-12-13 Thread Andy Leszczynski
Hi, I have a program which somewhere gets into infinite look and take 100% of CPU. How can attach to it with the debugger to find out where it takes place? A. -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Oracle 9i client for Linux

2005-11-29 Thread Andy Leszczynski
Bernard Delmée wrote: > Look into the Oracle Instant Client: > > (might require a -free- OTN registration) It is version 10, would it be compatible with 9i servers? > Be sure to download the smallish "sdk" if you want

[OT] Oracle 9i client for Linux

2005-11-29 Thread Andy Leszczynski
Where can I find such? I can download from Oracle whole thing but no the client itself. Any insight? Thanks, A. -- http://mail.python.org/mailman/listinfo/python-list

pickle - recursion - stack size limit - MS windows

2005-11-05 Thread Andy Leszczynski
I need to pickle quite complex objects and first limitation was default 200 for the recursion. sys.setrecursionlimit helped, but still bigger objects fail to be pickled because of XP stack size limitation. Any idea how to get around the problem ... A. -- http://mail.python.org/mailman/listinfo/p

Re: Python vs Ruby

2005-10-26 Thread Andy Leszczynski
Amol Vaidya wrote: > Hi. I am interested in learning a new programming language, and have been > debating whether to learn Ruby or Python. How do these compare and contrast > with one another, and what advantages does one language provide over the > other? I would like to consider as many opinio

Re: Python vs Ruby

2005-10-26 Thread Andy Leszczynski
Steven D'Aprano wrote: > > Every line = more labour for the developer = more cost and time. > Every line = more places for bugs to exist = more cost and time. > The place I work at the creation rate is not a problem - we could crank out in the team 1000s lines a week. Most time we spend is on m

creating/altering the OpenOffice spredsheet docs

2005-10-26 Thread Andy Leszczynski
Any idea how to do that the way ActiveX would be used on M$? A. -- http://mail.python.org/mailman/listinfo/python-list

Re: TurboGears /.-ed, >new == True< or >new == "True"

2005-10-12 Thread Andy Leszczynski
Sybren Stuvel wrote: > Andy Leszczynski enlightened us with: > >>should not it be: >> >>2 def save(self, pagename, data, submit, new): >>3 hub.begin() >>4 if new == True: >>5 page = Page(pagename=pagename, data=data) >>6 else: >>7 pag

Re: piping out binaries properly

2005-10-11 Thread Andy Leszczynski
Mike Meyer wrote: > It's not normal to write binary content to stdout - you normally write Well, I grew up in the Unix world and it is normal over there. I am still curious which layer adds that 0xd. Is it python, cygwin, windows ... Thx for reply, Andy -- http://mail.python.org/mailman/listin

piping out binaries properly

2005-10-11 Thread Andy Leszczynski
I have got following program: import sys import binascii from string import * sys.stdout.write(binascii.unhexlify("41410A4141")) when I run under Unix I got: $ python u.py > u.bin $ od -t x1 u.bin 000 41 41 0a 41 41 and under Windows/Cygwin following: $ python u.py > u.bin $ od -t x1 u.bi

TurboGears /.-ed, >new == True< or >new == "True"

2005-10-11 Thread Andy Leszczynski
watch this: http://www.turbogears.org.nyud.net:8090/docs/wiki20/20MinuteWiki.mov or read this: http://www.turbogears.org.nyud.net:8090/docs/wiki2 0/page4.html should not it be: 2 def save(self, pagename, data, submit, new): 3 hub.begin() 4 if new == True: 5 page = Page(pagename=pagename, dat

RFC 1521 and missing binary Content-Transfer-Encoding in email module

2005-09-15 Thread Andy Leszczynski
Why email/Encoders.py is missing binary encoding. It should be there according to RFC 1521: encoding := "Content-Transfer-Encoding" ":" mechanism mechanism := "7bit" ; case-insensitive / "quoted-printable" / "base64" / "8bit"

Re: Manging multiple Python installation

2005-09-13 Thread Andy Leszczynski
Jeremy Jones wrote: > I guess I'm still having a hard time understanding "what does it > matter?". I was under impression that configure embeds the prefix in the build itself. I was concerned to have to preform the configure/make every time I change the destination path. It turns out that the

Re: Manging multiple Python installation

2005-09-07 Thread Andy Leszczynski
Robert Kern wrote: > Andy Leszczynski wrote: > >>Jeremy Jones wrote: >> >> >>>Andy Leszczynski wrote: >>> >>>Download the source, untar, cd to the new directory, run: >>> >>>./configure --prefix=/opt/mypython >>>make

Re: Manging multiple Python installation

2005-09-07 Thread Andy Leszczynski
Jeremy Jones wrote: > Andy Leszczynski wrote: > > Download the source, untar, cd to the new directory, run: > > ./configure --prefix=/opt/mypython > make > make install Is there any way to pass the prefix to the "make install"? Why "make" depends on tha

Manging multiple Python installation

2005-09-07 Thread Andy Leszczynski
Hi, I run Mandrake 10.0 with python 2.3 installed by default. I want to keep it as it is but need another, very customized Python installation based of 2.3 as well. I would prefer to have it the way it is on Windows, one folder e.g. /opt/mypython with all the stuff under that. It would be unlik

Re: Python supports LSP, does it?

2005-08-10 Thread Andy Leszczynski
Mike Meyer wrote: [...] > The wikipedia was really abusing the phrase LSP. I've corrected the > wikipedia. > http://mail.python.org/mailman/listinfo/python-list

Python supports LSP, does it?

2005-08-09 Thread Andy Leszczynski
wikipedia (http://en.wikipedia.org/wiki/Python_programming_language#Object-oriented_programming) says: """ Python's support for object oriented programming paradigm is vast. It supports polymorphism [...] fully in the Liskov substitution principle-sense for all objects. """ Just wondering if

Re: Berkely DB – many writers, many readers

2005-08-06 Thread Andy Leszczynski
Eric S. Johansson wrote: > Andy Leszczynski wrote: > >> >> I need to now option I open the Berkley DB (both db and env) to have >> configuration for multiple writers and multiple readers. Via multiple >> processes and multiple threads. No trx needed. > &g

Re: >time.strftime %T missing in 2.3

2005-08-04 Thread Andy Leszczynski
Robert Kern wrote: > Andy Leszczynski wrote: > >> Python 2.2/Unix >> >> >>time.strftime("%T") >> '22:12:15' >> >>time.strftime("%X") >> '22:12:17' >> >> Python 2.3/Windows >> &

>time.strftime %T missing in 2.3

2005-08-04 Thread Andy Leszczynski
Python 2.2/Unix >>time.strftime("%T") '22:12:15' >>time.strftime("%X") '22:12:17' Python 2.3/Windows >>time.strftime("%X") '22:12:47' >> time.strftime("%T") '' Any clues? A. -- http://mail.python.org/mailman/listinfo/python-list

Berkely DB – many writers, many rea ders

2005-07-07 Thread Andy Leszczynski
I need to now option I open the Berkley DB (both db and env) to have configuration for multiple writers and multiple readers. Via multiple processes and multiple threads. No trx needed. A. -- http://mail.python.org/mailman/listinfo/python-list

Python Challenge web site

2005-06-08 Thread Andy Leszczynski
Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit http://www.pythonchallenge.com/ anybody get to the level 30? :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: How do i read just the last line of a text file?

2005-05-29 Thread Andy Leszczynski
Chris F.A. Johnson wrote: > On Sun, 29 May 2005 at 05:57 GMT, John Machin wrote: > >>Chris F.A. Johnson wrote: >> >> >>>file = open(argv[1]) ## Open the file given on the command line >>>all_lines = file.readlines() ## Read all the lines >> >>I see your shadowing and raise you one obfusc

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Andy Leszczynski
gabor wrote: > the problem is: > what happens if 2 users invoke the cgi at the same time? Would BerkleyDB support that? -- http://mail.python.org/mailman/listinfo/python-list

how to import a module from a arbitraty path?

2005-05-25 Thread Andy Leszczynski
I have a program which is going to dynamicly load components from some arbitrary defined paths. How to do that? A. -- http://mail.python.org/mailman/listinfo/python-list

ldaptor based LDAP server

2005-05-19 Thread Andy Leszczynski
Hi, I am looking for a Python barebones for a simple LDAP server project. It does not have to be Twisted based, but it would be wonderful if it is. I need a very simple server which is listening on some port and accepts following LDAP messages: -bind -search -unbind There a

Getting a list of classes in the current module/auto introspection

2005-04-28 Thread Andy Leszczynski
Hi, I have a following problem. Let's say there is a module which could be imported or run as __main__. It is going to contain hundreds of classes, something like that: import moduleA from moduleB import * class A: pass class B: pass class C: pass [...] I would like to be

Re: How remove directories with the content in the platform independent way?

2005-04-28 Thread Andy Leszczynski
Jason Mobarak wrote: There's also the shutil module, which is platform independant. http://docs.python.org/lib/module-shutil.html ...see the rmtree function Thanks, this is what I was looking for. A. -- http://mail.python.org/mailman/listinfo/python-list

Re: How remove directories with the content in the platform independent way?

2005-04-26 Thread Andy Leszczynski
Andy Leszczynski wrote: James Stroud wrote: Look at the os and os.path modules. http://docs.python.org/lib/module-os.html http://docs.python.org/lib/module-os.path.html On Tuesday 26 April 2005 07:27 pm, so sayeth Andy Leszczynski: How remove directories with the content in the platform

Re: How remove directories with the content in the platform independent way?

2005-04-26 Thread Andy Leszczynski
James Stroud wrote: Look at the os and os.path modules. http://docs.python.org/lib/module-os.html http://docs.python.org/lib/module-os.path.html On Tuesday 26 April 2005 07:27 pm, so sayeth Andy Leszczynski: How remove directories with the content in the platform independent way? Is the API for

How remove directories with the content in the platform independent way?

2005-04-26 Thread Andy Leszczynski
How remove directories with the content in the platform independent way? Is the API for that? Thx, A. -- http://mail.python.org/mailman/listinfo/python-list

Re: SimpleHTTPRequestHandler handling long lasting requests problem

2005-03-13 Thread Andy Leszczynski
Steve Holden wrote: Andy Leszczynski wrote: Sorry for questioning Python :-) - it turned out that this is a problem with Mozilla. For some reason it holds up with opening second connection to given host until the previous one is completed. Interestingly enough, IE works better with Python multi

Re: SimpleHTTPRequestHandler handling long lasting requests problem

2005-03-11 Thread Andy Leszczynski
Sorry for questioning Python :-) - it turned out that this is a problem with Mozilla. For some reason it holds up with opening second connection to given host until the previous one is completed. Interestingly enough, IE works better with Python multi threaded server in that regard. Thx, A. --

looking for case insesitive dictionary

2005-03-09 Thread Andy Leszczynski
so e.g. x={} x['a']=1 x['A']=2 print x['a'] #prints 2 Thx, A. -- http://mail.python.org/mailman/listinfo/python-list

BaseHTTPServer.BaseHTTPRequestHandler and HTTP chunking

2005-03-09 Thread Andy Leszczynski
Does BaseHTTPServer.BaseHTTPRequestHandler support HTTP protocol chunking? Thanks, Andy -- http://mail.python.org/mailman/listinfo/python-list

SimpleHTTPRequestHandler handling long lasting requests problem

2005-03-09 Thread Andy Leszczynski
I need a HTTP server handling long lasting requests e.g. 10-30 seconds. Below is a pice of the code. In order to make the server reponsive while handling othere requests I use SocketServer.ThreadingMixIn. However the problem is the it does not work out. I checked thet a new thread is created fo

What e-mail list provides the best support for Twisted?

2005-03-02 Thread Andy Leszczynski
Thx, A. -- http://mail.python.org/mailman/listinfo/python-list

[Twisted] potential bug in the reactor's handling events loop

2005-03-01 Thread Andy Leszczynski
Python 2.3, one of the latest Twisted version: I noted that under Linux there is not way to Control-C the reactor loop. After digging a little I found that following change helpes: [EMAIL PROTECTED] internet]# diff base.py{,.ori} > 302d301 < print "1",sysEvtTriggers 305d303 < print "2

rounding problem

2005-02-23 Thread Andy Leszczynski
It is on Windows, Linux, Python 2.3: [GCC 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> a=1.1 >>> a 1.1001 >>> Is it normal? Andy -- http://mail.python.org/mailman/listinfo/python-list

wxPython 2.5 - bug in wx.Execute

2005-02-19 Thread Andy Leszczynski
Hi, I need a help with following problem which is blocking me quite seriously. I noted some weird behavior on Windows (Python 2.3, wxPython 2.5). The same code works fine under Linux. When using “pid = wx.Execute(cmd, wx.EXEC_ASYNC, self.process)” to spawn new wxPython based GUI program, the GUI

Re: wxPython demo /Process does not open new demo

2005-02-18 Thread Andy Leszczynski
Andy Leszczynski wrote: Try to run wxPython 2.5 (for python 2.3) demo. Then Open Process and Events/Process. Type in "python -u demo.py" and wait. There is a splash screen but nothing more. Why? Regards,A. Forgot to add that it happnes on Win2K. -- http://mail.python.org/mailman/listi

wxPython demo /Process does not open new demo

2005-02-18 Thread Andy Leszczynski
Try to run wxPython 2.5 (for python 2.3) demo. Then Open Process and Events/Process. Type in "python -u demo.py" and wait. There is a splash screen but nothing more. Why? Regards,A. -- http://mail.python.org/mailman/listinfo/python-list