Re: help: code formatter?

2007-01-08 Thread siggi
Bjoern wrote: > Why don't you just write one? :) Very funny! Just learning Python :( Regards, siggi > siggi wrote: > >> as a newbie I have problems with formatting code of downloaded >> programs, because IDLE's reformatting capabilities are limited . >> Incorrect indentation, mixing of TAB wi

Re: Why less emphasis on private data?

2007-01-08 Thread Andrea Griffini
Steven D'Aprano wrote: > That is total and utter nonsense and displays the most appalling > misunderstanding of probability, not to mention a shocking lack of common > sense. While I agree that the programming job itself is not a program and hence the "consider any possibility" simply doesn't mak

Re: private variables

2007-01-08 Thread belinda thom
I knew it was a beehive, but I had hoped someone would know which version they were released, so I can put the proper statement into my tutorial (e.g. In version , Python provided some support for private variables...). I've been avoiding getting stung b/c I see both sides and have no prefe

Re: Colons, indentation and reformatting. (2)

2007-01-08 Thread Paddy
Paul McGuire wrote: > "Paddy" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >I was just perusing a Wikipedia entry on the "off side rule" at > > http://en.wikipedia.org/wiki/Off-side_rule . > > It says that the colon in Python is purely for readability, and cites > > our FAQ ent

Re: How to write temporary data to file?

