Re: Regex doesn't support MULTILINE?

2007-07-22 Thread irstas
On Jul 22, 7:56 am, Gilles Ganault <[EMAIL PROTECTED]> wrote: > On Sat, 21 Jul 2007 22:18:56 -0400, Carsten Haese > > <[EMAIL PROTECTED]> wrote: > >That's your problem right there. RE is not the right tool for that job. > >Use an actual HTML parser such as BeautifulSoup > > Thanks a lot for the tip

Re: Python version changes, sys.executable does not

2007-07-22 Thread Jeffrey Froman
Jim Langston wrote: > I think it's because your python directory is in the path before your > python2.5 directory. Thanks for the tip. In fact, /usr/local/bin/python (2.5) is on my PATH before /usr/bin/python (2.3). I did find the problem however -- it turns out that caching the executable path

ANN: parley 0.3

2007-07-22 Thread Jacob Lee
Release Announcement: PARLEY version 0.3 PARLEY is a library for writing Python programs that implement the Actor model of distributed systems, in which lightweight concurrent processes communicate through asynchronous message-passing. Actor systems typically are easier to write and debug than tra

Re: Pickled objects over the network

2007-07-22 Thread Hendrik van Rooyen
"Steve Holden" <[EMAIL PROTECTED]> wrote: > I think someone has already pointed out netstrings, which will allow you > to send arbitrary strings over network connections deterministically. Yes I brought it up > I'm afraid for the rest it's just a matter of encoding your information > in a way

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-22 Thread Hendrik van Rooyen
"Steve Holden" <[EMAIL PROTECTED],..eb.com> wrote: > The trouble there, though, is that although COBOL was comprehensible (to > a degree) relatively few people have the rigor of thought necessary to > construct, or even understand, an algorithm of any kind. This is true - and in my experience

Re: [2.5] Regex doesn't support MULTILINE?

2007-07-22 Thread Gabriel Genellina
En Sun, 22 Jul 2007 01:56:32 -0300, Gilles Ganault <[EMAIL PROTECTED]> escribió: > Incidently, as far as using Re alone is concerned, it appears that > re.MULTILINE isn't enough to get Re to include newlines: re.DOTLINE > must be added. > > Problem is, when I add re.DOTLINE, the search takes les

Re: simpleJSON pack binary data

2007-07-22 Thread Gabriel Genellina
En Sat, 21 Jul 2007 23:13:22 -0300, Andrey <[EMAIL PROTECTED]> escribió: > Is it possible to pack binary data into simplejson? json does not provide any direct "binary" type; strings are Unicode strings. Try encoding your data using Base64 for example, or transform it into an array of numbe

Re: Sorting dict keys

2007-07-22 Thread Martin v. Löwis
> I'd like to do it in one line because what I am trying to do is, after > all, a single, simple enough action. I find the suggested > b = sorted(a.keys()) much more readable than breaking it up in two > lines. I think you have demonstrated that a single-line statements with multiple functions a

Re: simpleJSON pack binary data

2007-07-22 Thread Marc 'BlackJack' Rintsch
On Sat, 21 Jul 2007 19:13:22 -0700, Andrey wrote: > My question is, anyone will suggest a workaround to this error? > i really like to pack my raw image data into the JSON, so my other > programming script can read the array easily JSON is a text format so you have to encode the binary data some

Advice on sending images to clients over network

2007-07-22 Thread Frank Millman
Hi all This is not strictly a Python question, but as the system to which relates is written in Python, hopefully it is not too off-topic. I have an accounting/business application, written in client/server mode. The server makes a connection to a database, and then runs a continuous loop waiting

Re: Pythonic way for missing dict keys

