Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-02 Thread Bengt Richter
On 1 Dec 2005 05:45:54 -0800, "Niels L Ellegaard" <[EMAIL PROTECTED]> wrote: >I just started learning python and I have been wondering. Is there a >short pythonic way to find the element, x, of a list, mylist, that >maximizes an expression f(x). > >In other words I am looking for a short version o

Re: super() and multiple inheritance

2005-12-02 Thread Michele Simionato
Hermy: > So, for the moment my conclusion is that although Python has some > syntax for multiple inheritance, it doesn't support it very well, and I should > probably stick to single inheritance. This is not much a problem of Python, the problem is that multiple inheritance is intrinsically HARD t

Re: ANN: Louie-1.0b2 - Signal dispatching mechanism

2005-12-02 Thread Thomas Heller
"Pat" <[EMAIL PROTECTED]> writes: > Thomas Heller wrote: >> >> What is the difference between PyDispatcher and Louie? >> (I'm still using a hacked version of the original cookbook recipe...) > > Not too much at this point, but the general differences are listed on > this page: > > http://louie.ber

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-02 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > Thanks. In that case, would it be easier to understand(beside the > original iterative loop) if I use reduce and lambda ? > You could try putting them side by side and seeing which is easiest for someone to understand: reduce(lambda (mv,mx), (v,x): mv > v and (mv,mx) o

Re: Instances behaviour

2005-12-02 Thread Peter Otten
Mr.Rech wrote: > Suppose I have a bunch of classes that represent slightly (but > conceptually) different object. The instances of each class must behave > in very similar manner, so that I've created a common class ancestor > (let say A) that define a lot of special method (such as __getattr__, >

Re: Is Python string immutable?

2005-12-02 Thread Martin Franklin
Chris Mellon wrote: > On 11/30/05, could ildg <[EMAIL PROTECTED]> wrote: > >>In java and C# String is immutable, str=str+"some more" will return a new >>string and leave some gargabe. >>so in java and C# if there are some frequent string operation, >>StringBuilder/StringBuffer is recommanded. >> >

Re: General question about Python design goals

2005-12-02 Thread Duncan Booth
Alex Martelli wrote: > Yep -- "time tuples" have also become pseudo-tuples (each element can be > accessed by name as well as by index) a while ago, and I believe there's > one more example besides stats and times (but I can't recall which one). Apart from time and os.stat all the uses seem to be

Re: Is there no compression support for large sized strings in Python?

2005-12-02 Thread Claudio Grondi
"Gerald Klix" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Did you consider the mmap library? > Perhaps it is possible to avoid to hold these big stings in memory. > BTW: AFAIK it is not possible in 32bit windows for an ordinary programm > to allocate more than 2 GB. That re

Re: Is Python string immutable?

2005-12-02 Thread Steve Holden
could ildg wrote: > In java and C# String is immutable, str=str+"some more" will return a > new string and leave some gargabe. > so in java and C# if there are some frequent string operation, > StringBuilder/StringBuffer is recommanded. > > Will string operation in python also leave some garbag

Re: Instances behaviour

2005-12-02 Thread bruno at modulix
Inyeol Lee wrote: (snip) class A(object): ... def __init__(self, foo): ... if self.__class__ is A: ... raise TypeError("A is base class.") s/TypeError/NotImplementedError/ s/base class/abstract class/ -- bruno desthuilliers python -c "pri

Re: Death to tuples!

2005-12-02 Thread Antoon Pardon
On 2005-12-01, Mike Meyer <[EMAIL PROTECTED]> wrote: > Antoon Pardon <[EMAIL PROTECTED]> writes: >> On 2005-12-01, Mike Meyer <[EMAIL PROTECTED]> wrote: >>> Antoon Pardon <[EMAIL PROTECTED]> writes: I know what happens, I would like to know, why they made this choice. One could argue that

Re: Instances behaviour

2005-12-02 Thread Mr.Rech
Thanks for your suggestions. They are very usefull and indeed bypass my problem. However, I've found a (perhaps) more elegant way to get the same result using metaclasses. My idea is to define my classes as follows: >>> class meta_A(type): def __new__(cls, classname, bases, classdict):

Re: Problem cmpiling M2Crypto

2005-12-02 Thread Thomas G. Apostolou
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thomas G. Apostolou wrote: > > > I still get the error: > > "SWIG/_m2crypto.c(80) : fatal error C1083: Cannot open include file: > > 'Python.h': No such file or directory > > error: command '"C:\Program Files\Microsoft Vi

Re: Compiling Guppy-PE extension modules

2005-12-02 Thread Sverker Nilsson
"Claudio Grondi" <[EMAIL PROTECTED]> wrote: > but the problem with sets.c remains: > > C:\VisualC++NET2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /G7 /GX > /DNDEBUG -IE:\Python24\include -IE:\Python24\PC /Tcsrc/sets/sets.c > /Fobuild\temp.win32-2.4\Re > lease\src/sets/sets.obj > sets.c > src\sets\s

Re: Instances behaviour

2005-12-02 Thread Peter Otten
Mr.Rech wrote: > Thanks for your suggestions. They are very usefull and indeed bypass my > problem. However, I've found a (perhaps) more elegant way to get the > same result using metaclasses. My idea is to define my classes as > follows: > class meta_A(type): > def __new__(cls, cl

Re: Compiling Guppy-PE extension modules

2005-12-02 Thread Claudio Grondi
"Sverker Nilsson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > "Claudio Grondi" <[EMAIL PROTECTED]> wrote: > > > but the problem with sets.c remains: > > > > C:\VisualC++NET2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /G7 /GX > > /DNDEBUG -IE:\Python24\include -IE:\Python24\PC

Re: Need help on designing a project

2005-12-02 Thread Steve Holden
Mardy wrote: > Hi all, > I'm starting to think the way I've implemented my program > (http://www.mardy.it/eligante) is all wrong. > Basically, what I want is a web application, which might run as CGI > scripts in apache (and this is working) or even as a standalone > application, in which case it

Re: Instances behaviour

2005-12-02 Thread bruno at modulix
Mr.Rech wrote: > Thanks for your suggestions. They are very usefull and indeed bypass my > problem. However, I've found a (perhaps) more elegant way to get the > same result using metaclasses. (snip code) > > I know metaclasses are a complete different beast, anyway I find this > approach more

How to creat a file?

2005-12-02 Thread sandorf
I'm new to python. Have a simple question. "open" function can only open an existing file and raise a IOerror when the given file does not exist. How can I creat a new file then? -- http://mail.python.org/mailman/listinfo/python-list

Import path for unit tests

2005-12-02 Thread Ben Finney
Howdy all, My practice when writing unit tests for a project is to make 'test/' subdirectories for each directory containing modules I want to test. project-foo/ +-- lib/ | +-- test/ +-- data/ +-- gui/ | +-- test/ +-- server/ +-- test/ This means that I ne

Re: Problem cmpiling M2Crypto under Plone

2005-12-02 Thread Fredrik Lundh
Thomas G. Apostolou wrote: > So what you say is that the Python installed with Plone doesn't have > Python.h in ./include but Python installers from Python.org do have the > file? that's likely, given building didn't work for you. after all, Plone's an application that happens to include a Pytho

Re: python speed

2005-12-02 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > DecInt's division algorithm is completely general also. But I would > never claim that Python code is faster than assembler. I believe that > careful implementation of a good algorithm is more important than the > raw speed of the language or efficiency of the compiler.

Re: How to creat a file?

2005-12-02 Thread Laurent RAHUEL
sandorf wrote: > I'm new to python. Have a simple question. > > "open" function can only open an existing file and raise a IOerror when > the given file does not exist. How can I creat a new file then? fic = open('test.txt', 'w') fic.write('Hello world') fic.close() -- http://mail.python.org/

Re: How to creat a file?

2005-12-02 Thread Wolfram Kraus
sandorf wrote: > I'm new to python. Have a simple question. > > "open" function can only open an existing file and raise a IOerror when > the given file does not exist. How can I creat a new file then? > open the new file in write mode: open('foo', 'w') See: help(open) HTH, Wolfram -- http://ma

Re: How to creat a file?

2005-12-02 Thread Juho Schultz
sandorf wrote: > I'm new to python. Have a simple question. > > "open" function can only open an existing file and raise a IOerror when > the given file does not exist. How can I creat a new file then? > You already have two correct answers. A warning: if you open a existing file for writing, it

Re: How to creat a file?

2005-12-02 Thread Fredrik Lundh
"sandorf" <[EMAIL PROTECTED]> wrote: > I'm new to python. Have a simple question. > > "open" function can only open an existing file and raise a IOerror when > the given file does not exist. How can I creat a new file then? reading the documentation might help: >>> help(open) class file(object)

Re: Death to tuples!

2005-12-02 Thread Antoon Pardon
On 2005-12-02, Bengt Richter <[EMAIL PROTECTED]> wrote: > On 1 Dec 2005 09:24:30 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: > >>On 2005-11-30, Duncan Booth <[EMAIL PROTECTED]> wrote: >>> Antoon Pardon wrote: >>> > The left one is equivalent to: > > __anon = [] > def Foo(l): >

Re: aligning a set of word substrings to sentence

2005-12-02 Thread Fredrik Lundh
Steven Bethard wrote: >>> I feel like there should be a simpler solution (maybe with the re >>> module?) but I can't figure one out. Any suggestions? >> >> using the finditer pattern I just posted in another thread: >> >> tokens = ['She', "'s", 'gon', 'na', 'write', 'a', 'book', '?'] >> text = ''

Re: CGI module does not parse data

2005-12-02 Thread Mardy
Le die Thu, 01 Dec 2005 15:08:14 -0800, amfr ha scribite: > I have included some of the content of that file, I am writing this as > an extension to my ebserver which is based on BaseHTTPServer. This > part of the code was taken directly from the CGIHTTPServer file, > nothing changed I did the s

Re: Import path for unit tests

2005-12-02 Thread Duncan Booth
Ben Finney wrote: > This works, so long as the foomodule is *not* in the path before the > appended '..' directory. When writing unit tests for a development > version of a package that is already installed at an older version in > the Python path, this fails: the unit tests are not importing the

why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Adriano Ferreira
Many Python scripts I see start with the shebang line #!/usr/bin/env python What is the difference from using just #!python Regards, Adriano. -- http://mail.python.org/mailman/listinfo/python-list

Re: (newbie) N-uples from list of lists

2005-12-02 Thread Martin Miller
I'd be interested in seeing the one liner using reduce you mentioned -- how it might be done that way isn't obvious to me. Another aspect of Taschuk's solution I like and think is important is the fact that it is truly iterative in the sense that calling it returns a generator which will yield eac

Re: How to creat a file?

2005-12-02 Thread sandorf
Thank to you all, guys. Here's another question: I'm using the Windows version of Python and IDLE. When I debug my .py file, my modification to the .py file does not seem to take effect unless I restart IDLE. Saving the file and re-importing it doesn't help either. Where's the problem? -- http:/

Re: Why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Klaus Alexander Seistrup
Adriano Ferreira wrote: > Many Python scripts I see start with the shebang line > > #!/usr/bin/env python > > What is the difference from using just > > #!python #v+ $ ls -l /tmp/hello.py -rwxr-xr-x 1 klaus klaus 38 2005-12-02 14:59 /tmp/hello.py $ cat /tmp/hello.py #! python print 'Hello, worl

Re: New Ordered Dictionery to Criticise

2005-12-02 Thread Fuzzyman
Hello Bengt, Bengt Richter wrote: > On 1 Dec 2005 03:38:37 -0800, "Fuzzyman" <[EMAIL PROTECTED]> wrote: > > > > >Fuzzyman wrote: > >> Sorry for this hurried message - I've done a new implementation of out > >> ordered dict. This comes out of the discussion on this newsgroup (see > >> blog entry fo

Re: Why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Adriano Ferreira
On 12/2/05, Klaus Alexander Seistrup <[EMAIL PROTECTED]> wrote: > #v+ > > $ ls -l /tmp/hello.py > -rwxr-xr-x 1 klaus klaus 38 2005-12-02 14:59 /tmp/hello.py > $ cat /tmp/hello.py > #! python > print 'Hello, world!' > # eof > $ /tmp/hello.py > bash: /tmp/hello.py: python: bad interpreter: No such f

Re: why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Fredrik Lundh
Adriano Ferreira wrote: > Many Python scripts I see start with the shebang line > > #!/usr/bin/env python > > What is the difference from using just > > #!python $ more test.py #!python print "hello" $ chmod +x test.py $ ./test.py -bash: ./test.py: python: bad interpreter: No such file or directo

Re: XML and namespaces

2005-12-02 Thread uche . ogbuji
Quoting Andrew Kuchling: """ > >>> element = document.createElementNS("DAV:", "href") This call is incorrect; the signature is createElementNS(namespaceURI, qualifiedName). """ Not at all, Andrew. "href" is a valid qname, as is "foo:href". The prefix is optional in a QName. Here is the

Why my modification of source file doesn't take effect when debugging?

2005-12-02 Thread sandorf
I'm using the Windows version of Python and IDLE. When I debug my .py file, my modification to the .py file does not seem to take effect unless I restart IDLE. Saving the file and re-importing it doesn't help either. Where's the problem? Thanks. -- http://mail.python.org/mailman/listinfo/pytho

Re: Why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Klaus Alexander Seistrup
Adriano Ferreira skrev: >> #v+ >> >> $ ls -l /tmp/hello.py >> -rwxr-xr-x 1 klaus klaus 38 2005-12-02 14:59 /tmp/hello.py >> $ cat /tmp/hello.py >> #! python >> print 'Hello, world!' >> # eof >> $ /tmp/hello.py >> bash: /tmp/hello.py: python: bad interpreter: No such file or directory >> $ >> >> #

Re: Instances behaviour

2005-12-02 Thread Mr.Rech
I see your point. Looking again at my metaclass implementation and comparing it with your abstract class + inheritance approach it turns out that the latter is definetively more straightforward, easier to maintain and all in all more pythonic. Sorry, but being an OOP newbie put me in the position

Re: Why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Carsten Haese
On Fri, 2005-12-02 at 09:12, Adriano Ferreira wrote: > On 12/2/05, Klaus Alexander Seistrup <[EMAIL PROTECTED]> wrote: > > #v+ > > > > $ ls -l /tmp/hello.py > > -rwxr-xr-x 1 klaus klaus 38 2005-12-02 14:59 /tmp/hello.py > > $ cat /tmp/hello.py > > #! python > > print 'Hello, world!' > > # eof > >

Re: Eclipse best/good or bad IDE for Python?

2005-12-02 Thread Jean-François Doyon
I'm a big fan of Eclipse and reocmmend it to anyone who asks :) No one can say any one is the *best*, since it's a matter of taste, but it's pretty darn good. The main benefit IMO is it's felibility ... Eclipse is a *framework*, that can handle lots things quite well, like HTML (If you're coding

Re: Why my modification of source file doesn't take effect when debugging?

2005-12-02 Thread Jeremy Jones
sandorf wrote: >I'm using the Windows version of Python and IDLE. When I debug my .py >file, my modification to the .py file does not seem to take effect >unless I restart IDLE. Saving the file and re-importing it doesn't help > >either. Where's the problem? > >Thanks. > > > No problem. Just r

Setting PYTHONPATH from Makefile

2005-12-02 Thread [EMAIL PROTECTED]
I have a Makefile target that uses a python script, like: %.abc: %.def python myscript.py The problem is that myscript.py and some modules that myscript.py imports are not in the current directory, but in another place in the filesystem, say, /path/to/stuff. If this was a tcsh script, I w

Re: Eclipse best/good or bad IDE for Python?

2005-12-02 Thread Fabio Zadrozny
Hi Chris, I think that you should try it yourself... being the *best ide* is usually a subjective matter, so, you should decide yourself if it is the best IDE for the task you want it to. I must also warn you that I'm its current maintainer, and it is *my* favorite IDE :-) Also, I use it for

Re: (newbie) N-uples from list of lists

2005-12-02 Thread bonono
Martin Miller wrote: > I'd be interested in seeing the one liner using reduce you mentioned -- > how it might be done that way isn't obvious to me. > > Another aspect of Taschuk's solution I like and think is important is > the fact that it is truly iterative in the sense that calling it > returns

Re: an intriguing wifi http server mystery...please help

2005-12-02 Thread Paul Boddie
[EMAIL PROTECTED] wrote: > Could the above server-speed assymetry that i spoke of above be caused > by this reverse dns lookup? I think so. You stated that you use "a fairly simple HTTP server", although that's not exactly specific enough to diagnose the problem, but if that were the standard libr

Re: Why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Adriano Ferreira
On 12/2/05, Carsten Haese <[EMAIL PROTECTED]> wrote: > (3) assumes that whatever shell the user is running looks up the shebang > executable in the path, which bash, just to name one example, does not > do. I think that was the answer I was looking for. So that "#!/usr/bin/env python" is more port

Re: Why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Klaus Alexander Seistrup
Adriano Ferreira wrote: > So that "#!/usr/bin/env python" is more portable than "#! python" > and that's probably why it worked for me with cygwin/bash but not > for Klaus on whatever platform he used. /me is using bash on linux. > I agree. Only a very strange Unix-like installation would not

Re: Ruby on Rails Job Site -- Is there a Python equivalent?

2005-12-02 Thread Paul Boddie
Adrian Holovaty wrote: > http://code.djangoproject.com/wiki/DevelopersForHire > > See the "Django-powered jobs" section. We could definitely advertise > this page more, as it's a bit hidden at the moment on the Django wiki. Don't forget the Python Job Board: http://www.python.org/Jobs.html Yes,

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-02 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > As while DSU is a very smart way to guard the max compare thing, it is > still being introduced as a way that is not related to the original > problem, i.e. I just want to compare f(x) And that's why in 2.5 you'll just code max(mylist, key=f) to express this int

Re: Why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Adriano Ferreira
On 12/2/05, Klaus Alexander Seistrup <[EMAIL PROTECTED]> wrote: > /me is using bash on linux. I think that was not a bash issue in my case, but a Cygwin/Win32 issue. Windows has some monstruous oddities in order to assure broken behavior of yesterday is here today in the name of compatibility. Exa

How do you create a custom QCursor in Python Qt?

2005-12-02 Thread Steegg
I am a newcomer to using Python and Qt and the main problem that I have is the dearth of any example code or books describing the use of Python and Qt together. My current problem is that I want to create a custom cursor, from my understanding of it I need to create two "QBitmap"s, one of which wi

Re: aligning a set of word substrings to sentence

2005-12-02 Thread Steven Bethard
Fredrik Lundh wrote: > Steven Bethard wrote: > > I feel like there should be a simpler solution (maybe with the re module?) but I can't figure one out. Any suggestions? >>> >>>using the finditer pattern I just posted in another thread: >>> >>>tokens = ['She', "'s", 'gon', 'na', 'write',

Re: aligning a set of word substrings to sentence

2005-12-02 Thread Steven Bethard
Michael Spencer wrote: > Steven Bethard wrote: > >> I've got a list of word substrings (the "tokens") which I need to >> align to a string of text (the "sentence"). The sentence is basically >> the concatenation of the token list, with spaces sometimes inserted >> beetween tokens. I need to d

Detect TKinter window being closed?

2005-12-02 Thread Glen
Is it possible to to detect a Tkinter top-level window being closed with the close icon/button (top right), for example to call a function before the window actually closes? Python 2.4 / Linux (2.6 kernel) if that makes any difference. Any info would be greatly appreciated. Thanks Glen -- http://

Re: How do you create a custom QCursor in Python Qt?

2005-12-02 Thread Phil Thompson
On Friday 02 December 2005 3:31 pm, [EMAIL PROTECTED] wrote: > I am a newcomer to using Python and Qt and the main problem that I have > is the dearth of any example code or books describing the use of Python > and Qt together. > > My current problem is that I want to create a custom cursor, from m

Re: Detect TKinter window being closed?

2005-12-02 Thread Adonis
Glen wrote: > Is it possible to to detect a Tkinter top-level window being closed with the > close icon/button (top right), for example to call a function before the > window actually closes? > > Python 2.4 / Linux (2.6 kernel) if that makes any difference. > Any info would be greatly appreciated.

Re: Eclipse best/good or bad IDE for Python?

2005-12-02 Thread Aaron Bingham
[EMAIL PROTECTED] wrote: >I'm trying to move beyond Emacs/Vim/Kate >and was wondering if Eclipse is better and if it is the *best* >IDE for Python. > >Should I leave Emacs and do Python coding in Eclipse? > > I've been a heavy Emacs user for several years, but recently switched to Eclipse for P

Re: Detect TKinter window being closed?

2005-12-02 Thread Fredrik Lundh
Glen wrote: > Is it possible to to detect a Tkinter top-level window being closed with the > close icon/button (top right), for example to call a function before the > window actually closes? http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm#protocols -- http://mail.python.org/

Re: aligning a set of word substrings to sentence

2005-12-02 Thread Steven Bethard
Steven Bethard wrote: > Michael Spencer wrote: > >> Steven Bethard wrote: >> >>> I've got a list of word substrings (the "tokens") which I need to >>> align to a string of text (the "sentence"). The sentence is >>> basically the concatenation of the token list, with spaces sometimes >>> insert

Re: Is there no compression support for large sized strings in Python?

2005-12-02 Thread Christopher Subich
Fredrik Lundh wrote: > Harald Karner wrote: >>>python -c "print len('m' * ((2048*1024*1024)-1))" >> >>2147483647 > > > the string type uses the ob_size field to hold the string length, and > ob_size is an integer: > > $ more Include/object.h > ... > int ob_size; /* Number of items in va

Re: Why my modification of source file doesn't take effect when debugging?

2005-12-02 Thread infidel
> I'm using the Windows version of Python and IDLE. When I debug my .py > file, my modification to the .py file does not seem to take effect > unless I restart IDLE. Saving the file and re-importing it doesn't help > either. Where's the problem? "import" only reads the file the first time it's cal

Re: Why my modification of source file doesn't take effect when debugging?

2005-12-02 Thread Christophe
infidel a écrit : >>I'm using the Windows version of Python and IDLE. When I debug my .py >>file, my modification to the .py file does not seem to take effect >>unless I restart IDLE. Saving the file and re-importing it doesn't help >>either. Where's the problem? > > > "import" only reads the fil

Dr. Dobb's Python-URL! - weekly Python news and links (Dec 2)

2005-12-02 Thread Cameron Laird
QOTW: "Python makes it easy to implement algorithms." - casevh "Most of the discussion of immutables here seems to be caused by newcomers wanting to copy an idiom from another language which doesn't have immutable variables. Their real problem is usually with binding, not immutability." - Mike Me

Re: Detect TKinter window being closed?

2005-12-02 Thread Glen
Thanks Fredrik and Adonis that's just what I needed, plus a bit more to learn about. -- http://mail.python.org/mailman/listinfo/python-list

Re: Death to tuples!

2005-12-02 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: >>> Well there are two possibilities I can think of: >>> >>> 1) >>> arg_default = ... >>> def f(arg = arg_default): >>> ... >> >> Yuch. Mostly because it doesn't work: >> >> arg_default = ... >> def f(arg = arg_default): >> ... >> >> arg_default =

Re: Why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Adriano Ferreira <[EMAIL PROTECTED]> wrote: > Hey, that's not fair. In your illustration above, does 'python' can be > found in the PATH? That is, > > $ python /tmp/hello.py > > works? If it does, probably > > #!/usr/bin/python > #!/usr/bin/env python > #!python

Re: Problem cmpiling M2Crypto under Plone

2005-12-02 Thread Thomas G. Apostolou
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thomas G. Apostolou wrote: > > > So what you say is that the Python installed with Plone doesn't have > > Python.h in ./include but Python installers from Python.org do have the > > file? > > that's likely, given buildin

Re: Eclipse best/good or bad IDE for Python?

2005-12-02 Thread gene tani
[EMAIL PROTECTED] wrote: > I'm trying to move beyond Emacs/Vim/Kate > and was wondering if Eclipse is better and if it is the *best* > IDE for Python. > > Should I leave Emacs and do Python coding in Eclipse? > > Chris I'm agnostic; lots of IDE's/editors have buzz, you should learn to use at leas

libxml2 and XPath - Iterate through repeating elements?

2005-12-02 Thread nickheppleston
I'm trying to iterate through repeating elements to extract data using libxml2 but I'm having zero luck - any help would be appreciated. My XML source is similar to the following - I'm trying to extract the line number and product code from the repeating line elements: 123456

Re: an intriguing wifi http server mystery...please help

2005-12-02 Thread jojoba
Hello again everyone, First, I want to thank all those who have contributed to the unravelling of this server-slow-down mystery. But unfortunately, either: 1) i have not made my point clear about what my question is 2) i do not understand the responses given So, let me briefly reiterate what the

Re: Death to tuples!

2005-12-02 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > On 2005-12-02, Bengt Richter <[EMAIL PROTECTED]> wrote: >> On 1 Dec 2005 09:24:30 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >>>On 2005-11-30, Duncan Booth <[EMAIL PROTECTED]> wrote: Antoon Pardon wrote: >>>I think one could argue that since '[]'

Re: Setting PYTHONPATH from Makefile

2005-12-02 Thread François Pinard
[EMAIL PROTECTED] > I have a Makefile target that uses a python script, like: > %.abc: %.def > python myscript.py > If this was a tcsh script, I would just do: >setenv PYTHONPATH /path/to/stuff >python myscript.py > but this cannot be done from a Makefile. Use: %.abc:

How to keep Pydoc from listing too much?

2005-12-02 Thread Tony Nelson
How can I tell Pydoc not to list information for some of the base classes? For example, when a class inherits from gtk.Widget, lots of GTK stuff gets added that doesn't really need to be there. Is there some option to Pydoc to tell it to skip some classes? Is there something I can put in my

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-02 Thread JohnBMudd
Here it is again... Python bypassed/discounted because, of all things, scoping by indentation!?!? This used to surprise me. Until I hear more and more otherwise reasonable programmers list this as their number one reason for shunning Python. I gauge design defects by how much after market discu

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-02 Thread Paul Boddie
[EMAIL PROTECTED] wrote: > Here it is again... Python bypassed/discounted because, of all things, > scoping by indentation!?!? [...] > Could the PyPy people find some way (I don't how) to eliminate this > stumbling block going forward?? No: I believe they could only eliminate it "going backward

Re: How to creat a file?

2005-12-02 Thread [EMAIL PROTECTED]
sandorf wrote: > Thank to you all, guys. Here's another question: > > I'm using the Windows version of Python and IDLE. When I debug my .py > file, my modification to the .py file does not seem to take effect > unless I restart IDLE. Saving the file and re-importing it doesn't help > either. Where

Re: libxml2 and XPath - Iterate through repeating elements?

2005-12-02 Thread Paul Boddie
[EMAIL PROTECTED] wrote: > I'm trying to iterate through repeating elements to extract data using > libxml2 but I'm having zero luck - any help would be appreciated. Here's how I attempt to solve the problem using libxml2dom [1] (and I imagine others will suggest their own favourite modules, too):

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-02 Thread Dave Hansen
On 2 Dec 2005 10:08:21 -0800 in comp.lang.python, [EMAIL PROTECTED] wrote: >Here it is again... Python bypassed/discounted because, of all things, >scoping by indentation!?!? > >This used to surprise me. Until I hear more and more otherwise >reasonable programmers list this as their number one r

Detect Blank DVD or CD in CDROM Drive

2005-12-02 Thread Gregory Piñero
Hi guys, I'm thinking it will take a real expert to do this, probably someone who can use windows API's or directly poll the hardware or some such thing.  But if you think you know how then please let me know.  I'm trying to write an automation script that will burn an ISO file each night. By the

Re: an intriguing wifi http server mystery...please help

2005-12-02 Thread Paul Boddie
[EMAIL PROTECTED] wrote: > The server runs fast when one computer is the server, but slow when the > other computer is the server. > How can this be, given that this asymmetry does not exist when both > computers are wired. Probably because the way your wireless interfaces are configured may be di

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-02 Thread [EMAIL PROTECTED]
You're not alone. The first thing I do after installing an IDE or programmers editor is to change the configuration to use spaces as identantion. I still don't get why there is still people using real tabs as indentation. -- Paulo Dave Hansen wrote: > On 2 Dec 2005 10:08:21 -0800 in comp.lang.py

Re: Instances behaviour

2005-12-02 Thread Inyeol Lee
On Fri, Dec 02, 2005 at 10:43:56AM +0100, bruno at modulix wrote: > Inyeol Lee wrote: > (snip) > > class A(object): > ... def __init__(self, foo): > ... if self.__class__ is A: > ... raise TypeError("A is base class.") > > > s/TypeError/NotI

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-02 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, Dave Hansen <[EMAIL PROTECTED]> wrote: > On 2 Dec 2005 10:08:21 -0800 in comp.lang.python, [EMAIL PROTECTED] > wrote: > > >Here it is again... Python bypassed/discounted because, of all things, > >scoping by indentation!?!? > > > >This used to surprise me. Until

LDAP Authentication

2005-12-02 Thread Derek Perriero
Any help would be great on this.  I've been trying to bind a username and password to the ldap server for authentication, but when I locally run this script: #!/usr/bin/python import ldap ## Connect to LDAP host try:     ldapcn = ldap.initialize('ldap://xxx.xxx.xxx.xxx')     ldapcn.bind('cn=usern

Re: Death to tuples!

2005-12-02 Thread Bengt Richter
On 2 Dec 2005 13:05:43 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >On 2005-12-02, Bengt Richter <[EMAIL PROTECTED]> wrote: >> On 1 Dec 2005 09:24:30 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >> >>>On 2005-11-30, Duncan Booth <[EMAIL PROTECTED]> wrote: Antoon Pardon wrote: > >Perso

unittest.assertRaise and keyword arguments?

2005-12-02 Thread Bo Peng
Dear list, The syntax for using assertRaise is assertRaise(exception, function, para1, para2,...) However, I have a long list of arguments (>20) so I would like to test some of them using keyword arguments (use default for others). Is there a way to do this except for manually try...except?

Re: How to list currently defined classes, methods etc

2005-12-02 Thread Deep
I have been looking a bit and am stuck at this point. Given a string, how do i find what is the string bound to. Let me give an example. def deep(): print "Hello" now inspect.ismethod(deep) returns true. (As it should). But if I am trying to make a list of all bound methods), i use dir(), w

Re: XML and namespaces

2005-12-02 Thread A.M. Kuchling
On 2 Dec 2005 06:16:29 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Of course. Minidom implements level 2 (thus the "NS" at the end of the > method name), which means that its APIs should all be namespace aware. > The bug is that writexml() and thus toxml() are not so. Hm, OK.

Re: unittest.assertRaise and keyword arguments?

2005-12-02 Thread Giovanni Bajo
Bo Peng wrote: > The syntax for using assertRaise is > >assertRaise(exception, function, para1, para2,...) > > However, I have a long list of arguments (>20) so I would like to test > some of them using keyword arguments (use default for others). Is there > a way to do this except for manually

Volume of CSG (constructive solid geometry) objects

2005-12-02 Thread Charlie
>From python, I need to be able to create CSG objects and calculate their volume (and from that their mass). It looks like their are plenty of packages to create and display CSG objects, however, I can not seem to find any API to get to the object's volume. If anyone has any ideas/tips/pointers/e

Re: CGI module does not parse data

2005-12-02 Thread amfr
I am using execfile, setting stdin and stdout like this: sys.stdin = self.wfile sys.stdout = self.rfile execfile(filename) Its the same code used in the CGIHTTPServer module. I know that the python is executing corretly, a script with this content would work: print "" print "" print "" print "bl

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-02 Thread Micah Elliott
On Dec 02, Dave Hansen wrote: > Python recognizes the TAB character as valid indentation. TAB > characters are evil. They should be banned from Python source code. AGREE! AGREE! AGREE! > The interpreter should stop translation of code and throw an > exception when one is encountered. You co

Re: unittest.assertRaise and keyword arguments?

2005-12-02 Thread Bo Peng
Giovanni Bajo wrote: > You can pass keyword arguments to assertRaises without problems: > > self.assertRaises(ValueError, myfunc, arg1,arg2, arg3, arg4, abc=0, foo=1, > bar="hello") Well, I though abc=0 would be keyword arguments for assertRaisers and never tried it! > > Or you can always do s

Re: How to list currently defined classes, methods etc

2005-12-02 Thread Kent Johnson
Deep wrote: > I have been looking a bit and am stuck at this point. > > Given a string, how do i find what is the string bound to. > Let me give an example. > > def deep(): > print "Hello" > > now inspect.ismethod(deep) returns true. (As it should). > But if I am trying to make a list of al

Re: How to list currently defined classes, methods etc

2005-12-02 Thread Colin J. Williams
Deep wrote: > I have been looking a bit and am stuck at this point. > > Given a string, how do i find what is the string bound to. > Let me give an example. > > def deep(): > print "Hello" > > now inspect.ismethod(deep) returns true. (As it should). > But if I am trying to make a list of al

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-02 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Micah Elliott wrote: > On Dec 02, Dave Hansen wrote: > >>Python recognizes the TAB character as valid indentation. TAB >>characters are evil. They should be banned from Python source code. > > AGREE! AGREE! AGREE! > >>The interpreter should sto

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-02 Thread Simon Brunning
On 12/2/05, Dave Hansen <[EMAIL PROTECTED]> wrote: > FWIW, indentation scoping one one of the features that _attracted_ me > to Python. +1 QOTW OK, it's a bit of a cliche. But it's a cliche because it's *true*. -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ --

  1   2   >