2007-01-08 Thread Thomas Ploch
Ravi Teja schrieb: > Thomas Ploch wrote: >> Ravi Teja schrieb: >>> Thomas Ploch wrote: Hi folks, I have a data structure that looks like this: d = { 'url1': { 'emails': ['a', 'b', 'c',...], 'matches': ['d', 'e', 'f',...] }, >>

Re: class unbound method and datetime.datetime.today()

2007-01-08 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Hi, I got confused when I learned the function datetime.today(). > > So far I learned, unless an instance is created, it is not possible to > call the class method. For example: > > class Foo: > def foo(self): > pass > > Foo.foo() # error: unbound method foo()

Re: Colons, indentation and reformatting. (2)

2007-01-08 Thread Paddy
[EMAIL PROTECTED] wrote: > Paddy wrote: > > I was just perusing a Wikipedia entry on the "off side rule" at > > http://en.wikipedia.org/wiki/Off-side_rule . > > It says that the colon in Python is purely for readability, and cites > > our FAQ entry > > http://www.python.org/doc/faq/general.html#w

Re: Recommendations (or best practices) to define functions (or methods)

2007-01-08 Thread Frank Millman
Diez B. Roggisch wrote: > > If you don't handle the exceptions, exactly what you seem to want will > happen - you will see the interpreter stop, and why. > > All you did was to take the unpythonic (and un-javaic and un-C#ic) road > to transform an exception to a returncode. But that has nothing to

Re: re.sub and re.MULTILINE

2007-01-08 Thread Paddy
nyenyec wrote: > I feel like a complete idiot but I can't figure out why re.sub won't > match multiline strings: > > This works: > >>> re.search("^foo", "\nfoo", re.MULTILINE) > <_sre.SRE_Match object at 0x6c448> > > This doesn't. No replacement: > >>> re.sub("^foo", "bar", "\nfoo", re.MULTILINE)

Re: Adding functions to classes after definition

2007-01-08 Thread Vasily Sulatskov
A nice guide to descriptors http://users.rcn.com/python/download/Descriptor.htm -- http://mail.python.org/mailman/listinfo/python-list

Re: How to write temporary data to file?

2007-01-08 Thread Ravi Teja
Thomas Ploch wrote: > Ravi Teja schrieb: > > Thomas Ploch wrote: > >> Hi folks, > >> > >> I have a data structure that looks like this: > >> > >> d = { > >>'url1': { > >>'emails': ['a', 'b', 'c',...], > >>'matches': ['d', 'e', 'f',...] > >>}, > >>'url2': {... >

Re: multi-threaded webcam with SimpleAsyncHTTPServer.py (updated)

2007-01-08 Thread Ray Schumacher
Better asyncore.loop use. Also fixes a late bug in my first post of code: PILFile.seek(0) needed since PIL.save does not reset the pointer. class ImageServer(RequestHandler): def __init__(self, conn, addr, server): asynchat.async_chat.__init__(self,conn) self.client_addres

Re: How to write temporary data to file?

2007-01-08 Thread Thomas Ploch
Ravi Teja schrieb: > Thomas Ploch wrote: >> Hi folks, >> >> I have a data structure that looks like this: >> >> d = { >> 'url1': { >> 'emails': ['a', 'b', 'c',...], >> 'matches': ['d', 'e', 'f',...] >> }, >> 'url2': {... >> } >> >> This dictionary will get _

Re: Colons, indentation and reformatting. (2)

2007-01-08 Thread Paul McGuire
"Paddy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I was just perusing a Wikipedia entry on the "off side rule" at > http://en.wikipedia.org/wiki/Off-side_rule . > It says that the colon in Python is purely for readability, and cites > our FAQ entry > http://www.python.org/doc/fa

Re: Colons, indentation and reformatting. (2)

2007-01-08 Thread [EMAIL PROTECTED]
Paddy wrote: > I was just perusing a Wikipedia entry on the "off side rule" at > http://en.wikipedia.org/wiki/Off-side_rule . > It says that the colon in Python is purely for readability, and cites > our FAQ entry > http://www.python.org/doc/faq/general.html#why-are-colons-required-fo... > . > Ho

Re: How to write temporary data to file?

2007-01-08 Thread Ravi Teja
Thomas Ploch wrote: > Hi folks, > > I have a data structure that looks like this: > > d = { > 'url1': { > 'emails': ['a', 'b', 'c',...], > 'matches': ['d', 'e', 'f',...] > }, > 'url2': {... > } > > This dictionary will get _very_ big, so I want to writ

class unbound method and datetime.datetime.today()

2007-01-08 Thread cinsky
Hi, I got confused when I learned the function datetime.today(). So far I learned, unless an instance is created, it is not possible to call the class method. For example: class Foo: def foo(self): pass Foo.foo() # error: unbound method foo(). What makes me confused is that datetime clas

Re: Recommendations (or best practices) to define functions (or methods)

2007-01-08 Thread Diez B. Roggisch
vizcayno schrieb: > Diez B. Roggisch ha escrito: > >> vizcayno schrieb: >>> Hello: >>> Need your help in the "correct" definition of the next function. If >>> necessary, I would like to know about a web site or documentation that >>> tells me about best practices in defining functions, especially

Re: private variables

2007-01-08 Thread Ravi Teja
belinda thom wrote: > Hello, > > In what version of python were private variables added? > > Thanks, > > --b Short answer - 1.5 (or - so long ago that it doesn't matter anymore) Long answer - There are no true private variables in Python. Just private variables names by convention. See Python do

Colons, indentation and reformatting. (2)

2007-01-08 Thread Paddy
I was just perusing a Wikipedia entry on the "off side rule" at http://en.wikipedia.org/wiki/Off-side_rule . It says that the colon in Python is purely for readability, and cites our FAQ entry http://www.python.org/doc/faq/general.html#why-are-colons-required-fo... . However, near the top of the A

Colons, indentation and reformatting.

2007-01-08 Thread Paddy
i was just perusing a Wikipedia entry on the "off side rule" at http://en.wikipedia.org/wiki/Off-side_rule . It says that the colon in Python is purely for readability, and cites our FAQ entry http://www.python.org/doc/faq/general.html#why-are-colons-required-for-the-if-while-def-class-statements

Re: private variables

2007-01-08 Thread Thomas Ploch
belinda thom schrieb: > Hello, > > In what version of python were private variables added? > > Thanks, > > --b > With this question you stepped into a bee hive. :-) Read the 'Why less emphasis on private data?' thread. But I can't tell you, when this so called 'private variables' were added.

private variables

2007-01-08 Thread belinda thom
Hello, In what version of python were private variables added? Thanks, --b -- http://mail.python.org/mailman/listinfo/python-list

Re: multi-threaded webcam with SimpleAsyncHTTPServer.py

2007-01-08 Thread Ray Schumacher
>>Question, though: how can I unblock asyncore.loop(), or at least be >>able to interrupt it? >Why do you want to do that? I was then thinking along the lines of a Netmeeting/visual chat program, rather than a daemon-type server, where one might want to terminate more quickly. Searching furth

Re: Getting started with Crystal Reports...little help in the far court.

2007-01-08 Thread Brian
Mudcat wrote: > I am not that familiar with Crystal Reports, but having read some other > posts I know that the way to integrate the API with Python is through > the COM interface provide by win32all. > Any pointers in the right direction would be helpful. Like Armury, I worked on Crystal stu

re.sub and re.MULTILINE

2007-01-08 Thread nyenyec
I feel like a complete idiot but I can't figure out why re.sub won't match multiline strings: This works: >>> re.search("^foo", "\nfoo", re.MULTILINE) <_sre.SRE_Match object at 0x6c448> This doesn't. No replacement: >>> re.sub("^foo", "bar", "\nfoo", re.MULTILINE) '\nfoo' Why? Thanks, nyenyec

re.sub and re.MULTILINE

2007-01-08 Thread nyenyec
I feel like a complete idiot but I can't figure out why re.sub won't match multiline strings: This works: >>> re.search("^foo", "\nfoo", re.MULTILINE) <_sre.SRE_Match object at 0x6c448> This doesn't. No replacement: >>> re.sub("^foo", "bar", "\nfoo", re.MULTILINE) '\nfoo' Why? Thanks, nyenyec

How to write temporary data to file?

2007-01-08 Thread Thomas Ploch
Hi folks, I have a data structure that looks like this: d = { 'url1': { 'emails': ['a', 'b', 'c',...], 'matches': ['d', 'e', 'f',...] }, 'url2': {... } This dictionary will get _very_ big, so I want to write it somehow to a file after it ha

Evolving doctests for changing output format

2007-01-08 Thread nriley
Hi, I've got a number of doctests which rely on a certain output format, and since I wrote the tests I've changed the output format. Now, almost all the tests fail. What I'd like is if I could get doctest to take my tests, and substitute the obtained output for the provided output. Then, I coul

Re: Parallel Python

2007-01-08 Thread Parallel Python The team
On 1/8/07, Laszlo Nagy <[EMAIL PROTECTED]> wrote: I always thought that if you use multiple processes (e.g. os.fork) then Python can take advantage of multiple processors. I think the GIL locks one processor only. The problem is that one interpreted can be run on one processor only. Am I not rig

Re: Fwd: Execute binary code

2007-01-08 Thread Chris Mellon
On 1/8/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > At Monday 8/1/2007 18:01, [EMAIL PROTECTED] wrote: > > >Chris Mellon wrote: > > > Writing to a temp file will be at least 3 times as easy and twice as > > > reliable as any other method you come up with. > > > >I'm not disputing that, but I

Re: Adding functions to classes after definition

2007-01-08 Thread Gabriel Genellina
At Monday 8/1/2007 21:47, Gerard Brunick wrote: Consider: A) >>> class C(object): ... pass ... >>> def f(*args): ... print args ... >>> C.f = f >>> C.f >>> c=C() >>> c.f() (<__main__.C object at 0x04A51170>,) And B) >>> del c >>> C.f = types.MethodType(f, None, C) >>> C.f

Re: Non-blocking pipes during subprocess handling

2007-01-08 Thread Gabriel Genellina
At Monday 8/1/2007 22:09, Tom Plunket wrote: I'm using subprocess to launch, well, sub-processes, but now I'm stumbling due to blocking I/O. Is there a way for me to know that there's data on a pipe, and possibly how much data is there so I can get it? Currently I'm doing this: Using a threa

Re: Network failure when using urllib2

2007-01-08 Thread Ravi Teja
[EMAIL PROTECTED] wrote: > I am fetching different web pages (never the same one) from a web > server. Does that make a difference with them trying to block me? > Also, if it was only that site blocking me, then why does the internet > not work in other programs when this happens in the script.

Non-blocking pipes during subprocess handling

2007-01-08 Thread Tom Plunket
I'm using subprocess to launch, well, sub-processes, but now I'm stumbling due to blocking I/O. Is there a way for me to know that there's data on a pipe, and possibly how much data is there so I can get it? Currently I'm doing this: process = subprocess.Popen( args,

Adding functions to classes after definition

2007-01-08 Thread Gerard Brunick
Consider: A) >>> class C(object): ... pass ... >>> def f(*args): ... print args ... >>> C.f = f >>> C.f >>> c=C() >>> c.f() (<__main__.C object at 0x04A51170>,) And B) >>> del c >>> C.f = types.MethodType(f, None, C) >>> C.f >>> c = C() >>> c.f() (<__main__.C object at 0

Re: Network failure when using urllib2

2007-01-08 Thread Gabriel Genellina
At Monday 8/1/2007 21:30, [EMAIL PROTECTED] wrote: I am fetching different web pages (never the same one) from a web server. Does that make a difference with them trying to block me? Also, if it was only that site blocking me, then why does the internet not work in other programs when this happ

Re: Bitwise expression

2007-01-08 Thread [EMAIL PROTECTED]
Gigs_ wrote: > Can someone explain me bitwise expression? > few examples for every expression will be nice > > x << y Left shift > x >> y Right shift > x & y Bitwise AND > x | y Bitwise OR > x ^ y Bitwise XOR (exclusive OR) > ~x Bitwise negation > > > thanks people Here's some examples: ##W

Re: Network failure when using urllib2

2007-01-08 Thread jdvolz
I am fetching different web pages (never the same one) from a web server. Does that make a difference with them trying to block me? Also, if it was only that site blocking me, then why does the internet not work in other programs when this happens in the script. It is almost like something is see

Re: Maths error

2007-01-08 Thread Dan Bishop
On Jan 8, 3:30 pm, Rory Campbell-Lange <[EMAIL PROTECTED]> wrote: > >>> (1.0/10.0) + (2.0/10.0) + (3.0/10.0) > 0.60009 > >>> 6.0/10.0 > 0.59998 > > Is using the decimal module the best way around this? (I'm expecting the first > sum to match the second). Probably not. Dec

Re: Network failure when using urllib2

2007-01-08 Thread Ravi Teja
[EMAIL PROTECTED] wrote: > I have a script that uses urllib2 to repeatedly lookup web pages (in a > spider sort of way). It appears to function normally, but if it runs > too long I start to get 404 responses. If I try to use the internet > through any other programs (Outlook, FireFox, etc.) it

Re: Maths error

2007-01-08 Thread Gabriel Genellina
At Monday 8/1/2007 19:20, Bjoern Schliessmann wrote: Rory Campbell-Lange wrote: > Is using the decimal module the best way around this? (I'm > expecting the first sum to match the second). It seem > anachronistic that decimal takes strings as input, though. [...] Also check the recent thread "b

Re: Fwd: Execute binary code

2007-01-08 Thread Gabriel Genellina
At Monday 8/1/2007 18:01, [EMAIL PROTECTED] wrote: Chris Mellon wrote: > Writing to a temp file will be at least 3 times as easy and twice as > reliable as any other method you come up with. I'm not disputing that, but I want to keep a piece of code (a parser for Oracle binary dumps, that I did

RE: File Closing Problem in 2.3 and 2.4, Not in 2.5

2007-01-08 Thread Carroll, Barry
John: <<> > > Hi Barry, > > Please always reply on-list if the communication is non-private -- and > meaningful :-) Right. I noticed I hadn't "replied-to-all", so I resent the post to the mailing list. Slip of the mouse, no disrespect intended to the list ;^) > > I don't know; here are som

Re: Execute binary code

2007-01-08 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > The code I try to execute is Windows specific and it is binary, > not python. Furthermore, it is stored in a variable within the > parent python script, not stored on harddisk as a file. Sure, I just wanted to show that your special application is not specific for troja

tkinter with wck

2007-01-08 Thread [EMAIL PROTECTED]
I am playing around with this code but I am having trouble getting my x to be bigger it only seems to redraw when it becomes smaller than the original size up to full size (in ui_handle_repair). At other window sizes it just seems to center it.. I tried playing around with resize but never got th

error with "import md5"

2007-01-08 Thread John Pye
Hi all, I'm doing some convoluted stuff with running a python script from inside a shared library that's running inside a Tcl/Tk interpreter. It's all been going surprisingly well, up until the point where my Python script attempts to import matplotlib, which includes a reference to import md5:

Re: Getting started with Crystal Reports...little help in the far court.

2007-01-08 Thread Amaury Forgeot d'Arc
Good evening, Mudcat a écrit : > I am not that familiar with Crystal Reports, but having read some other > posts I know that the way to integrate the API with Python is through > the COM interface provide by win32all. > > However, I have been unable to find any other information on how to get > s

Re: Why less emphasis on private data?

2007-01-08 Thread sturlamolden
Jussi Salmela wrote: > To surlamolden: I don't know how you define private, but if one defines > in C an external static variable i.e. a variable outside any functions, > on the file level, the scope of the variable is that file only. Sure, in C you can hide instances inside an object image by d

Re: Execute binary code

2007-01-08 Thread citronelu
Bjoern Schliessmann wrote: > But you could technically achieve this with standard python too > (just write python source and spawn a python process executing it). The code I try to execute is Windows specific and it is binary, not python. Furthermore, it is stored in a variable within the parent

RE: File Closing Problem in 2.3 and 2.4, Not in 2.5

2007-01-08 Thread Carroll, Barry
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of John Machin > Sent: Saturday, January 06, 2007 11:09 PM > To: python-list@python.org > Subject: Re: File Closing Problem in 2.3 and 2.4, Not in 2.5 > > Martin v. Löwis wrote: > > Carroll, Barry

Re: File Closing Problem in 2.3 and 2.4, Not in 2.5

2007-01-08 Thread John Machin
On 9/01/2007 8:25 AM, Carroll, Barry wrote: >> -Original Message- >> From: [EMAIL PROTECTED] [mailto:python- >> [EMAIL PROTECTED] On Behalf Of John Machin >> Sent: Saturday, January 06, 2007 11:09 PM >> To: python-list@python.org >> Subject: Re: File Closing Problem in 2.3 and 2.4, Not in 2

Re: how to find the longst element list of lists

2007-01-08 Thread Steven D'Aprano
On Mon, 08 Jan 2007 13:55:40 +0100, Peter Otten wrote: >> The precise results depend on the version of Python you're running, the >> amount of memory you have, other processes running, and the details of >> what's in the list you are trying to sort. But as my test shows, sort has >> some overhead

Re: Why less emphasis on private data?

2007-01-08 Thread Steven D'Aprano
On Mon, 08 Jan 2007 13:11:14 +0200, Hendrik van Rooyen wrote: > When you hear a programmer use the word "probability" - > then its time to fire him, as in programming even the lowest > probability is a certainty when you are doing millions of > things a second. That is total and utter nonsense

Re: Execute binary code

2007-01-08 Thread Bjoern Schliessmann
Larry Bates wrote: > What you are asking is a virus/trojan "like" program. Why? For being a trojan horse it must fake something. For being a virus it must replicate itself. Writing an executable doesn't imply the will to replicate itself. But you could technically achieve this with standard pyt

Re: Maths error

2007-01-08 Thread Bjoern Schliessmann
Rory Campbell-Lange wrote: > Is using the decimal module the best way around this? (I'm > expecting the first sum to match the second). It seem > anachronistic that decimal takes strings as input, though. What's your problem with the result, or what's your goal? Such precision errors with floatin

Getting started with Crystal Reports...little help in the far court.

2007-01-08 Thread Mudcat
I am not that familiar with Crystal Reports, but having read some other posts I know that the way to integrate the API with Python is through the COM interface provide by win32all. However, I have been unable to find any other information on how to get started. I've used the COM interface before i

Re: Bitwise expression

2007-01-08 Thread Richard Townsend
On Mon, 08 Jan 2007 22:32:12 +0100, Gigs_ wrote: > Can someone explain me bitwise expression? > few examples for every expression will be nice > http://wiki.python.org/moin/BitwiseOperators -- Richard -- http://mail.python.org/mailman/listinfo/python-list

Re: Maybe a little bug of ipython 0.7.3 ?

2007-01-08 Thread Fernando Perez
[EMAIL PROTECTED] wrote: > I'm new to ipython, and i found it a very cool product. Glad you like it, though in the future I recommend you post on the ipython list. I very rarely scan c.l.py these days, unfortunately. > $ ipython > Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit

Maths error

2007-01-08 Thread Rory Campbell-Lange
>>> (1.0/10.0) + (2.0/10.0) + (3.0/10.0) 0.60009 >>> 6.0/10.0 0.59998 Is using the decimal module the best way around this? (I'm expecting the first sum to match the second). It seem anachronistic that decimal takes strings as input, though. Help much appreciated; Rory --

Network failure when using urllib2

2007-01-08 Thread jdvolz
I have a script that uses urllib2 to repeatedly lookup web pages (in a spider sort of way). It appears to function normally, but if it runs too long I start to get 404 responses. If I try to use the internet through any other programs (Outlook, FireFox, etc.) it will also fail. If I stop the scri

Bitwise expression

2007-01-08 Thread Gigs_
Can someone explain me bitwise expression? few examples for every expression will be nice x << y Left shift x >> y Right shift x & y Bitwise AND x | y Bitwise OR x ^ y Bitwise XOR (exclusive OR) ~x Bitwise negation thanks people -- http://mail.python.org/mailman/listinfo/python-list

Re: Fwd: Execute binary code

2007-01-08 Thread citronelu
Chris Mellon wrote: > Writing to a temp file will be at least 3 times as easy and twice as > reliable as any other method you come up with. I'm not disputing that, but I want to keep a piece of code (a parser for Oracle binary dumps, that I didn't wrote) out of foreign hands, as much as possible.

Re: Recommendations (or best practices) to define functions (or methods)

2007-01-08 Thread Bruno Desthuilliers
vizcayno a écrit : > Hello: > Need your help in the "correct" definition of the next function. If > necessary, I would like to know about a web site or documentation that > tells me about best practices in defining functions, especially for > those that consider the error exceptions management. > I

Fwd: Execute binary code

2007-01-08 Thread Chris Mellon
On 8 Jan 2007 12:45:45 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Larry Bates wrote: > > > What you are asking is a virus/trojan "like" program. There's no reason > > you shouldn't be able to write the code to TEMP directory and execute it. > > > > -Larry > > > No, it is not about a tro

Re: Execute binary code

2007-01-08 Thread citronelu
Larry Bates wrote: > What you are asking is a virus/trojan "like" program. There's no reason > you shouldn't be able to write the code to TEMP directory and execute it. > > -Larry No, it is not about a trojan, but I guess it's pointless to try to convince you otherwise. It's not about being ab

Re: Why less emphasis on private data?

2007-01-08 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Wow, I got a lot more feedback than I expected! > > I can see both sides of the argument, both on technical merits, and > more philosophical merits. When I first learned C++ I felt > setters/getters were a waste of my time and extra code. When I moved > to C# I stil

Re: Traceback of hanged process

2007-01-08 Thread Mike C. Fletcher
Klaas wrote: > Hynek Hanke wrote: > >> Hello, >> >> please, how do I create a pythonic traceback from a python process that >> hangs and is not running in an interpreter that I executed manually >> or it is but doesn't react on CTRL-C etc? I'm trying to debug a server >> implemented in Python, s

Re: Execute binary code

2007-01-08 Thread olsongt
[EMAIL PROTECTED] wrote: > Is it possible to execute a binary string stored within a python script > as executable code ? > > The script is run under Windows, and the binary code (a full executable > file) is stored in a variable in the script. > > I know I can use os.system() or os.popen() to run

Re: Working with Excel inside Python

2007-01-08 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Sorry for my little knowledge on Python. Actually my knowledge is > specific for automating geo-processing tasks within ESRI environment, > but sometimes I need to automate some other tasks (like this one) which > require more in-depth knowledge of this language. I wo

Re: Working with Excel inside Python

2007-01-08 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Or, you might want to look at two packages: > > xlrd > > pyExcelerator > > The first can "read" .xls files, and the second can write them. I've had > great results with both. That's fine, but since the OP is mainly using Excel for reformating a csv file and savin

Re: Execute binary code

2007-01-08 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Is it possible to execute a binary string stored within a python script > as executable code ? > > The script is run under Windows, and the binary code (a full executable > file) is stored in a variable in the script. > > I know I can use os.system() or os.popen() to ru

Re: Traceback of hanged process

2007-01-08 Thread Klaas
Hynek Hanke wrote: > Hello, > > please, how do I create a pythonic traceback from a python process that > hangs and is not running in an interpreter that I executed manually > or it is but doesn't react on CTRL-C etc? I'm trying to debug a server > implemented in Python, so I need some analog of 'g

Re: Bizarre floating-point output

2007-01-08 Thread Bjoern Schliessmann
Nick Maclaren wrote: > Not at all. "Precision" has been used to indicate the number of > digits after the decimal point for at least 60 years, Not only, remember: Computer memories can't think in powers of ten. > probably 100; in 40 years of IT and using dozens of programming > languages, I ha

Re: newbieee

2007-01-08 Thread Bjoern Schliessmann
lee wrote: > I getting familiarised with python...can any one suggest me a good > editor available for python which runs on windows xp Look here: http://wiki.python.org/moin/PythonEditors > one more request guys...can nyone tell me a good reference manual > for python.. Either the python ho

Re: newbieee

2007-01-08 Thread Daniel Klein
On 8 Jan 2007 10:59:23 -0800, "Thomas Nelson" <[EMAIL PROTECTED]> wrote: >O'reilly has a book called Programming Python that covers much of the >standard library and how to use it for complex tasks. It may be out of >date by now, though. Programming Python (by Mark Lutz) is now in it's 3rd edi

Execute binary code

2007-01-08 Thread citronelu
Is it possible to execute a binary string stored within a python script as executable code ? The script is run under Windows, and the binary code (a full executable file) is stored in a variable in the script. I know I can use os.system() or os.popen() to run an external file, but these functions

Re: More Efficient fnmatch.fnmatch for multiple patterns?

2007-01-08 Thread Gabriel Genellina
At Monday 8/1/2007 15:55, Wojciech =?ISO-8859-2?Q?Mu=B3a?= wrote: pats = re.compile('|'.join(fnmatch.translate(p) for p in patterns)) Hmm, fnmatch.translate does not appear in the docs. But it does on the module docstring, and in __all__, so certainly it's supposed to be public. I'll file a

Re: Suitability for long-running text processing?

2007-01-08 Thread tsuraan
I remember something about it coming up in some of the discussions of free lists and better behavior in this regard in 2.5, but I don't remember the details. Under Python 2.5, my original code posting no longer exhibits the bug - upon calling del(a), python's size shrinks back to ~4 MB, which i

Re: Q: About a programming problem with Python!

2007-01-08 Thread Tim Peters
[followups set to comp.lang.python] [Danny] > I am just getting into OOP using Python and > because of the floating point of large integer (L) > square roots all the decimal expansions are truncated. > This has created a problem because I need these > decimal expansions in my algorithm other wise

Re: Why less emphasis on private data?

2007-01-08 Thread [EMAIL PROTECTED]
Wow, I got a lot more feedback than I expected! I can see both sides of the argument, both on technical merits, and more philosophical merits. When I first learned C++ I felt setters/getters were a waste of my time and extra code. When I moved to C# I still felt that, and with their 'Property" s

Re: recursive function

2007-01-08 Thread Max Erickson
"cesco" <[EMAIL PROTECTED]> wrote: > Hi, > > I have a dictionary of lists of tuples like in the following > example: dict = {1: [(3, 4), (5, 8)], > 2: [(5, 4), (21, 3), (19, 2)], > 3: [(16, 1), (0, 2), (1, 2), (3, 4)]] > > In this case I have three lists inside the dict but this

Re: newbieee

2007-01-08 Thread Thomas Nelson
lee wrote: > I getting familiarised with python...can any one suggest me a good > editor available for python which runs on windows xpone more > request guys...can nyone tell me a good reference manual for python.. I think vim is a very good editor for python, and it's certainly available for

Re: Why less emphasis on private data?

2007-01-08 Thread Neil Cerutti
On 2007-01-08, Jussi Salmela <[EMAIL PROTECTED]> wrote: > Neil Cerutti kirjoitti: >> In C one uses the pointer to opaque struct idiom to hide data. >> For example, the standard FILE pointer. > > To Neil Cerutti: If a programmer in C has got a pointer to some > piece of memory, that piece is at the

Re: Recommendations (or best practices) to define functions (or methods)

2007-01-08 Thread vizcayno
Thank you for your guidelines and for changing my mind. I am trying to do my best in generating good code and, in that attempt ... I only know that nothing know. Regards. -- http://mail.python.org/mailman/listinfo/python-list

Re: More Efficient fnmatch.fnmatch for multiple patterns?

2007-01-08 Thread Wojciech Muła
abcd wrote: > I am using fnmatch.fnmatch to find some files. The only problem I have > is that it only takes one pattern...so if I want to search using > multiple patterns I have to do something like > > patterns = ['abc*.txt', 'foo*'] > > for p in patterns: > if fnmatch.fnmatch(some_file

Re: More Efficient fnmatch.fnmatch for multiple patterns?

2007-01-08 Thread Gabriel Genellina
At Monday 8/1/2007 15:10, abcd wrote: I am using fnmatch.fnmatch to find some files. The only problem I have is that it only takes one pattern...so if I want to search using multiple patterns I have to do something like patterns = ['abc*.txt', 'foo*'] for p in patterns: if fnmatch.fnm

Re: Why less emphasis on private data?

2007-01-08 Thread Paul Boddie
Chris Mellon wrote: > Private data in the C++ and Java OO worlds is so taught so much and > emphasized so often that people have started thinking of it as being > desirable for its own sake. But the primary motivation for it grew out > of the need to maintain compatible interfaces. This is general

Re: Module to read svg

2007-01-08 Thread Martin v. Löwis
Robert Kern schrieb: >>> Does anyone know if there's an actual free implementation of this? >> For the dom module in it, xml.dom.minidom should work. Depending on >> your processing needs, that might be sufficient. > > I don't think it quite fits what the OP is asking for. SVG defines some > non-

Re: More Efficient fnmatch.fnmatch for multiple patterns?

2007-01-08 Thread Brian Beck
abcd wrote: > I am using fnmatch.fnmatch to find some files. The only problem I have > is that it only takes one pattern...so if I want to search using > multiple patterns I have to do something like > > patterns = ['abc*.txt', 'foo*'] > > for p in patterns: > if fnmatch.fnmatch(some_fil

Re: Bizarre floating-point output

2007-01-08 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, "Ziga Seilnacht" <[EMAIL PROTECTED]> writes: |> |> There was a recent bug report identical to your complaints, which |> was closed as invalid. The rationale for closing it was that things |> like: |> |> print ("a, bc", "de f,", "gh), i") |> |> would be extremely

Re: recursive function

2007-01-08 Thread Tim Williams
On 8 Jan 2007 16:03:53 +0100, Neil Cerutti <[EMAIL PROTECTED]> wrote: > > len(dict.keys()). > Or len(dict) :) -- http://mail.python.org/mailman/listinfo/python-list

newbieee

2007-01-08 Thread lee
I getting familiarised with python...can any one suggest me a good editor available for python which runs on windows xpone more request guys...can nyone tell me a good reference manual for python.. -- http://mail.python.org/mailman/listinfo/python-list

Re: recursive function

2007-01-08 Thread bearophileHUGS
First possible solution: def rloop(seqin, comb): # xcross product recipe 302478 by David Klaffenbach if seqin: for item in seqin[0]: newcomb = comb + [item] for item in rloop(seqin[1:], newcomb): yield item else: yield comb data

Re: xmlrpc and auth-digest

2007-01-08 Thread Laszlo Nagy
Thomas Liesner írta: > Hi all, > > this may have been asked before, but as a newbie with xmlrpc i can't > find any suitable info on that. Sorry. > I am trying to write a simple xmlrpc-client in python and the server i > am trying to receive data from requires http auth digest. > The info on xmlrpcl

Re: Bizarre floating-point output

2007-01-08 Thread Ziga Seilnacht
Nick Maclaren wrote: > Well, it's not felt necessary to distinguish those at top level, so > why should it be when they are in a sequence? Well, this probably wasn't the best example, see the links below for a better one. > But this whole thing is getting ridiculous. The current implementation

More Efficient fnmatch.fnmatch for multiple patterns?

2007-01-08 Thread abcd
I am using fnmatch.fnmatch to find some files. The only problem I have is that it only takes one pattern...so if I want to search using multiple patterns I have to do something like patterns = ['abc*.txt', 'foo*'] for p in patterns: if fnmatch.fnmatch(some_file_name, p): return T

Re: Why less emphasis on private data?

2007-01-08 Thread Chris Mellon
Private data in the C++ and Java OO worlds is so taught so much and emphasized so often that people have started thinking of it as being desirable for its own sake. But the primary motivation for it grew out of the need to maintain compatible interfaces. These languages rely on a great deal of shar

Re: Bizarre floating-point output

2007-01-08 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, Bjoern Schliessmann <[EMAIL PROTECTED]> writes: |> |> > The use of different precisions for the two cases is not, however, |> > and it is that I was and am referring to. |> |> You mistake "precision" with "display". Not at all. "Precision" has been used to indi

Re: Bizarre floating-point output

2007-01-08 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, "Ziga Seilnacht" <[EMAIL PROTECTED]> writes: |> |> > I think that you should. Where does it say that tuple's __str__ is |> > the same as its __repr__? |> > |> > The obvious interpretation of the documentation is that a sequence |> > type's __str__ would call __str

  1   2   3   >