2007-07-22 Thread Marc 'BlackJack' Rintsch
On Sat, 21 Jul 2007 16:20:37 -0700, genro wrote: > On Jul 19, 6:29 am, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: >> No "surprise" here, but it can indeed be suboptimal if instanciating >> myobject is costly. > > What about this way ? > > my_obj = my_dict.get(key) or my_dict.setdefault(key

Re: ignoring a part of returned tuples

2007-07-22 Thread noamtm
> Pylint also "allows" the name `dummy` without complaining. That makes it > even clearer and doesn't clash with the meaning of `_` when `gettext` is > used. Thanks, that's even better! Noam. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with exec

2007-07-22 Thread vedrandekovic
On 21 srp, 22:31, Steve Holden <[EMAIL PROTECTED]> wrote: > ...:::JA:::... wrote: > > Hello, > > > After my program read and translate this code: > > > koristi os,sys; > > ispisi 'bok kaj ima'; > > > into the: > > > import os,sys; > > print 'bok kaj ima'; > > > and when it run this code with "exec"

Re: Advice on sending images to clients over network

2007-07-22 Thread Bjoern Schliessmann
Frank Millman wrote: > My question is, what is the best way to get the image to the > client? IMHO, HTTP would be most painless. Either incorporate a little HTTP server into your server application, or use a seperate daemon and let the server only output HTTP links. > My third thought was to se

Re: problem with exec

2007-07-22 Thread Steven D'Aprano
On Sun, 22 Jul 2007 03:23:30 -0700, vedrandekovic wrote: > Thanks for everything previously, but just to I ask about code > indentation,this with { and } doesn't > employed, here is my example how can I solve this about code > indentation: > n=90 if n==90: > {print "bok kjai ma'

Re: Pythonic way for missing dict keys

2007-07-22 Thread Alex Popescu
Zentrader <[EMAIL PROTECTED]> wrote in news:1185041243.323915.161230 @x40g2000prg.googlegroups.com: > On Jul 21, 7:48 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > > [snip...] > > >>From the 2.6 PEP #361 (looks like dict.has_key is deprecated) > Python 3.0 compatability: ['compatibility'-->someon

Re: code packaging

2007-07-22 Thread Alex Popescu
On 7/22/07, Ryan Ginstrom <> wrote: > Hi Alex: > > Do you develop for Windows? Are you looking to automate a build > process? > > The standard library's build module is distutils: > http://docs.python.org/lib/module-distutils.html > > As I mentioned in my post, I use a variety of third-party mo

Re: how to find available classes in a file ?

2007-07-22 Thread John J. Lee
Alex Popescu <[EMAIL PROTECTED]> writes: [...] > I may be wrong but I think I've found a difference between my > dir(module) approach > and the inspect.getmembers(module, inspect.isclass): the first one > returns the > classes defined in the module, while the later also lists the imported > availab

Re: importing a module from a specific directory

2007-07-22 Thread O.R.Senthil Kumaran
> I would like to organize them into directory structure in > which there is a 'main' directory, and under it directories for > specific sub-tasks, or sub-experiments, I'm running (let's call them > 'A', 'B', 'C'). > Is there a neat clean way of achieving the code organization? > This is a k

Re: Pickled objects over the network

2007-07-22 Thread Steve Holden
Hendrik van Rooyen wrote: > "Steve Holden" <[EMAIL PROTECTED]> wrote: > >> I think someone has already pointed out netstrings, which will allow you >> to send arbitrary strings over network connections deterministically. > > Yes I brought it up > >> I'm afraid for the rest it's just a matter o

Re: problem with exec

2007-07-22 Thread Steve Holden
Steven D'Aprano wrote: > On Sun, 22 Jul 2007 03:23:30 -0700, vedrandekovic wrote: > >> Thanks for everything previously, but just to I ask about code >> indentation,this with { and } doesn't >> employed, here is my example how can I solve this about code >> indentation: >> > n=90 > if n==9

Re: problem with exec

2007-07-22 Thread vedrandekovic
> I wasn't playing silly games at all, and I did prefix that part ofmy > answer with "I'm afraid I don't understand this question". The OP is > writing a program to "translate" a Python-like language that uses > non-English keywords into Python. Since the application is transforming > its input, it

Re: Sort lines in a text file

2007-07-22 Thread Daniel
On Sun, 22 Jul 2007 06:03:17 +0300, leegold <[EMAIL PROTECTED]> wrote: > say I have a text file: > > zz3 uaa4a ss 7 uu > zz 3 66 ppazz9 > a0zz0 > > I want to sort the text file. I want the key to be the number after > the two "zz". Or I guess a string of two zz then a numberS

ANN: Snobol 1.0

2007-07-22 Thread greg
Aahz wrote: > So adding > SNOBOL patterns to another library would be a wonderful gift to the > Python community... I wrote a module for Snobol-style pattern matching a while back, but didn't get around to releasing it. I've just put it on my web page: http://www.cosc.canterbury.ac.nz/greg.ewing/

Re: Sort lines in a text file

2007-07-22 Thread Daniel
On Sun, 22 Jul 2007 06:03:17 +0300, leegold <[EMAIL PROTECTED]> wrote: > say I have a text file: > > zz3 uaa4a ss 7 uu > zz 3 66 ppazz9 > a0zz0 > > I want to sort the text file. I want the key to be the number after > the two "zz". Or I guess a string of two zz then a numberS

custom plugin architecture: how to see parent namespace?

2007-07-22 Thread escalation746
I've got a namespace query that amounts to this: How can an imported function see data in the parent custom namespace? I have read through numerous posts which skirt this issue without answering it. To illustrate, create plugin.py with a couple of functions. The second will obviously fail. d

Re: Can a low-level programmer learn OOP?

2007-07-22 Thread Wolfgang Strobl
Paul Rubin : >[EMAIL PROTECTED] (Aahz) writes: >> .So adding SNOBOL patterns to another library would be a wonderful >> gift to the Python community... > >Snobol patterns were invented at a time when nobody knew anything >about parsing. But Snobol patterns aren't mainl

Re: Can a low-level programmer learn OOP?

2007-07-22 Thread Wolfgang Strobl
[EMAIL PROTECTED] (Aahz): >In article <[EMAIL PROTECTED]>, >Wolfgang Strobl <[EMAIL PROTECTED]> wrote: >> >>SNOBOLs powerfull patterns still shine, compared to Pythons clumsy >>regular expressions. > >Keep in mind that Python regular expressions are modeled on the >grep/sed/awk/Perl model so as

Re: Can a low-level programmer learn OOP?

2007-07-22 Thread Wolfgang Strobl
[EMAIL PROTECTED] (Eddie Corns): >I don't believe you can get the benefit of SNOBOL matching without direct >language support. That's my opinion, too. >There's only so much a library can do. However a valiant >and interesting effort: > >http://www.wilmott.ca/python/patternmatching.html This i

split on NO-BREAK SPACE

