Re: eof

2007-11-23 Thread greg
Hendrik van Rooyen wrote: > So he can't even help himself by setting his > own EOF attribute to False initially, and > to True when he sees an empty string. > > Is there a reason for this Bondage style? There's a fair amount of overhead associated with providing the ability to set arbitrary attri

Re: python class methods identity?

2007-11-23 Thread limodou
On Nov 23, 2007 4:06 PM, Roc Zhou <[EMAIL PROTECTED]> wrote: > This is the result comes from the Linux. > > And the result from Windows is: > > >>> class Test: > var = 1 > def func(self): pass > >>> x = Test() > >>> y = Test() > >>> x.var is y.var > True > >>> x.func is y.func > False > >>>

Re: foldr function in Python

2007-11-23 Thread Ant
On Nov 22, 7:14 pm, oj <[EMAIL PROTECTED]> wrote: > On Nov 22, 3:02 pm, Ant <[EMAIL PROTECTED]> wrote: ... > It's basically just one line to implement: > > foldr = lambda f, i: lambda s: reduce(f, s, i) > > It's just reduce with currying, I'm not sure it adds that much to what > python already offe

Re: Function stopping a function

2007-11-23 Thread Duncan Booth
Sorin Schwimmer <[EMAIL PROTECTED]> wrote: > For instance, lenghty_function() executes, when an > external event triggers cancel(), which is supposed to > abruptly stop lengthy_function(), reset some variables > and exit immediately. > def lenghty_function(some, arguments, abort=lambda: False):

Re: Qt Designer required for PyQt?

2007-11-23 Thread Phil Thompson
On Friday 23 November 2007, Kevin Walzer wrote: > is it possible to write the GUI code for PyQt applications by hand or > is using the Qt Designer an essential part of the process? Coming from a > Tkinter background, with a little exposure to wxPython, I'm very > comfortable and productive writin

Re: eof

2007-11-23 Thread MonkeeSage
On Nov 22, 11:04 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > I think it's too low level, and so doesn't do what naive users > expect. It's really only useful, even in C, as part of the > forensic study of a stream in an error state, [...] Indeed. I just wrote a little implementation of an IPS p

Re: python class methods identity?

2007-11-23 Thread Roc Zhou
This is the result comes from the Linux. And the result from Windows is: >>> class Test: var = 1 def func(self): pass >>> x = Test() >>> y = Test() >>> x.var is y.var True >>> x.func is y.func False >>> id(x.var) 11228488 >>> id(y.var) 11228488 >>> id(x.func) 14430976 >>> id(y.func) 144336

Re: Qt Designer required for PyQt?

2007-11-23 Thread Yorgos Pagles
Hi Kevin, designer is not required for producing your UI, you can code it by hand. The are examples in both the C++ distribution of Qt and PyQt on how to do so but it is pretty straightforward, especially since you have a background on other GUI toolkits. My general approach is to create the "fanc

Re: Next float?

2007-11-23 Thread Hendrik van Rooyen
"Steven D'Aprano" wrote: > Damn, I don't remember writing that! It is caused by drinking too much Alzheimer's Light. : - ) - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing event handler for dropdown list in python

2007-11-23 Thread M�ta-MCI (MVP)
Hi! Please, specify which way you chose, for Python (client-side): wxpython, active-scripting, qt, pluie, other... @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: may be a bug in string.rstrip

2007-11-23 Thread Sion Arrowsmith
Scott SA <[EMAIL PROTECTED]> wrote: >>>> string.replace('120.exe','.exe','') >'120' Don't use string.replace(), use the replace method of strings: >>> '120.exe'.replace('.exe', '') '120' >... but it has a side-effect of mid-string replacements: > >>>> string.replace('123.exe.more','.

Re: Python too complex ?!?!?!

2007-11-23 Thread Toni Mueller
[EMAIL PROTECTED] wrote: > On Nov 17, 8:25 am, Donn Ingle <[EMAIL PROTECTED]> wrote: >> If you are online and the app runs, it can check the "freshness" of your >> modules (those called from the app and recursively) and offer to fetch the >> latest stable versions. >> > > Something similar to Java

Re: may be a bug in string.rstrip

2007-11-23 Thread Scott SA
On 11/23/07, Bruno Desthuilliers ([EMAIL PROTECTED]) wrote: >> The better option, IMO, is probably to use regex. > >You forgot at least the simplest solution: > >import os.path >os.path.splitext('132.ext')[0] Yes, I did miss that one... and while I was typing there was a nagging feeling I was m

