Re: How to tell easy_install that a package is already installed

2007-03-21 Thread Ben Finney
Charles Sanders <[EMAIL PROTECTED]> writes: > I am not sure if this is the right forum to ask this. If it is not, > could someone pleas point me to a more appropriate newsgroup. You want the distutils SIG mailing list for Python. Setuptools is an extension of Python's standard distutils. ht

replace illegal xml characters

2007-03-21 Thread killkolor
hi! I am working with InDesign exported xml and parse it in a python application. I learned here: http://boodebr.org/main/python/all-about-python-and-unicode that there actually are sets of illegal unicode characters for xml (and henceforth for every compliant xml parser). I already implemented a

Re[2]: coverage.py problem

2007-03-21 Thread Orin
Thank you very much. Just reading the comments on that url, I found the reason of my problem. It was here: --- coverage.py +++ coverage.py @@ -464,6 +464,8 @@ def collect(self): cache_dir, local = os.path.split(self.cache) + if not cache_dir: #this two strings was upsent + cache_dir = "

Re: How many connections can accept a 'binded' socket?

2007-03-21 Thread billiejoex
On 20 Mar, 17:44, John Nagle <[EMAIL PROTECTED]> wrote: > When you ask questions like this, please specify what > operating system you're using. Thanks. That was a Linux Ubuntu 6.10. I submitted a bug report on sourceforge: http://sourceforge.net/tracker/index.php?func=detail&aid=1685000&group_i

Re: replace illegal xml characters

2007-03-21 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, killkolor wrote: > I am working with InDesign exported xml and parse it in a python > application. I learned here: > http://boodebr.org/main/python/all-about-python-and-unicode > that there actually are sets of illegal unicode characters for xml > (and henceforth for every

Re: How to set SA_RESTART flag in Python

2007-03-21 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Marco wrote: > I want to set SA_RESTART flag to restart a system-call. How to do > this in Python? You question seems to lack a little bit context. Are you talking about system calls into the Linux kernel? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.or

Re: an enumerate question

2007-03-21 Thread Terry Hancock
[EMAIL PROTECTED] wrote: > say i want to enumerate lines of a file > eg > for n,l in enumerate(open("file")): > # print next line ie I think you'd find it much easier to move your frame of reference one line forward and think in terms of remembering the previous line, e.g.: for n,curr in en

Re: #!/usr/bin/env python > 2.4?

2007-03-21 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Stargaming wrote: > from sys import version_info > if version_info[0] < 2 or version_info[1] < 4: > raise RuntimeError("You need at least python2.4 to run this script") That'll fail when the major version number is increased (i.e. Python 3.0). You want: if

Unicode in Excel files

2007-03-21 Thread John Machin
On Mar 21, 11:37 am, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Tue, 2007-03-20 at 16:47 -0700, Gerry wrote: > > I'm still mystified why: > >qno was ever unicode, > > Thus quoth http://www.lexicon.net/sjmachin/xlrd.html "This module > presents all text strings as Python unicode objects." >

Re: How to calculate a file of equations in python