2007-07-22 Thread Peter Kleiweg
Is this a bug or a feature? Python 2.4.4 (#1, Oct 19 2006, 11:55:22) [GCC 2.95.3 20010315 (SuSE)] on linux2 >>> a = 'a b c\240d e' >>> a 'a b c\xa0d e' >>> a.split() ['a', 'b', 'c\xa0d', 'e'] >>> a = a.decode('latin-1') >>> a u'a b c\xa0d e' >>> a.sp

Re: split on NO-BREAK SPACE

2007-07-22 Thread Carsten Haese
On Sun, 2007-07-22 at 17:15 +0200, Peter Kleiweg wrote: > Is this a bug or a feature? > > > Python 2.4.4 (#1, Oct 19 2006, 11:55:22) > [GCC 2.95.3 20010315 (SuSE)] on linux2 > > >>> a = 'a b c\240d e' > >>> a > 'a b c\xa0d e' > >>> a.split() > ['a', 'b', 'c\xa0d', 'e

Re: split on NO-BREAK SPACE

2007-07-22 Thread Peter Kleiweg
Carsten Haese schreef op de 22e dag van de hooimaand van het jaar 2007: > On Sun, 2007-07-22 at 17:15 +0200, Peter Kleiweg wrote: > > Is this a bug or a feature? > > > > > > Python 2.4.4 (#1, Oct 19 2006, 11:55:22) > > [GCC 2.95.3 20010315 (SuSE)] on linux2 > > > > >>> a = 'a b c\2

Re: split on NO-BREAK SPACE

2007-07-22 Thread Carsten Haese
On Sun, 2007-07-22 at 17:44 +0200, Peter Kleiweg wrote: > > It's a feature. See help(str.split): "If sep is not specified or is > > None, any whitespace string is a separator." > > Define "any whitespace". Any string for which isspace returns True. > Why is it different in and ? >>> '\xa0'.is

Lazy "for line in f" ?

2007-07-22 Thread Alexandre Ferrieux
Hi, I'm a total newbie in Python, but did give quite a try to the documentation before coming here. Sorry if I missed the obvious. The Tutorial says about the "for line in f" idiom that it is "space- efficient". Short of further explanation, I interpret this as "doesn't read the whole file before

Re: Lazy "for line in f" ?

2007-07-22 Thread Christoph Haas
On Sun, Jul 22, 2007 at 09:10:50AM -0700, Alexandre Ferrieux wrote: > I'm a total newbie in Python, but did give quite a try to the > documentation before coming here. > Sorry if I missed the obvious. > > The Tutorial says about the "for line in f" idiom that it is "space- > efficient". > Short of

Re: problem with exec

2007-07-22 Thread Steven D'Aprano
On Sun, 22 Jul 2007 09:12:21 -0400, Steve Holden wrote: >> Steve Holden was playing silly games. You can't use { } for indentation. >> You have to use indentation. >> > I wasn't playing silly games at all, and I did prefix that part ofmy > answer with "I'm afraid I don't understand this questio

Re: Advice on sending images to clients over network

2007-07-22 Thread Paul Rubin
Frank Millman <[EMAIL PROTECTED]> writes: > Any suggestions will be much appreciated. Why on earth don't you write the whole thing as a web app instead of a special protocol? Then just use normal html tags to put images into the relevant pages. -- http://mail.python.org/mailman/listinfo/python-l

Re: problem with exec

2007-07-22 Thread Steve Holden
Steven D'Aprano wrote: > On Sun, 22 Jul 2007 09:12:21 -0400, Steve Holden wrote: > > >>> Steve Holden was playing silly games. You can't use { } for indentation. >>> You have to use indentation. >>> >> I wasn't playing silly games at all, and I did prefix that part ofmy >> answer with "I'm afrai

Re: Lazy "for line in f" ?

2007-07-22 Thread Miles
On 7/22/07, Alexandre Ferrieux wrote: > The Tutorial says about the "for line in f" idiom that it is "space- > efficient". > Short of further explanation, I interpret this as "doesn't read the > whole file before spitting out lines". > In other words, I would say "lazy". Which would be a Good Thin

Re: Advice on sending images to clients over network

2007-07-22 Thread Paul McNett
Frank Millman wrote: > I guess the point of all this rambling is that my thought process is > leading me towards my third option, but this would be a bit of work to > set up, so I would appreciate any comments from anyone who has been > down this road before - do I make sense, or are there better w

URL parsing for the hard cases

2007-07-22 Thread John Nagle
Is there something available that will parse the "netloc" field as returned by URLparse, including all the hard cases? The "netloc" field can potentially contain a port number and a numeric IP address. The IP address may take many forms, including an IPv6 address. I'm parsing URLs used b

Compiling PythonD using DJGPP

2007-07-22 Thread John Simeon
Hi there. I had an old computer at my disposal and decided to put it to use by setting up a nostalgia project with DOS and Windows for Workgroups 3.11. Now that all of you are back from laughing about the archaicness of the software involved ;-) here is my problem. PythonD is a port of python t

Re: Advice on sending images to clients over network

2007-07-22 Thread Paul McNett
Paul Rubin wrote: > Frank Millman <[EMAIL PROTECTED]> writes: >> Any suggestions will be much appreciated. > > Why on earth don't you write the whole thing as a web app instead of > a special protocol? Then just use normal html tags to put images > into the relevant pages. I believe he has a ful

Re: URL parsing for the hard cases

2007-07-22 Thread Miles
On 7/22/07, John Nagle wrote: > Is there something available that will parse the "netloc" field as > returned by URLparse, including all the hard cases? The "netloc" field > can potentially contain a port number and a numeric IP address. The > IP address may take many forms, including an IPv6

Re: Advice on sending images to clients over network

2007-07-22 Thread Jorge Godoy
Paul McNett wrote: > Paul Rubin wrote: >> Frank Millman <[EMAIL PROTECTED]> writes: >>> Any suggestions will be much appreciated. >> >> Why on earth don't you write the whole thing as a web app instead of >> a special protocol? Then just use normal html tags to put images >> into the relevant pa

Re: Advice on sending images to clients over network

2007-07-22 Thread Calvin Spealman
On 7/22/07, Paul McNett <[EMAIL PROTECTED]> wrote: > Paul Rubin wrote: > > Frank Millman <[EMAIL PROTECTED]> writes: > >> Any suggestions will be much appreciated. > > > > Why on earth don't you write the whole thing as a web app instead of > > a special protocol? Then just use normal html tags to

http://www.tbn.org/films/videos/To_Hell_And_Back.ram << GREAT VIDEO!

2007-07-22 Thread David Manti
-- http://mail.python.org/mailman/listinfo/python-list

Where is the collections module?

2007-07-22 Thread Gordon Airporte
I was going to try tweaking defaultdict, but I can't for the life of me find where the collections module or its structures are defined. Python 2.5. -- http://mail.python.org/mailman/listinfo/python-list

Re: Where is the collections module?

2007-07-22 Thread Calvin Spealman
Look in Modules/_collectionsmodule.c Pretty much any built-in module will be named thusly. On 7/22/07, Gordon Airporte <[EMAIL PROTECTED]> wrote: > I was going to try tweaking defaultdict, but I can't for the life of me > find where the collections module or its structures are defined. Python 2.5

Re: Advice on sending images to clients over network

2007-07-22 Thread Paul McNett
Calvin Spealman wrote: > On 7/22/07, Paul McNett <[EMAIL PROTECTED]> wrote: >> Paul Rubin wrote: >> > Frank Millman <[EMAIL PROTECTED]> writes: >> >> Any suggestions will be much appreciated. >> > >> > Why on earth don't you write the whole thing as a web app instead of >> > a special protocol? Th

Re: Where is the collections module?

2007-07-22 Thread Carsten Haese
On Sun, 2007-07-22 at 14:24 -0400, Gordon Airporte wrote: > I was going to try tweaking defaultdict, but I can't for the life of me > find where the collections module or its structures are defined. Python 2.5. It's written in C. You'll find it in the Python2.5 source code at /path/to/source/Modu

Re: UnicodeDecodeError

2007-07-22 Thread Peter Otten
Ken Seehart wrote: >> I am wondering if anyone knows where I can find a mapping from this >> particular extended ascii code (where \xd1 is Ñ), to the corresponding >> unicode characters. > Um, never mind. The recent unicode conversation gave me my answer :-) > unicode(s, 'Windows-1252') Run th

Re: split on NO-BREAK SPACE

2007-07-22 Thread Peter Kleiweg
Carsten Haese schreef op de 22e dag van de hooimaand van het jaar 2007: > On Sun, 2007-07-22 at 17:44 +0200, Peter Kleiweg wrote: > > > It's a feature. See help(str.split): "If sep is not specified or is > > > None, any whitespace string is a separator." > > > > Define "any whitespace". > > Any

Re: split on NO-BREAK SPACE

2007-07-22 Thread Wildemar Wildenburger
Peter Kleiweg wrote: > > Define white space to isspace() > > Explain that phrase. > > Here is another "space": > > >>> u'\uFEFF'.isspace() > False > > isspace() is inconsistent > I don't really know much about unicode, but google tells me that \uFEFF is a byte order mark. I thought we

ANN: pyparsing1.4.7

2007-07-22 Thread Paul McGuire
I just uploaded the latest release (v1.4.7) of pyparsing, and I'm happy to say, it is not a very big release - this module is getting to be quite stable. A few bug-fixes, and one significant notation enhancement: setResultsNames gains a big shortcut in this release (see below). No new examples in

[ANN] ftputil 2.2.3 released

2007-07-22 Thread Stefan Schwarzer
ftputil 2.2.3 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.2.2 --- This release fixes a bug in the ``makedirs`` call (report and fix by Julian, whose last name I don't know ;-) ). Upgrading is recommended. What is ftputil? ---

Re: split on NO-BREAK SPACE

2007-07-22 Thread Jean-Paul Calderone
On Sun, 22 Jul 2007 21:13:02 +0200, Peter Kleiweg <[EMAIL PROTECTED]> wrote: >Carsten Haese schreef op de 22e dag van de hooimaand van het jaar 2007: > >> On Sun, 2007-07-22 at 17:44 +0200, Peter Kleiweg wrote: >> > > It's a feature. See help(str.split): "If sep is not specified or is >> > > None,

Re: custom plugin architecture: how to see parent namespace?

2007-07-22 Thread faulkner
On Jul 22, 10:06 am, escalation746 <[EMAIL PROTECTED]> wrote: > I've got a namespace query that amounts to this: How can an imported > function see data in the parent custom namespace? I have read through > numerous posts which skirt this issue without answering it. > > To illustrate, create plugin

Re: Compiling PythonD using DJGPP

2007-07-22 Thread memracom
On 22 Jul, 18:29, "John Simeon" <[EMAIL PROTECTED]> wrote: > Hi there. I had an old computer at my disposal and decided to put it to use > by setting up a nostalgia project with DOS and Windows for Workgroups 3.11. > gcc -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. > -I./I

Re: Python MAPI

2007-07-22 Thread memracom
> Well, I ran Process Monitor with some filters enabled to only watch > Thunderbird and MS Word. Unfortunately, that didn't give me any of the > registry edits, so I disabled my filters and ran it without. Now I > have a log file with 28,000 entries. It's amazing to see all the stuff > that happens

Re: idiom for RE matching

2007-07-22 Thread memracom
On 19 Jul, 05:52, Gordon Airporte <[EMAIL PROTECTED]> wrote: > I have some code which relies on running each line of a file through a > large number of regexes which may or may not apply. Have you read and understood what MULTILINE means in the manual section on re syntax? Essentially, you can ma

Re: best SOAP module

2007-07-22 Thread memracom
On 18 Jul, 14:02, "Sells, Fred" <[EMAIL PROTECTED]> wrote: > I need to talk to a vendor side via SOAP, Googling is overwhelming and many > hits seem to point to older attempts. > > Can someone tell me which SOAP module is recommended. I'm using Python 2.4. If you are doing this inside the enterp

space / nonspace

2007-07-22 Thread Peter Kleiweg
>>> import re >>> s = u'a b\u00A0c d' >>> s.split() [u'a', u'b', u'c', u'd'] >>> re.findall(r'\S+', s) [u'a', u'b\xa0c', u'd'] This isn't documented either: >>> s = ' b c ' >>> s.split() ['b', 'c'] >>> s.split(' ') ['', 'b', 'c', ''] -- Peter

Re-running unittest

2007-07-22 Thread Israel Fernández Cabrera
Hi I'm writing some code that automatically execute some registered unit test in a way to automate the process. A sample code follows to illustrate what I'm doing: class PruebasDePrueba(unittest.TestCase): def testUnTest(self): a = 2 b = 1 self.assertEquals(a, b) def runT

Re: CSV without first line?

2007-07-22 Thread memracom
On 15 Jul, 04:30, "Sebastian Bassi" <[EMAIL PROTECTED]> wrote: > Hi, > > In my CSV file, the first line has the name of the variables. So the > data I want to parse resides from line 2 up to the end. Here is what I > do: > > import csv > lines=csv.reader(open("MYFILE")) > lines.next() #this is just

Re: custom plugin architecture: how to see parent namespace?

2007-07-22 Thread escalation746
faulkner wrote: > sys._getframe(1).f_locals Brilliant. That one's pretty well hidden and labeled "should be used for internal and specialized purposes only". Guess I'm officially special. :-) To implement this with minimal requirements on the author of the plugin, I created a function in master.

Re: URL parsing for the hard cases

2007-07-22 Thread memracom
On 22 Jul, 18:56, John Nagle <[EMAIL PROTECTED]> wrote: > Is there something available that will parse the "netloc" field as > returned by URLparse, including all the hard cases? The "netloc" field > can potentially contain a port number and a numeric IP address. The > IP address may take man

Re: space / nonspace

2007-07-22 Thread Carsten Haese
On Sun, 2007-07-22 at 22:33 +0200, Peter Kleiweg wrote: > >>> import re > >>> s = u'a b\u00A0c d' > >>> s.split() > [u'a', u'b', u'c', u'd'] > >>> re.findall(r'\S+', s) > [u'a', u'b\xa0c', u'd'] And your question is...? > This isn't documented either: > > >>> s = '

Re: custom plugin architecture: how to see parent namespace?

2007-07-22 Thread Wojciech Muła
escalation746 wrote: > def ViewValuable(): [...] > code = """ > Hello() > Plus() > Valuable() > """ These names don't match. I replaced Valuable() with proper name, and everything work fine. w. -- http://mail.python.org/mailman/listinfo/python-list

Re: space / nonspace

2007-07-22 Thread marduk
On Sun, 2007-07-22 at 22:33 +0200, Peter Kleiweg wrote: > >>> import re > >>> s = u'a b\u00A0c d' > >>> s.split() > [u'a', u'b', u'c', u'd'] > >>> re.findall(r'\S+', s) > [u'a', u'b\xa0c', u'd'] > If you want the Unicode interpretation of \S+, etc, you pass the re.UNICODE fl

Re: web page text extractor

2007-07-22 Thread Thomas Dickey
Miki <[EMAIL PROTECTED]> wrote: > (You can find lynx at http://lynx.browser.org/) not exactly - The current version of lynx is 2.8.6 It's available at http://lynx.isc.org/lynx2.8.6/ 2.8.7 Development & patches: http://lynx.isc.org/current/index.html -- Thomas E. Dickey http://i

Re: split on NO-BREAK SPACE

2007-07-22 Thread Steve Holden
Jean-Paul Calderone wrote: > On Sun, 22 Jul 2007 21:13:02 +0200, Peter Kleiweg <[EMAIL PROTECTED]> wrote: >> Carsten Haese schreef op de 22e dag van de hooimaand van het jaar 2007: >> >>> On Sun, 2007-07-22 at 17:44 +0200, Peter Kleiweg wrote: > It's a feature. See help(str.split): "If

Re: Lazy "for line in f" ?

2007-07-22 Thread Alexandre Ferrieux
On Jul 22, 7:21 pm, Miles <[EMAIL PROTECTED]> wrote: > On 7/22/07, Alexandre Ferrieux wrote: > > > The Tutorial says about the "for line in f" idiom that it is "space- > > efficient". > > Short of further explanation, I interpret this as "doesn't read the > > whole file before spitting out lines".

recursively expanding $references in dictionaries

2007-07-22 Thread Alia Khouri
I was kind of wondering what ways are out there to elegantly expand '$name' identifiers in nested dictionary value. The problem arose when I wanted to include that kind of functionality to dicts read from yaml files such that: def func(input): # do something return output where: input =

Re: split on NO-BREAK SPACE

2007-07-22 Thread I V
On Sun, 22 Jul 2007 21:13:02 +0200, Peter Kleiweg wrote: > Here is another "space": > > >>> u'\uFEFF'.isspace() > False > > isspace() is inconsistent Well, U+00A0 is in the category "Separator, Space" while U+FEFF is in the category "Other, Format", so it doesn't seem unreasonable that one i

Re: Sort lines in a text file

2007-07-22 Thread leegold
...snip... > To save anybody who's tempted to write the whole shebang for you, > please specify which part(s) of the exercise you are having problems > with: > (a) reading lines from a file > (b) extracting a sort key from a line [presuming "number" means > "positive integer"; what do you want to d

Re: Lazy "for line in f" ?

2007-07-22 Thread Steve Holden
Alexandre Ferrieux wrote: > On Jul 22, 7:21 pm, Miles <[EMAIL PROTECTED]> wrote: >> On 7/22/07, Alexandre Ferrieux wrote: >> >>> The Tutorial says about the "for line in f" idiom that it is "space- >>> efficient". >>> Short of further explanation, I interpret this as "doesn't read the >>> whole fi

Re: Sort lines in a text file

2007-07-22 Thread leegold
...snip... > > Do your own homework. Hush troll. -- http://mail.python.org/mailman/listinfo/python-list

Re: recursively expanding $references in dictionaries

2007-07-22 Thread Alia Khouri
Oops, I left some redundant cruft in the function... here it is slightly cleaner: def expand(dikt): names = {} output = {} def _search(_, sourceDict): for key, value in sourceDict.items(): if isinstance(value, dict): _search({}, value) if

Re: custom plugin architecture: how to see parent namespace?

2007-07-22 Thread escalation746
Wojciech Mu a wrote: > These names don't match. I replaced Valuable() with proper name, > and everything work fine. That was a result of a transcription error when posting to the newsgroup. My actual test code did not have this error but nevertheless did not work. However, copying the code I *d

Re: idiom for RE matching

2007-07-22 Thread Gordon Airporte
[EMAIL PROTECTED] wrote: > Have you read and understood what MULTILINE means in the manual > section on re syntax? > > Essentially, you can make a single pattern which tests a match against > each line. > > -- Michael Dillon No, I have not looked into this - thank you. RE's are hard enough to g

Re: Where is the collections module?

2007-07-22 Thread Gordon Airporte
Gordon Airporte wrote: > I was going to try tweaking defaultdict, but I can't for the life of me > find where the collections module or its structures are defined. Python > 2.5. Thanks all. I was expecting it in Python. Time to dust off my C :-P -- http://mail.python.org/mailman/listinfo/python

Re: recursively expanding $references in dictionaries

2007-07-22 Thread Alia Khouri
Ok. I've reached a nice little conclusion here. Time to go to bed, but before that I thought I'd share the results (-; I can now read a yaml file which natively produces a dict tree and convert it into an object tree with attribute read/write access, dump that back into a readable yaml string, and

Re: Where is the collections module?

2007-07-22 Thread Jerry Hill
On 7/22/07, Gordon Airporte <[EMAIL PROTECTED]> wrote: > Gordon Airporte wrote: > > I was going to try tweaking defaultdict, but I can't for the life of me > > find where the collections module or its structures are defined. Python > > 2.5. > > Thanks all. I was expecting it in Python. Time to dust

Re: custom plugin architecture: how to see parent namespace?

2007-07-22 Thread escalation746
I have updated documentation for this on my blog, diagrammes modernes. Surf: http://diagrammes-modernes.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: URL parsing for the hard cases

2007-07-22 Thread John Nagle
[EMAIL PROTECTED] wrote: > Once you eliminate IPv6 addresses, parsing is simple. Is there a > colon? Then there is a port number. Does the left over have any > characters not in [0123456789.]? Then it is a name, not an IPv4 > address. > > --Michael Dillon > You wish. Hex input of IP address

Re: Re-running unittest

2007-07-22 Thread Gabriel Genellina
En Sun, 22 Jul 2007 17:43:03 -0300, Israel Fernández Cabrera <[EMAIL PROTECTED]> escribió: > I'm writing some code that automatically execute some registered unit > test in a way to automate the process. A sample code follows to > illustrate what I'm doing: > > > class PruebasDePrueba(unittest.

Re: idiom for RE matching

2007-07-22 Thread mik3l3374
On Jul 19, 12:52 pm, Gordon Airporte <[EMAIL PROTECTED]> wrote: > I have some code which relies on running each line of a file through a > large number of regexes which may or may not apply. For each pattern I > want to match I've been writing > > gotit = mypattern.findall(line) > if gotit: >

Re: custom plugin architecture: how to see parent namespace?

2007-07-22 Thread Jorge Godoy
escalation746 wrote: > I have updated documentation for this on my blog, diagrammes modernes. > Surf: > http://diagrammes-modernes.blogspot.com/ Your motivation looks a lot like what is solved by setuptools, eggs and entry points. http://peak.telecommunity.com/DevCenter/PkgResources http://docs.

Re: split on NO-BREAK SPACE

2007-07-22 Thread Ben Finney
Steve Holden <[EMAIL PROTECTED]> writes: > Well, if you're going to start answering questions with FACTS, how > can questioners reply on their prejudices to guide them any more? You clearly underestimate the capacity for such people to choose only the particular facts that support those prejudice

Configure apache to run python scripts

2007-07-22 Thread joe jacob
I need to configure apache to run python scripts. I followed the steps mentioned in this site (http://www.thesitewizard.com/archive/ addcgitoapache.shtml). But I am not able to run python scripts from Firefox, I got a forbidden error "you do not have permission to access the file in the server

Re: custom plugin architecture: how to see parent namespace?

2007-07-22 Thread escalation746
Jorge Godoy wrote: > escalation746 wrote: > > I have updated documentation for this on my blog, diagrammes modernes. > > Surf: > >http://diagrammes-modernes.blogspot.com/ > > Your motivation looks a lot like what is solved by setuptools, eggs and > entry points. Though that problem domain looks d

Re: URL parsing for the hard cases

2007-07-22 Thread John Nagle
Here's another hard case. This one might be a bug in urlparse: import urlparse s = 'ftp://administrator:[EMAIL PROTECTED]/originals/6 june 07/ebay/login/ebayisapi.html' urlparse.urlparse(s) yields: (u'ftp', u'administrator:[EMAIL PROTECTED]', u'/originals/6 june 07/ebay/login/ebayisapi.html

Re: Advice on sending images to clients over network

2007-07-22 Thread Frank Millman
Frank Millman wrote: > Hi all > > This is not strictly a Python question, but as the system to which > relates is written in Python, hopefully it is not too off-topic. > [...] > I now want to add the capability of displaying images on the client. > For example, if the application deals with proper

Re: URL parsing for the hard cases

2007-07-22 Thread Miles
On 7/23/07, John Nagle wrote: > Here's another hard case. This one might be a bug in urlparse: > > import urlparse > > s = 'ftp://administrator:[EMAIL PROTECTED]/originals/6 june > 07/ebay/login/ebayisapi.html' > > urlparse.urlparse(s) > > yields: > > (u'ftp', u'administrator:[EMAIL PROTECTED]', u

Re: importing a module from a specific directory

2007-07-22 Thread Gabriel Genellina
En Sun, 22 Jul 2007 09:03:43 -0300, O.R.Senthil Kumaran <[EMAIL PROTECTED]> escribió: >> I would like to organize them into directory structure in >> which there is a 'main' directory, and under it directories for >> specific sub-tasks, or sub-experiments, I'm running (let's call them >> 'A'

Re: Pickled objects over the network

2007-07-22 Thread Hendrik van Rooyen
"Steve Holden" <[EMAIL PROTECTED]> wrote: > Yes. Why? - Hendrik -- http://mail.python.org/mailman/listinfo/python-list