Re: Python too complex ?!?!?!

2007-11-23 Thread Chris Mellon
On Nov 22, 2007 3:04 PM, Brian <[EMAIL PROTECTED]> wrote: > / Chime Mode > I have, in fact, sent this thread to my friend. > His limiting factors are > > - money-control people favor MS platforms > - C# and VS have minimal cost impact for academia > - sys admins have everything locked down (proba

Re: python class methods identity?

2007-11-23 Thread Bruno Desthuilliers
Chris Mellon a écrit : > On Nov 23, 2007 1:29 AM, Roc Zhou <[EMAIL PROTECTED]> wrote: (snip) >>Since both "var" and "func" are the variable of the class object, and > > "members", not variables. > "attributes", not members !-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Extracting data from dump file

2007-11-23 Thread John Machin
On Nov 24, 5:46 am, TYR <[EMAIL PROTECTED]> wrote: > I have a large dump file that originated in a MySQL db; I need to get > it into an SQLite file. > > Various options are suggested around the web; none of them seem to > work (most failing to import the thing in the first place). So I > removed th

Re: Clean way to get one's network IP address?

2007-11-23 Thread Steven D'Aprano
On Fri, 23 Nov 2007 08:52:58 -0800, [EMAIL PROTECTED] wrote: > On Nov 21, 5:34 pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> On Wed, 21 Nov 2007 12:00:52 -0500, Joe Riopel wrote: >> > On Nov 21, 2007 10:15 AM, Gilles Ganault <[EMAIL PROTECTED]> wrote: >> >> I know about so

Re: Problems with if/elif statement syntax

2007-11-23 Thread Ricardo Aráoz
[EMAIL PROTECTED] wrote: > On Nov 22, 12:33 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >> On 22 Nov, 12:09, Neil Webster <[EMAIL PROTECTED]> wrote: >> >> >> >>> Hi all, >>> I'm sure I'm doing something wrong but after lots of searching and >>> reading I can't work it out and was wondering i

Re: the annoying, verbose self

2007-11-23 Thread BJörn Lindqvist
On Nov 23, 2007 11:54 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 23 Nov 2007 23:38:24 +, BJörn Lindqvist > wrote: > > > I like that a lot. This saves 12 characters for the original example and > > removes the need to wrap it. > > > > 7return math.sqrt(.x * .x + .y * .y

Re: Clean way to get one's network IP address?

2007-11-23 Thread Steven D'Aprano
On Sat, 24 Nov 2007 00:05:13 +, Steven D'Aprano wrote: > ... you're absolutely write ... Okay, I now officially have no more credibility left. Time for me to get a Hotmail email address and open a MySpace page and spend all my time writing "OMG LOL LOL LOL did u c teh thing on Ausrtalia Idl

Re: the annoying, verbose self

2007-11-23 Thread John Machin
On Nov 24, 10:54 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: [snip] > > The correct solution to your example is to get rid of the attribute > lookups from the expression completely: "correct" in what sense? > > def abs(self): > x, y, z = self.x, self.y, self.z > retu

Re: the annoying, verbose self

2007-11-23 Thread George Sakkis
On Nov 23, 7:21 pm, "BJörn Lindqvist" <[EMAIL PROTECTED]> wrote: > On Nov 23, 2007 11:54 PM, Steven D'Aprano > > The correct solution to your example is to get rid of the attribute > > lookups from the expression completely: > > No it is not. The "solution" is nothing more than a silly band-aid >

Re: the annoying, verbose self

2007-11-23 Thread Patrick Mullen
Most of the time self doesn't bother me in the slightest. The one time it does bother me however, is when I am turning a function into a method. In this case, often I have many local variables which I actually want to be instance variables, so I have to add self to all of them. Of course, this i

Re: the annoying, verbose self

2007-11-23 Thread [EMAIL PROTECTED]
Hi, Python uses "self" (and textual notation when possible) because its designers consider that symbols reduce readability. Self won't go away. :-P The issue is related to the first and seventh lines in The Zen of Python, 1. "Beautiful is better than ugly" 7. "Readability counts." My opi

Re: the annoying, verbose self

2007-11-23 Thread Neil Cerutti
On 2007-11-23, BJörn Lindqvist <[EMAIL PROTECTED]> wrote: > The big deal is that "self." occupies important horizontal > screen real estate. That is, it is usually not self in itself > that is problematic, but the overflowing lines is. Take this > silly vector class for example: > > 1class Vect

Re: eof

2007-11-23 Thread greg
braver wrote: > Historically, is it possible to trace the eof-related design decision > in stdlib? You seem to be assuming that someone started out with a design that included an eof() of the kind you want, and then decided to remove it. But I doubt that such a method was ever considered in the f

Re: foldr function in Python

2007-11-23 Thread MonkeeSage
On Nov 23, 8:56 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > This doesn't matter for non-associative functions > like "+", but it does for associative functions like "-". Err...that's backwards...should have been: This doesn't matter for associative functions like "+", but it does for non-associa

Re: eof

2007-11-23 Thread [EMAIL PROTECTED]
On Nov 22, 1:17 pm, braver <[EMAIL PROTECTED]> wrote: > Ruby has iterators and generators too, but it also has my good ol' > f.eof(). I challenge the assumption here of some majectically Python- Ruby doesn't have the good ol' eof. Good old eof tests a single flag and requires a pre read(). Ruby'

Re: md5 wrongness?

2007-11-23 Thread Erik Max Francis
Ron Johnson wrote: > $ echo "snagglefrob" | md5sum > f842244d79af85b457811091319d85ff - > > $ python > Python 2.4.4 (#2, Aug 16 2007, 02:03:40) > [GCC 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. import md5

Re: foldr function in Python

2007-11-23 Thread MonkeeSage
On Nov 23, 7:05 pm, greg <[EMAIL PROTECTED]> wrote: > My feeling is that Python shouldn't provide a bunch of > different versions of the same function that differ only in > the degree of currying. If you want a particular curried > combination, it's easy enough to create it as needed using > lambd

Re: Catching a segfault in a Python library

2007-11-23 Thread Paul Rubin
Donn Ingle <[EMAIL PROTECTED]> writes: > Do you think that's a good idea, or is there another way to handle stuff > like this? (perhaps a Python app launching another Python app?) Run your app under a debugger and figure out what is making it crash. -- http://mail.python.org/mailman/listinfo/pyt

Catching a segfault in a Python library

2007-11-23 Thread Donn Ingle
Yo, An app of mine relies on PIL. When PIL hits a certain problem font (for unknown reasons as of now) it tends to segfault and no amount of try/except will keep my wxPython app alive. My first thought is to start the app from a bash script that will check the return value of my wxPython app and

Re: foldr function in Python

2007-11-23 Thread greg
Marc 'BlackJack' Rintsch wrote: > The name is definitely not so good because there is a `foldr` in Haskell > that just works like `reduce()`. Because currying is ubiquitous in Haskell, you can use the same function in either a curried or non-curried fashion. But in Python you need different functi

Re: Catching a segfault in a Python library

2007-11-23 Thread Paul Rubin
Donn Ingle <[EMAIL PROTECTED]> writes: > > Run your app under a debugger and figure out what is making it crash. > Already done, the code within PIL is causing the crash. It gets ugly and out > of my remit. It's a freetype/Pil thing and I simply want to a way to catch > it when it happens. > Since

Re: Clean way to get one's network IP address?

2007-11-23 Thread MonkeeSage
On Nov 21, 9:15 am, Gilles Ganault <[EMAIL PROTECTED]> wrote: > Hello > > I need to get the local computer's IP address, ie. what's displayed > when running "ifconfig" in Linux: > > # ifconfig > eth0 Link encap:Ethernet HWaddr 00:15:58:A1:D5:6F > inet addr:192.168.0.79 Bcast:192.16

Re: md5 wrongness?

2007-11-23 Thread John Machin
On Nov 24, 1:34 pm, Ron Johnson <[EMAIL PROTECTED]> wrote: > Why do Python's md5 and GNU md5sum produce differing results? They don't differ. Try feeding them the same input: >>> import md5 >>> md5.new('snagglefrob').hexdigest() '9eb2459fcdd9f9b8a9fef7348bcac933' >>> md5.new('snagglefrob\n').hexd

how to get the native DC value in Tkinter/wxPython for drawing?

2007-11-23 Thread oyster
I am porting www.rmchart.com to python, now the code is almost finished, and I have supplied some examples.py which write to picturefiles directly, but the example to draw the chart on GUI stops me. that is the vb declaration nResult (LONG) = RMC_CreateChartOnDC( ByVal nParentDC (LONG), ByVal nCtr

Re: eof

2007-11-23 Thread MonkeeSage
On Nov 23, 10:43 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > This is not the same as ISO C. f.tell could be equal to > File.size(f.path) and eof could be false. An extra read() is required. My bad. As you might have surmised, I'm not a genius when it comes to C. I thought that the eof f

Re: Catching a segfault in a Python library

2007-11-23 Thread Donn Ingle
> Run your app under a debugger and figure out what is making it crash. Already done, the code within PIL is causing the crash. It gets ugly and out of my remit. It's a freetype/Pil thing and I simply want to a way to catch it when it happens. Since a segfault ends the process, I am asking about "

Re: eof

2007-11-23 Thread [EMAIL PROTECTED]
On Nov 24, 2:24 am, MonkeeSage <[EMAIL PROTECTED]> wrote: > > Actually, to be a bit more technical, IO#eof acts like standard C eof > for File objects, it only blocks / requires a previous read() on > character devices and pipes and such. For files, it's the same as > checking the absolute position

Re: eof

2007-11-23 Thread Neil Cerutti
On 2007-11-23, braver <[EMAIL PROTECTED]> wrote: > Can we say that f.eof() in fact can check for EOF right after > we've read all characters from a file, but before a failed > attempt to read beyond? In Python's idiom, > > for line lin file: ># look at a line ># we can tell eof occurs righ

RE: Recursive loading trouble for immutables

2007-11-23 Thread rekkufa
On Sat Nov 24 00:19:20 CET 2007, Steven D'Aprano wrote: > You mean like pickle? (Pardon me for telling you something you may > already know, but then you may not already know it...) The serializer I am writing has very different goals, way beyond just the serializing bit, human readability bein

Re: Clean way to get one's network IP address?

2007-11-23 Thread Steven D'Aprano
On Fri, 23 Nov 2007 15:58:06 -0800, Dennis Lee Bieber wrote: > On Fri, 23 Nov 2007 22:56:41 -, Steven D'Aprano > <[EMAIL PROTECTED]> declaimed the following in > comp.lang.python: > > >> I'm not surprised. Windows XP usually stores the hosts file here: >> >> C:\system32\drivers\etc\hosts >>

Re: eof

2007-11-23 Thread braver
On Nov 22, 8:04 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > I think Python is well rid of such a seldomly useful source of > confusion. So all that code folks wrote in Algol-like languages, -- e.g. this works in Ada, -- while not End_of_File(f) loop -- end if; -- are confusing? Why not int

Re: the annoying, verbose self

2007-11-23 Thread Steven D'Aprano
On Fri, 23 Nov 2007 23:38:24 +, BJörn Lindqvist wrote: > I like that a lot. This saves 12 characters for the original example and > removes the need to wrap it. > > 7return math.sqrt(.x * .x + .y * .y + .z * .z) > > +1 Readability counts, even on small screens. -2 Readability co

Re: the annoying, verbose self

2007-11-23 Thread BJörn Lindqvist
On Nov 22, 2007 2:08 PM, Colin J. Williams <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Alexy: > >> Sometimes I > >> avoid OO just not to deal with its verbosity. In fact, I try to use > >> Ruby anywhere speed is not crucial especially for @ prefix is better- > >> looking than self. >

Re: Looking to learn python willing to clean up code

2007-11-23 Thread Jean-Paul Calderone
On Fri, 23 Nov 2007 01:36:10 GMT, Nathan McSween <[EMAIL PROTECTED]> wrote: >Hi I would like to learn python I have background in php, pawn, bash. I was >wondering if anyone would like to show me the ropes or even just throw me >some code that needs work and seeing what I come up with. Twisted pyth

Recursive loading trouble for immutables

2007-11-23 Thread rekkufa
I am currently building a system for serializing python objects to a readable file-format, as well as creating python objects by parsing the same format. It is more or less complete except for a single issue I just cannot figure out by myself: How to load data that specifies immutables that recu

Re: foldr function in Python

2007-11-23 Thread Steven D'Aprano
On Fri, 23 Nov 2007 15:20:38 +0100, Peter Otten wrote: > reduce() is indeed in the functools -- added by Guido van Rossum > himself. I am extremely glad to be wrong, you've cheered me up no end :-D -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: creating color gradients using PIL

2007-11-23 Thread Simon Hibbs
On 21 Nov, 06:30, Ramdas <[EMAIL PROTECTED]> wrote: > Any ideas how we can create a color gradient using Python Imaging > Library. Has any got some sample code that can give me some idea. I > need to create a horizontal and vertical color gradient for a college > project > > Thanks I use these fun

Extracting data from dump file

2007-11-23 Thread TYR
I have a large dump file that originated in a MySQL db; I need to get it into an SQLite file. Various options are suggested around the web; none of them seem to work (most failing to import the thing in the first place). So I removed the assorted taggery from each end, leaving just a big text file

Refreshing GridBagSizer

2007-11-23 Thread Steve S
Hey guys, I'm stuck with using a GridBagSizer (wxPython) in a GUI Dialog and am having a frustrating time with refreshing it properly. Essentially, I've got to refresh the contents of the GridBagSizer on occasion with new values. The way I'm doing it works 4 times out of 5 but on the 5th, *all*

Re: How to import xplt, pylab?

2007-11-23 Thread Caren Balea
On 23 Nov, 01:28, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > scipy is pretty powerful, but has awful documentation and it's code > is somewhat disorganized/hacked. Maybe, you could try: > > import scipy > import scipy.sandbox > import scipy.sandbox.xplt Okay, thanks. I've tried but witho

How do I convert escaped HTML into a string?

2007-11-23 Thread Just Another Victim of the Ambient Morality
I've done a google search on this but, amazingly, I'm the first guy to ever need this! Everyone else seems to need the reverse of this. Actually, I did find some people who complained about this and rolled their own solution but I refuse to believe that Python doesn't have a built-in solu

Re: Python web frameworks

2007-11-23 Thread BartlebyScrivener
I'm just learning Django and feeling my way through all of this server terminology. Where does Django's memcached feature fit into all of this? When you all speak of start up costs and memory intensive loading for each requests, doesn't the caching feature eliminate most of that overhead? http://w

Re: Looking to learn python willing to clean up code

2007-11-23 Thread kyosohma
On Nov 22, 7:36 pm, "Nathan McSween" <[EMAIL PROTECTED]> wrote: > Hi I would like to learn python I have background in php, pawn, bash. I was > wondering if anyone would like to show me the ropes or even just throw me > some code that needs work and seeing what I come up with. Twisted python > seem

Re: Function stopping a function

2007-11-23 Thread [EMAIL PROTECTED]
Note, this only works in Unix systems: import os, signal def long_process(): while True: print "I'm messing with your terminal ! ", def short_process(long_process_id): raw_input('Press [Enter] to kill the bad process') os.kill(long_process_id, signal.SIGKILL) pr

Re: /usr/local/lib/python25.zip

2007-11-23 Thread kyosohma
On Nov 23, 12:05 am, ebzzry <[EMAIL PROTECTED]> wrote: > I'm trying to run an application and I got this: > > % meld > Traceback (most recent call last): > File "/usr/local/bin/meld", line 73, in > pygtk.require("2.0") > File "/usr/local/lib/python2.5/site-packages/pygtk.py", line 47, in >

Sockets not going away

2007-11-23 Thread Dave Kennedy
Hi, I'm getting to grips with sockets and http servers in Python. I have this bit of code which should be enough for a simple web demo import socket, os from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler def test(HandlerClass = SimpleHTTPReques

Re: Finding out what other tasks are running

2007-11-23 Thread Tim Golden
Jeremy C B Nicoll wrote: > Is there a cross-platform of determining what other processes (or in Windows > terms, other applications) are running? > > Is it possible in a cross-platform way to ask some other application to shut > down, wait a while, and then test to see if it did shut? > > Failing

Re: Finding out what other tasks are running

2007-11-23 Thread Tim Golden
Jeremy C B Nicoll wrote: > Is there a cross-platform of determining what other processes (or in Windows > terms, other applications) are running? > > Is it possible in a cross-platform way to ask some other application to shut > down, wait a while, and then test to see if it did shut? > >

Re: foldr function in Python

2007-11-23 Thread Ant
On Nov 23, 10:54 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: ... > Alas and alack, I believe that Guido has a distaste for all but the > simplest functional idioms, and an irrational belief that anything using > reduce() must be too complex to bear. reduce() is going away, not

The Python Papers is looking for additional Associate Editors

2007-11-23 Thread Maurice LING
"The Python Papers" (http://pythonpapers.org), ISSN 1834-3147, is an online e-journal, covering articles on Python in the community, industry and academia. We were established in the second half of 2006 and launched our first issue in November 2006. Since then, we have released 3 more issues.

Re: Is there pointer * in Python?

2007-11-23 Thread M�ta-MCI (MVP)
Hi! > like in C Why think to C? Why not Cobol? APL? Intercal? For think right in Python, forget C, forget others languages, think inside Python... Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there pointer * in Python?

2007-11-23 Thread Donn Ingle
> think inside Python... Assuming you *can* think while being slowly crushed and digested :D \d -- http://mail.python.org/mailman/listinfo/python-list

Writing event handler for dropdown list in python

2007-11-23 Thread mc . pandey
Hi, I am new to python, Can someone help me with writing event handler for a dropdown list in python. i have one function to create dropdown list in a file def dropdown_options(self,title,options,name,value = None): ret = "\n"+ title.title() + " \n" if (options != []):

how to write event handler for dropdown list

2007-11-23 Thread mc . pandey
Hi, I am new to python, Can someone help me with writing event handler for a dropdown list in python. i have one function to create dropdown list in a file def dropdown_options(self,title,options,name,value = None): ret = "\n"+ title.title() + " \n" if (options != []):

New computers.language of python

2007-11-23 Thread ashik
fiwghf http://www.freewebs.com/thuiss/ http://indianfriendfinder.com/go/g906725-pmem -- http://mail.python.org/mailman/listinfo/python-list

Re: Python web frameworks

2007-11-23 Thread TYR
On Nov 23, 4:22 am, SamFeltus <[EMAIL PROTECTED]> wrote: > """Perhaps we need a pythonic FRONTEND. """ > > Should have happened years ago. Python Internet Environment: PIE. -- http://mail.python.org/mailman/listinfo/python-list

Re: foldr function in Python

2007-11-23 Thread Ant
On Nov 23, 9:31 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Fri, 23 Nov 2007 00:50:30 -0800, Ant wrote: > > So my point really is that foldr (perhaps renamed to make_reducer or > > something) could create idioms that are more readable than using > > reduce directly. > > The name is

Re: may be a bug in string.rstrip

2007-11-23 Thread Peter Otten
Scott SA wrote: > There are a lot of cool things you can do with regex, one of them in > relation to your needs, is the ability to replace substrings: > > >>> import re > >>> reg = re.compile('(.exe)$') # the $ means end of line > >>> reg.sub('','123.exe') > '123' Unfortunately t

Re: Clean way to get one's network IP address?

2007-11-23 Thread Hendrik van Rooyen
"Steven D'Aprano" wrote: > On Sat, 24 Nov 2007 00:05:13 +, Steven D'Aprano wrote: > > > ... you're absolutely write ... > > Okay, I now officially have no more credibility left. Time for me to get > a Hotmail email address and open a MySpace page and spend all my time > writing "OMG LOL

Re: the annoying, verbose self

2007-11-23 Thread braver
On Nov 24, 2:38 am, "BJörn Lindqvist" <[EMAIL PROTECTED]> wrote: > The big deal is that "self." occupies important horizontal screen real > estate. That is, it is usually not self in itself that is problematic, Exactly. I understand and appreciate all the scoping qualification and explicit"ation

Re: How to import xplt, pylab?

2007-11-23 Thread Robert Kern
Caren Balea wrote: > On 23 Nov, 01:28, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >> scipy is pretty powerful, but has awful documentation and it's code >> is somewhat disorganized/hacked. Maybe, you could try: >> >> import scipy >> import scipy.sandbox >> import scipy.sandbox.xplt > > Oka

Re: eof

2007-11-23 Thread greg
Dennis Lee Bieber wrote: > Pascal I/O worked with a "one element preread", where what we'd > consider a read operation was performed by the open operation -- which > made console I/O a royal pain Yep. Later implementations reduced the pain somewhat by using a "lazy" scheme which deferred the

Handling Menubars in WXGlade

2007-11-23 Thread jatin patni
Hi, I recently started working on WXGlade... I found some amount of documentation online I am having problems integrating event handlers with MenubarsI want each menu item to open a new window with custom made controls...but I can't find it anywhere.Writing event handler is secondary

Re: foldr function in Python

2007-11-23 Thread Peter Otten
Ant wrote: > On Nov 23, 10:54 am, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: > ... >> Alas and alack, I believe that Guido has a distaste for all but the >> simplest functional idioms, and an irrational belief that anything using >> reduce() must be too complex to bear. reduce

Re: How do I convert escaped HTML into a string?

2007-11-23 Thread Stefan Behnel
Just Another Victim of the Ambient Morality wrote: > I've done a google search on this but, amazingly, I'm the first guy to > ever need this! You cannot infer that from a Google search. > So, how do I convert HTML to plaintext? Something like this: > > This is a string. > > ...in

Re: scipy-0.6.0.win32-py2.5.exe does not install

2007-11-23 Thread John Machin
On Nov 22, 8:50 pm, Frank Moyles <[EMAIL PROTECTED]> wrote: > Hi, I want to use SciPy library. I am using W2k, and ActiveState Python > 2.5. I have succesfully numpy, but when I run the > scipy-0.6.0.win32-py2.5.exe (from the downloads section on the SciPy > page), nothing happens - i.e. no informa

Re: How do I convert escaped HTML into a string?

2007-11-23 Thread Sergio Correia
This may help: http://effbot.org/zone/re-sub.htm#strip-html You should take care that there are several issues about going from html to txt 1) What should wedo aboutthis? You need to strip all tags.. 2) ", &, <, and >... and I could keep going.. we need to convert all those 3) we need to remo

Re: foldr function in Python

2007-11-23 Thread Marc 'BlackJack' Rintsch
On Fri, 23 Nov 2007 00:50:30 -0800, Ant wrote: > So my point really is that foldr (perhaps renamed to make_reducer or > something) could create idioms that are more readable than using > reduce directly. The name is definitely not so good because there is a `foldr` in Haskell that just works like

Re: may be a bug in string.rstrip

2007-11-23 Thread Ant
On Nov 23, 4:09 am, "kyo guan" <[EMAIL PROTECTED]> wrote: ... > >>> '120.exe'.rstrip('.exe') Another approach since you seem to be working with filenames is using the os.path module: >>> import os.path as path >>> s = "test.torrent" >>> t = "test.exe" >>> u = "test" >>> path.splitext(s)[0] 'test'

Re: foldr function in Python

2007-11-23 Thread Steven D'Aprano
On Fri, 23 Nov 2007 00:50:30 -0800, Ant wrote: > On Nov 22, 7:14 pm, oj <[EMAIL PROTECTED]> wrote: >> On Nov 22, 3:02 pm, Ant <[EMAIL PROTECTED]> wrote: > ... >> It's basically just one line to implement: >> >> foldr = lambda f, i: lambda s: reduce(f, s, i) >> >> It's just reduce with currying, I'

Re: foldr function in Python

2007-11-23 Thread Steven D'Aprano
On Fri, 23 Nov 2007 09:31:06 +, Marc 'BlackJack' Rintsch wrote: > Of course it's a silly example because the "pythonic" way to define > `comma_separate()` is:: > > comma_separate = ','.join Except that join only works with strings, and reduce/foldr can work on anything. -- Steven. -- h

Re: www.200836.com---labor daygift

2007-11-23 Thread Yeef
QQ:625101446 MSN:[EMAIL PROTECTED] I'm a chinese. On Nov 23, 2007 8:46 AM, <[EMAIL PROTECTED]> wrote: > if you want to know any information about 2008 beijing Olympic > games ,please contact me or visit : > my website--www.200836.com > MSN:[EMAIL PROTECTED] > e-mail:[EMAIL PROTECTED] > yahooID:[E

BaseHTTPServer issues

2007-11-23 Thread samwyse
I've just now submitted two issues to the issue tracker: 1491BaseHTTPServer incorrectly implements response code 100 RFC 2616 sec 8.2.3 states, "An origin server that sends a 100 (Continue) response MUST ultimately send a final status code, once the request body is received and processed, u

Finding out what other tasks are running

2007-11-23 Thread Jeremy C B Nicoll
Is there a cross-platform of determining what other processes (or in Windows terms, other applications) are running? Is it possible in a cross-platform way to ask some other application to shut down, wait a while, and then test to see if it did shut? Failing that are there separate Windows, Mac a

Re: Finding out what other tasks are running

2007-11-23 Thread Tim Golden
Tim Golden wrote: > Jeremy C B Nicoll wrote: >> Is there a cross-platform of determining what other processes (or in Windows >> terms, other applications) are running? >> >> Is it possible in a cross-platform way to ask some other application to shut >> down, wait a while, and then test to see if i

Re: Clean way to get one's network IP address?

2007-11-23 Thread [EMAIL PROTECTED]
On Nov 21, 5:34 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 21 Nov 2007 12:00:52 -0500, Joe Riopel wrote: > > On Nov 21, 2007 10:15 AM, Gilles Ganault <[EMAIL PROTECTED]> wrote: > >> I know about socket.gethostbyname, but this relies on what's in > >> /etc/hosts, and

Re: Python web frameworks

2007-11-23 Thread joe jacob
On Nov 21, 10:27 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > Jeff wrote: > > On Nov 21, 6:25 am, Bruno Desthuilliers > [EMAIL PROTECTED]> wrote: > >> joe jacob a écrit : > >> (snip) > > >>> Thanks everyone for the response. From the posts I understand that > >>> Django and pylons are the best.

Re: may be a bug in string.rstrip

2007-11-23 Thread Bruno Desthuilliers
Scott SA a écrit : > On 11/23/07, kyo guan ([EMAIL PROTECTED]) wrote: > >> Please look at this code: >> > 'exe.torrent'.rstrip('.torrent') >> 'ex' <- it should be 'exe', why? >> >> but this is a right answer: >> > '120.exe'.rstrip('.exe') >> '120' <

Re: python class methods identity?

2007-11-23 Thread Chris Mellon
On Nov 23, 2007 1:29 AM, Roc Zhou <[EMAIL PROTECTED]> wrote: > Hello, > > I'm now being confused by this segment of code: > >>> class Test: > ... var = 1 > ... def func(self): pass > ... > >>> x = Test() > >>> y = Test() > >>> x.var is y.var > True > >>> x.func is y.func > False > >>> id(x.

error handling

2007-11-23 Thread [EMAIL PROTECTED]
i want to capture run time errors so that the execution of program doesnt stop. i want an error handler function ( that will email me or something like that ) on error and not stop the execution of program. how do i do this? i can not use try except for this... thanks -- http://mail.python.org/ma

png transparency with PIL

2007-11-23 Thread Robin Becker
I'm trying to determine the transparency information for a png image. With gif images I can determine the colour that is used for transparent areas using im.info['transparency']. For the png images of interest there is no such entry in the info dict. I assume that's because of the way png does t

Re: png transparency with PIL

2007-11-23 Thread Bjoern Schliessmann
Robin Becker wrote: > I'm trying to determine the transparency information for a png > image. With gif images I can determine the colour that is used for > transparent areas using im.info['transparency']. For the png > images of interest there is no such entry in the info dict. I > assume that's b

Re: Python too complex ?!?!?!

2007-11-23 Thread Patrick Mullen
On Nov 22, 2007 1:04 PM, Brian <[EMAIL PROTECTED]> wrote: > / Chime Mode > I have, in fact, sent this thread to my friend. > His limiting factors are > > - money-control people favor MS platforms > - C# and VS have minimal cost impact for academia > - sys admins have everything locked down (probab

Re: python safe scripting

2007-11-23 Thread Simon Hibbs
> > 2007/11/21, Vladimir Rusinov <[EMAIL PROTECTED]>: > Yes, but apache, nginx and others does not uses logger. > I wanna write an application which would handle all my (Linux) logs: > rotating, compressing, analysing and so on (logrotate replacement), it would > require some nontrivial configura

Re: Function stopping a function

2007-11-23 Thread Sorin Schwimmer
In my situation, there is a device with keyboard that allows some user input. In the same time, the device is connected to a standard PC, and there may be some communication there. The lengthy_function() resides and executes in the device, and so is cancel(). Lengthy_function() is pretty linear:

Re: How do I convert escaped HTML into a string?

2007-11-23 Thread Marc 'BlackJack' Rintsch
On Sat, 24 Nov 2007 05:42:06 +, Just Another Victim of the Ambient Morality wrote: > ...since HTML seems to convert any amount and type of whitespace into a > single space (a bizarre design choice if I've ever seen one). Not really. Just imagine how web pages would look like if whitespa

Re: Assertion for python scripts

2007-11-23 Thread Steven W. Orr
On Friday, Nov 2nd 2007 at 14:14 -, quoth matthias: =>Howdy ! => =>I started using the assert() stmt and found it quite useful :-) I =>have only one problem: I don't =>know how to turn them off again. => =>I know that "-O" turns off assertions in general. However, how do I =>pass thus param

  1   2   >