2007-03-21 Thread Boris Borcic
r='' for line in file : r = str(eval(r+line)) John wrote: > Hi, > I have a text file which contains math expression, like this > 134 > +234 > +234 > > (i.e. an operation (e.g. '+) and then a number and then a new line). > > Can you please tell me what is the easiest way to calculate that file? >

Re: Problem with sockets and python 2.5

2007-03-21 Thread Jose Alberto Reguero
El Lunes, 19 de Marzo de 2007, Jose Alberto Reguero escribió: > I had two programs, server.py and client.py(attached) > > 1: > server.py at i386 python 2.4 > client.py at x86_64 python 2.5 > Work > > 2: > server.py at x86_64 python 2.5 > client.py at i386 python 2.4 > Don't

encoding characters

2007-03-21 Thread Valentina Marotto
First: excuse me for my very little english! I have a problem, in my scripts python, with the encoding characters type àâäéèêëïîôöûùüç I use the twisted.web package. The problem is about the insertion data into database. one of errors is: exceptions.UnicodeEncodeError: 'ascii' codec can't enc

Re: Still the __new__ hell ...

2007-03-21 Thread Bruno Desthuilliers
Paulo da Silva a écrit : > Bruno Desthuilliers escreveu: >> Paulo da Silva a écrit : > ... > >>> class MyDate(date): >>> def __new__(cls,year,month=None,day=None): >>> if type(year) is str: >> And what if it's a unicode string ? >> The correct idiom here is: >> if isin

Exceptions and unicode messages

2007-03-21 Thread Tuomas
This works: >>> raise StandardError(u'Wrong type') Traceback (most recent call last): File "", line 1, in ? StandardError: Wrong type but don't in Finnish: >>> raise StandardError(u'Väärä tyyppi') Traceback (most recent call last): File "", line 1, in ? StandardError>>> >>> Any solution

Re: Wanted: a python24 package for Python 2.3

2007-03-21 Thread Jonathan Fine
Gerald Klix wrote: > Hi, > You can't import subproces from future, only syntactic and semantic > changes that will become standard feature in future python version can > be activated that way. > > You can copy the subprocess module from python 2.4 somewhere where it > will be found from python

Re: Exceptions and unicode messages

2007-03-21 Thread manish kurup
Hey anybody please tell me... How we can get the properties of a file in python On 3/21/07, Tuomas <[EMAIL PROTECTED]> wrote: This works: >>> raise StandardError(u'Wrong type') Traceback (most recent call last): File "", line 1, in ? StandardError: Wrong type but don't in Finnish: >>> r

Re: Unicode in Excel files

2007-03-21 Thread Gerry
On Mar 21, 6:07 am, "John Machin" <[EMAIL PROTECTED]> wrote: > On Mar 21, 11:37 am, Carsten Haese <[EMAIL PROTECTED]> wrote: > > > On Tue, 2007-03-20 at 16:47 -0700, Gerry wrote: > > > I'm still mystified why: > > >qno was ever unicode, > > > Thus quothhttp://www.lexicon.net/sjmachin/xlrd.html"

Re: Still the __new__ hell ...

2007-03-21 Thread Duncan Booth
Paulo da Silva <[EMAIL PROTECTED]> wrote: > As a relatively inexperient > in python, how could I know that a 'string' is an instance of > basestring? I think a good tip for anyone learning Python (or upgrading from an earlier version) is to do: dir(__builtins__) at the interactive prompt a

flattening/rolling up/aggregating a large sorted text file

2007-03-21 Thread adtvff
Hi, Given a large ascii file (delimited or fixed width) with one ID field and dimensions/measures fields, sorted by dimensions, I'd like to "flatten" or "rollup" the file by creating new columns: one for each combination of dimension level, and summing up measures over all records for a given ID.

scipy installations

2007-03-21 Thread gaddam bala
Hi all, I was trying to install (Scientific Python) scipy 0.3.2 in LINUX 3, but I am facing some problem.Please help me in resolving this issue. here are the steps that i have followed : Installed pre-requisites for scipy installations: 1. Python-2.4.1 $./configure $make $make install 2. ATLAS

Re: flattening/rolling up/aggregating a large sorted text file

2007-03-21 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hi, > > Given a large ascii file (delimited or fixed width) with one ID field > and dimensions/measures fields, sorted by dimensions, I'd like to > "flatten" or "rollup" the file by creating new columns: one for each > combination of dimension level, and summing up measu

Re: On Java's Interface (the meaning of interface in computer programing)

2007-03-21 Thread Lew
Xah Lee wrote: > In a functional language, a function can be specified by its name and Are you sure you know what a "functional language" is? > parameter specs. For example: > f(3) > f(3, [9,2]) > f("some string") This is not really "typical" syntax for a functional language. LISP, for example,

Re: replace illegal xml characters

2007-03-21 Thread killkolor
> Does InDesign export broken XML documents? What exactly is your problem? yes, unfortunately it does. it uses all possible unicode characters, though not all are alowed in valid xml (see link in the first post). in any way for my application i should be checking if the xml that comes in is valid

Garbage collection

2007-03-21 Thread Tom Wright
Hi all I suspect I may be missing something vital here, but Python's garbage collection doesn't seem to work as I expect it to. Here's a small test program which shows the problem on python 2.4 and 2.5: $ python2.5 Python 2.5 (release25-maint, Dec 9 2006, 15:33:01) [GCC 4.1.2 20061115 (prerele

Message ("Your message dated Wed, 21 Mar 2007 13:15:54...")

2007-03-21 Thread Dartmouth College LISTSERV Server (15.0)
Your message dated Wed, 21 Mar 2007 13:15:54 +0100 with subject "Returned mail: see transcript for details" has been submitted to the moderator of the CLASS-84 list: Martha Hartfiel '83 <[EMAIL PROTECTED]>. -- http://mail.python.org/mailman/listinfo/python-list

Re: Exceptions and unicode messages

2007-03-21 Thread kyosohma
On Mar 21, 6:03 am, Tuomas <[EMAIL PROTECTED]> wrote: > This works: > >>> raise StandardError(u'Wrong type') > Traceback (most recent call last): >File "", line 1, in ? > StandardError: Wrong type > > but don't in Finnish: > >>> raise StandardError(u'Väärä tyyppi') > Traceback (most recent ca

Re: Exceptions and unicode messages

2007-03-21 Thread kyosohma
On Mar 21, 6:03 am, Tuomas <[EMAIL PROTECTED]> wrote: > This works: > >>> raise StandardError(u'Wrong type') > Traceback (most recent call last): >File "", line 1, in ? > StandardError: Wrong type > > but don't in Finnish: > >>> raise StandardError(u'Väärä tyyppi') > Traceback (most recent ca

Re: On Java's Interface (the meaning of interface in computer programing)

2007-03-21 Thread Dr. Who
Don't Feed The Trolls :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Garbage collection

2007-03-21 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tom Wright wrote: > Hi all > > I suspect I may be missing something vital here, but Python's garbage > collection doesn't seem to work as I expect it to. Here's a small test > program which shows the problem on python 2.4 and 2.5: ... skip

Technical Answer - Protecting code in python

2007-03-21 Thread flit
Hello All, I have a hard question, every time I look for this answer its get out from the technical domain and goes on in the moral/social domain. First, I live in third world with bad gov., bad education, bad police and a lot of taxes and bills to pay, and yes I live in a democratic "state" (corr

Re: encoding characters

2007-03-21 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Valentina Marotto wrote: > > > The problem is about the insertion data into database. > > one of errors is: > > exceptions.UnicodeEncodeError: 'ascii' codec can't encode > characters in position 25-26: ordinal not in range(128) > >

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Tom Wright
flit wrote: > 1 - There is a way to make some program in python and protects it? I > am not talking about ultra hard-core protection, just a simple one > that will stop 90% script kiddies. Put it in an executable? It's more hidden than protected, but it will stop a fair few non-experts. I use and

Re: Garbage collection

2007-03-21 Thread skip
Tom> I suspect I may be missing something vital here, but Python's Tom> garbage collection doesn't seem to work as I expect it to. Here's Tom> a small test program which shows the problem on python 2.4 and 2.5: Tom> (at this point, Python is using 15MB) >>> a = range(int(1e7)

Re: Garbage collection

2007-03-21 Thread Tom Wright
Thinker wrote: > How do you know amount of memory used by Python? > ps ? top or something? $ ps up `pidof python2.5` USER PID %CPU %MEMVSZ RSS TTY STAT START TIME COMMAND tew2426275 0.0 11.9 257592 243988 pts/6 S+ 13:10 0:00 python2.5 "VSZ" is "Virtual Memory Size" (

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Diez B. Roggisch
flit wrote: > Hello All, > > I have a hard question, every time I look for this answer its get out > from the technical domain and goes on in the moral/social domain. > First, I live in third world with bad gov., bad education, bad police > and a lot of taxes and bills to pay, and yes I live in a

Re: Garbage collection

2007-03-21 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tom Wright wrote: > Thinker wrote: >> How do you know amount of memory used by Python? ps ? top or >> something? > > $ ps up `pidof python2.5` USER PID %CPU %MEM VSZ RSS TTY > STAT START TIME COMMAND tew24 26275 0.0 11.9 257592 243988 > pts/6 S+ 13:10

Re: #!/usr/bin/env python > 2.4?

2007-03-21 Thread Sion Arrowsmith
Jon Ribbens <[EMAIL PROTECTED]> wrote: >You want: > > if sys.hexversion < 0x020400f0: >... error ... "Readability counts." if sys.version_info < (2, 4): ... error ... -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/ ___ | "Frankly I have no feelings towards penguins o

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Bart Ogryczak
On Mar 21, 2:36 pm, "flit" <[EMAIL PROTECTED]> wrote: > Now the technical question: > > 1 - There is a way to make some program in python and protects it? I > am not talking about ultra hard-core protection, just a simple one > that will stop 90% script kiddies. Freeze. That should be hard enough

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Carsten Haese
On Wed, 2007-03-21 at 06:36 -0700, flit wrote: > Hello All, > > I have a hard question, every time I look for this answer its get out > from the technical domain and goes on in the moral/social domain. > First, I live in third world with bad gov., bad education, bad police > and a lot of taxes and

writing dictionaries to a file

2007-03-21 Thread kavitha thankaian
Hi All, I have two dictionaries: somex:{'unit':00, type:'processing'} somey:{'comment':'fair', 'code':'aaa'} somey:{'comment':'good', 'code':bbb'} somey:{'comment':'excellent', 'code':'ccc'} now i would like to write this to a file in the following format(unit, code

why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread dmitrey
Hi all, I looked to the PEPs & didn't find a proposition to remove brackets & commas for to make Python func call syntax caml- or tcl- like: instead of result = myfun(param1, myfun2(param5, param8), param3) just make possible using result = myfun param1 (myfun2 param5 param8) param3 it would redu

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Miki
Hello Dmitrey, > I looked to the PEPs & didn't find a proposition to remove brackets & > commas for to make Python func call syntax caml- or tcl- like: instead > of > result = myfun(param1, myfun2(param5, param8), param3) > just make possible using > result = myfun param1 (myfun2 param5 param8) p

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread dmitrey
I think it should result result = func1(func2, arg) if you want result = func1(func2(arg)) you should use result = func1 (func2 arg) if ... = word1 word2 word3 ... then only word "word1" should be call to func "word1" with parameters word2, word3 etc > If you have > result = func1 func2 arg > is

Testing Python updates

2007-03-21 Thread Matthew
Hello: What is the methodology for testing the updates to the Python language? Thanks Matthew Harelick -- http://mail.python.org/mailman/listinfo/python-list

Re: Garbage collection

2007-03-21 Thread Tom Wright
[EMAIL PROTECTED] wrote: > You haven't forgotten to do anything. Your attempts at freeing memory are > being thwarted (in part, at least) by Python's int free list. I believe > the int free list remains after the 10M individual ints' refcounts drop to > zero. The large storage for the list is gra

Re: Garbage collection

2007-03-21 Thread skip
Tom> ...and then I allocate a lot of memory in another process (eg. open Tom> a load of files in the GIMP), then the computer swaps the Python Tom> process out to disk to free up the necessary space. Python's Tom> memory use is still reported as 953 MB, even though nothing like

Re: replace illegal xml characters

2007-03-21 Thread kyosohma
On Mar 21, 8:03 am, "killkolor" <[EMAIL PROTECTED]> wrote: > > Does InDesign export broken XML documents? What exactly is your problem? > > yes, unfortunately it does. it uses all possible unicode characters, > though not all are alowed in valid xml (see link in the first post). > in any way for m

Re: difference between urllib2.urlopen and firefox view 'page source'?

2007-03-21 Thread cjl
Group: Thank you for all the informative replies, they have helped me figure things out. Next up is learning beautiful soup. Thank you for the code example, but I am trying to learn how to 'screen scrape', because Yahoo does make historical stock data available using the CSV format, but they do n

Re: replace illegal xml characters

2007-03-21 Thread Diez B. Roggisch
killkolor wrote: >> Does InDesign export broken XML documents? What exactly is your problem? > > yes, unfortunately it does. it uses all possible unicode characters, > though not all are alowed in valid xml (see link in the first post). > in any way for my application i should be checking if the

regex reading html

2007-03-21 Thread ben miller
Hello, I've a program I'm working on where we scrape some of our web pages using Mechanize libraries and then parse what we've scraped using different regex functions. However, I've noticed that no matter what I do with the scraped content, regex functions can't find what they're trying to match. I

Re: Garbage collection

2007-03-21 Thread Tom Wright
[EMAIL PROTECTED] wrote: > Tom> ...and then I allocate a lot of memory in another process (eg. > open Tom> a load of files in the GIMP), then the computer swaps the > Python > Tom> process out to disk to free up the necessary space. Python's > Tom> memory use is still reported

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Bjoern Schliessmann
dmitrey wrote: > it would reduce length of code lines and make them more readable, > + no needs to write annoing charecters. IMHO, it's less readable. I suppose I'm not on my own with this opinion. Regards, Björn -- BOFH excuse #34: (l)user error -- http://mail.python.org/mailman/listinf

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Diez B. Roggisch
dmitrey wrote: > Hi all, > I looked to the PEPs & didn't find a proposition to remove brackets & > commas for to make Python func call syntax caml- or tcl- like: instead > of > result = myfun(param1, myfun2(param5, param8), param3) > just make possible using > result = myfun param1 (myfun2 param5

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Piet van Oostrum
> "dmitrey" <[EMAIL PROTECTED]> (d) wrote: >d> I think it should result >d> result = func1(func2, arg) >d> if you want >d> result = func1(func2(arg)) >d> you should use >d> result = func1 (func2 arg) >d> if >d> ... = word1 word2 word3 ... >d> then only word "word1" should be call to func "word

Re: Garbage collection

2007-03-21 Thread Steve Holden
Tom Wright wrote: > [EMAIL PROTECTED] wrote: >> Tom> ...and then I allocate a lot of memory in another process (eg. >> open Tom> a load of files in the GIMP), then the computer swaps the >> Python >> Tom> process out to disk to free up the necessary space. Python's >> Tom> memo

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Jason
On Mar 21, 8:38 am, "dmitrey" <[EMAIL PROTECTED]> wrote: > Hi all, > I looked to the PEPs & didn't find a proposition to remove brackets & > commas for to make Python func call syntax caml- or tcl- like: instead > of > result = myfun(param1, myfun2(param5, param8), param3) > just make possible usin

Re: socket.getfqdn deadlock

2007-03-21 Thread Greg Copeland
On Mar 20, 2:23 pm, [EMAIL PROTECTED] wrote: > Hi, > > I am getting deadlocks (backtrace pasted below) after a while at, > presumably, a socket.getfqdn() call in a child process . > > Fwiw: This child process is created as the result of a pyro call to a > Pyro object. > > Any ideas why this is happ

Re: Garbage collection

2007-03-21 Thread skip
Tom> True, but why does Python hang on to the memory at all? As I Tom> understand it, it's keeping a big lump of memory on the int free Tom> list in order to make future allocations of large numbers of Tom> integers faster. If that memory is about to be paged out, then Tom> s

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Duncan Booth
"dmitrey" <[EMAIL PROTECTED]> wrote: > + it will not yield incompabilities with previous Python versions. So how would you write: func(-3) func(*param) with your scheme? These already have an incompatible meaning: func -3 func *param1 -- http://mail.python.org/mailman/list

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Bart Ogryczak
On Mar 21, 3:38 pm, "dmitrey" <[EMAIL PROTECTED]> wrote: > Hi all, > I looked to the PEPs & didn't find a proposition to remove brackets & > commas for to make Python func call syntax caml- or tcl- like: instead > of > result = myfun(param1, myfun2(param5, param8), param3) > just make possible usin

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Steven D'Aprano
On Wed, 21 Mar 2007 06:36:16 -0700, flit wrote: > 1 - There is a way to make some program in python and protects it? I > am not talking about ultra hard-core protection, just a simple one > that will stop 90% script kiddies. Protect it from what? Viruses? Terrorists? The corrupt government? Your

Re: Garbage collection

2007-03-21 Thread Steven D'Aprano
On Wed, 21 Mar 2007 15:03:17 +, Tom Wright wrote: [snip] > Ah, thanks for explaining that. I'm a little wiser about memory allocation > now, but am still having problems reclaiming memory from unused objects > within Python. If I do the following: > > (memory use: 15 MB) a = rang

Delete a function

2007-03-21 Thread gtb
After a function has been imported to a shell how may it be deleted so that after editing it can reloaded anew? thanx, gtb -- http://mail.python.org/mailman/listinfo/python-list

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Steven D'Aprano
On Wed, 21 Mar 2007 07:55:08 -0700, dmitrey top posted: > I think it should result What's "it"? Please don't top post, it makes your answer hard to understand and makes your readers have to do more work to read your posts. We're not being paid to read your posts, so I'd estimate that about 70% of

Re: Exceptions and unicode messages

2007-03-21 Thread Tuomas
This seems to work: >>> import sys, traceback >>> def excepthook(exctype, value, tb): ... if tb: ... lines = traceback.format_tb(tb) ... for i, line in zip(range(len(lines)), lines): ... lines[i] = lines[i].decode('utf8') ... lines.insert(0, u'Traceback (

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Steve Holden
Bart Ogryczak wrote: > On Mar 21, 3:38 pm, "dmitrey" <[EMAIL PROTECTED]> wrote: >> Hi all, >> I looked to the PEPs & didn't find a proposition to remove brackets & >> commas for to make Python func call syntax caml- or tcl- like: instead >> of >> result = myfun(param1, myfun2(param5, param8), param

Re: Delete a function

2007-03-21 Thread Steve Holden
gtb wrote: > After a function has been imported to a shell how may it be deleted so > that after editing it can reloaded anew? Use the built-in reload() function to reload the module that defines the function. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LL

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread dmitrey
>foo bar baz >foo(bar,baz) 1st still is shorter by 1 char; considering majority of people use space after comma & number of parameters can be big it yileds foo bar baz bar2 bar3 bar4 vs foo(bar, baz, bar2, bar3, bar4) > result = func1 for this case should using result = func1() should remain + re

Making faster scientific calculations...

2007-03-21 Thread dsign
Ok, this is my first post to this list and don't know if it's the right one. I'm currently making sort of a scientific application. Most data structures and algorithmic knots are in C++, and from there I have a set of extension modules to Python. So, users of the app don't have to compile or ever

Re: Technical Answer - Protecting code in python

2007-03-21 Thread flit
First I wanna thanks the all people who gives good contribution to this thread, thank you all.. Now I have something more to say: OK, that kind of answer is what I was trying to avoid.. On Mar 21, 1:23 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 21 Mar 2007 06:36:16 -0700, flit wrote

Re: Garbage collection

2007-03-21 Thread Steven D'Aprano
On Wed, 21 Mar 2007 15:32:17 +, Tom Wright wrote: >> Memory contention would be a problem if your Python process wanted to keep >> that memory active at the same time as you were running GIMP. > > True, but why does Python hang on to the memory at all? As I understand it, > it's keeping a bi

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Bruno Desthuilliers
dmitrey a écrit : > Hi all, > I looked to the PEPs & didn't find a proposition to remove brackets & > commas for to make Python func call syntax caml- or tcl- like: instead > of > result = myfun(param1, myfun2(param5, param8), param3) > just make possible using > result = myfun param1 (myfun2 para

Re: Delete a function

2007-03-21 Thread gtb
On Mar 21, 11:37 am, Steve Holden <[EMAIL PROTECTED]> wrote: > gtb wrote: > > After a function has been imported to a shell how may it be deleted so > > that after editing it can reloaded anew? > > Use the built-in reload() function to reload the module that defines the > function. > > regards >

Re: Garbage collection

2007-03-21 Thread Tom Wright
Steven D'Aprano wrote: > You've described an extremely artificial set of circumstances: you create > 40,000,000 distinct integers, then immediately destroy them. The obvious > solution to that "problem" of Python caching millions of integers you > don't need is not to create them in the first place

Re: Garbage collection

2007-03-21 Thread Tom Wright
Steve Holden wrote: > Easy to say. How do you know the memory that's not in use is in a > contiguous block suitable for return to the operating system? I can > pretty much guarantee it won't be. CPython doesn't use a relocating > garbage collection scheme Fair point. That is difficult and I don't

Re: Delete a function

2007-03-21 Thread Peter Otten
gtb wrote: > On Mar 21, 11:37 am, Steve Holden <[EMAIL PROTECTED]> wrote: >> gtb wrote: >> > After a function has been imported to a shell how may it be deleted so >> > that after editing it can reloaded anew? >> >> Use the built-in reload() function to reload the module that defines the >> functi

Re: Garbage collection

2007-03-21 Thread Tom Wright
[EMAIL PROTECTED] wrote: > If your program's behavior is: > > * allocate a list of 1e7 ints > * delete that list > > how does the Python interpreter know your next bit of execution won't be > to repeat the allocation? It doesn't know, but if the program runs for a while without repeating

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Steven D'Aprano
On Wed, 21 Mar 2007 09:56:12 -0700, flit wrote: > First I wanna thanks the all people who gives good contribution to > this thread, thank you all.. But they haven't. They've given answers to an ill-posed question. How can anyone tell you how to "protect code" when you haven't told us what you wan

Re: Testing Python updates

2007-03-21 Thread Terry Reedy
"Matthew" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | What is the methodology for testing the updates to the Python language? By who? There is an expanding /test directory in the pythonx.y/Lib directory. Core developers run these about once a day on multiple systems. People

Re: #!/usr/bin/env python > 2.4?

2007-03-21 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Sion Arrowsmith wrote: > Jon Ribbens <[EMAIL PROTECTED]> wrote: >> if sys.hexversion < 0x020400f0: >>... error ... > > "Readability counts." > > if sys.version_info < (2, 4): > ... error ... Maybe you should suggest a patch to the Python documentation th

parsing tables with beautiful soup?

2007-03-21 Thread cjl
I am learning python and beautiful soup, and I'm stuck. A web page has a table that contains data I would like to scrape. The table has a unique class, so I can use: soup.find("table", {"class": "class_name"}) This isolates the table. So far, so good. Next, this table has a certain number of row

Re: Delete a function

2007-03-21 Thread Steve Holden
gtb wrote: > On Mar 21, 11:37 am, Steve Holden <[EMAIL PROTECTED]> wrote: >> gtb wrote: >>> After a function has been imported to a shell how may it be deleted so >>> that after editing it can reloaded anew? >> Use the built-in reload() function to reload the module that defines the >> function. >>

Re: Delete a function

2007-03-21 Thread paul
gtb schrieb: > On Mar 21, 11:37 am, Steve Holden <[EMAIL PROTECTED]> wrote: >> gtb wrote: >>> After a function has been imported to a shell how may it be deleted so >>> that after editing it can reloaded anew? >> Use the built-in reload() function to reload the module that defines the >> function.

Re: Garbage collection

2007-03-21 Thread Steve Holden
Tom Wright wrote: > Steven D'Aprano wrote: >> You've described an extremely artificial set of circumstances: you create >> 40,000,000 distinct integers, then immediately destroy them. The obvious >> solution to that "problem" of Python caching millions of integers you >> don't need is not to create

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Steven Bethard
dmitrey wrote: > I looked to the PEPs & didn't find a proposition to remove brackets & > commas for to make Python func call syntax caml- or tcl- like: instead > of > result = myfun(param1, myfun2(param5, param8), param3) > just make possible using > result = myfun param1 (myfun2 param5 param8) pa

2 Command prompt at the same time

2007-03-21 Thread Boudreau, Emile
Hello, I have two batch files and I'm trying to run them in parallel. I haven't been able to find any information on how to make python open 2 command prompt and then make each prompt run one of the batch files. Can anyone point me in the right direction? Thanks, Emile Boudreau Th

Re: Garbage collection

2007-03-21 Thread Steven D'Aprano
On Wed, 21 Mar 2007 17:19:23 +, Tom Wright wrote: >> So what's your actual problem that you are trying to solve? > > I have a program which reads a few thousand text files, converts each to a > list (with readlines()), creates a short summary of the contents of each (a > few floating point nu

Re: Testing Python updates

2007-03-21 Thread Steve Holden
Matthew wrote: > Hello: > > What is the methodology for testing the updates to the Python > language? http://www.pybots.org/ regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve

Re: parsing tables with beautiful soup?

2007-03-21 Thread cjl
This works: for row in soup.find("table",{"class": "class_name"}): for cell in row: print cell.contents[0] Is there a better way to do this? -cjl -- http://mail.python.org/mailman/listinfo/python-list

Re: replace illegal xml characters

2007-03-21 Thread Irmen de Jong
killkolor wrote: >> Does InDesign export broken XML documents? What exactly is your problem? > > yes, unfortunately it does. it uses all possible unicode characters, > though not all are alowed in valid xml (see link in the first post). Are you sure about this? Could you post a small example? I

Re: Technical Answer - Protecting code in python

2007-03-21 Thread gtb
On Mar 21, 8:36 am, "flit" <[EMAIL PROTECTED]> wrote: > Hello All, > > I have a hard question, every time I look for this answer its get out > from the technical domain and goes on in the moral/social domain. > First, I live in third world with bad gov., bad education, bad police > and a lot of tax

Re: why brackets & commas in func calls can't be ommited? (maybe it couldbe PEP?)

2007-03-21 Thread Terry Reedy
You asked two questions; the first others have asked also. Mathematicians sometimes use brackets to indicate function application and sometimes just juxtaposition. When they do the latter and when there are things other than functions (to exclude pure lambda calculus), then there are usually (

parsing combination strings

2007-03-21 Thread PKKR
I need a fast and efficient way to parse a combination string(digits + chars) ex: s = "12ABA" or "1ACD" or "123CSD" etc I want to parse the the above string such that i can grab only the first digits and ignore the rest of the chacters, so if i have s = "12ABA" , parser(s) should give me "12" or

Re: flattening/rolling up/aggregating a large sorted text file

2007-03-21 Thread Shane Geiger
Apparently you want to use this data to know how many blue circles, blue squares, red circles and red squares. In other words, I doubt you want to output redundant data columns, you just want this data in a more usable format and that you don't actually need to do multiple passes over it. Th

Re: why brackets & commas in func calls can't be ommited? (maybe it couldbe PEP?)

2007-03-21 Thread bearophileHUGS
I have nothing against brackets, and I think Python has used them for too much time to allow a so big change in its syntax. But I think in some situations Ruby allows to omit them, solving some of the "impossibile" problems shown in this thread. This makes Ruby a bit better than Python to create ap

Re: How to copy a ClassObject?

2007-03-21 Thread Karlo Lozovina
Duncan Booth <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Consider yourself corrected. > > You could do what you are attempting with: > >tmp = new.classobj('tmp', First.__bases__, dict(First.__dict__)) > > which creates a new class named 'tmp' with the same base classes and > a c

Re: parsing combination strings

2007-03-21 Thread Tommy Nordgren
On 21 mar 2007, at 19.42, PKKR wrote: > I need a fast and efficient way to parse a combination string(digits + > chars) > > ex: s = "12ABA" or "1ACD" or "123CSD" etc > > I want to parse the the above string such that i can grab only the > first digits and ignore the rest of the chacters, > > so i

Re: parsing combination strings

2007-03-21 Thread Steven D. Arnold
On Mar 21, 2007, at 2:42 PM, PKKR wrote: > I need a fast and efficient way to parse a combination string(digits + > chars) > > ex: s = "12ABA" or "1ACD" or "123CSD" etc > > I want to parse the the above string such that i can grab only the > first digits and ignore the rest of the chacters, A rege

Re: parsing combination strings

2007-03-21 Thread kyosohma
On Mar 21, 1:42 pm, "PKKR" <[EMAIL PROTECTED]> wrote: > I need a fast and efficient way to parse a combination string(digits + > chars) > > ex: s = "12ABA" or "1ACD" or "123CSD" etc > > I want to parse the the above string such that i can grab only the > first digits and ignore the rest of the chac

Re: parsing combination strings

2007-03-21 Thread PKKR
ah ok, i guess something like this should do it for me then? re.split('[^0-9]', str)[0] -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >