Re: tree functions daily exercise: Table

2005-06-24 Thread xah
Dear Dr Jon D Harrop, “List Comprehension” is a special concise syntax form that generates lists, as a way to save typing such as for loops. It is primarily a jargon bandied about by programers which have contributed huge misunderstandings and miscommunications. The extensiveness of this particula

Re: PEP 304 - is anyone really interested?

2005-06-24 Thread Patrick Maupin
John Roth wrote: > I'd like to suggest a different mechanism, at least for packages > (top level scripts don't generate .pyc files anyway.) Put a system > variable in the __init__.py file. Something like __obj__ = path > would do nicely. Then when Python created the __init__.pyc file, > it woul

Re: Favorite non-python language trick?

2005-06-24 Thread Enrico
"Joseph Garvin" <[EMAIL PROTECTED]> ha scritto nel messaggio news:[EMAIL PROTECTED] > --This code won't run because it's in a comment block > --[[ > print(10) > --]] > > --This code will, because the first two dashes make the rest a comment, > breaking the block > ---[[ > print(10) > --]] > > So yo

Re: Favorite non-python language trick?

2005-06-24 Thread Uwe Mayer
Friday 24 June 2005 09:18 am Enrico wrote: [...] >> --This code will, because the first two dashes make the rest a comment, >> breaking the block >> ---[[ >> print(10) >> --]] [...] > python: > > """ > print 10 > """ > > and > > #""" > print 10 > #""" > > C++: > > /* > print(10); > */ > > a

printing indented html code

2005-06-24 Thread Lowell Kirsh
Is there a module or library anyone knows of that will print html code indented? What I'd like would be for a function or class which works like this: htmlIndent(sys.stdout, 'foobar...') and will print somethinkg like this to stdout: foobar ... My current way of doing this ki

Re: Running WMI within a Windows service

2005-06-24 Thread Roger Upole
Build 204 of pywin32 has a change so that the working dir for a service is the folder where its executable is located instead of \system32, hopefully avoiding trying to import wmi.dll instead of wmi.pyd. Roger "Tim Golden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [EMAIL

Re: connecting to an exsisting COM server

2005-06-24 Thread Roger Upole
Normally you get that if the application doesn't register itself with the Running Object Table. Do you know if the COM server in question registers itself ? Roger "jelle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I'm using > win32com.client.GetObject(Class='Rhino

Re: Favorite non-python language trick?

2005-06-24 Thread gatti
Joseph Garvin wrote: > I'm curious -- what is everyone's favorite trick from a non-python > language? And -- why isn't it in Python? Duff's device is a classic masterpiece of lateral thinking. It is not possible in Python for many fundamental reasons, we are not at risk. Lorenzo Gatti -- http:/

Re: Favorite non-python language trick?

2005-06-24 Thread Duncan Booth
Uwe Mayer wrote: >> /* >> print(10); >> */ >> >> and >> >> ///* >> print(10); >> //*/ >> >> ? > > I think the *trick* here was that if you had larger blocks you'd only > have to change one side of the comment, i.e. the opening line, to > de-comment the block without searching the end of it and

Re: A tool for Python - request for some advice

2005-06-24 Thread TPJ
> (...) I've seen the claim that every Linux > distro comes with Python installed, but can't verify it. So have I. And I think it might be truth. The only problem is that different distros might be released with different versions of Python. > Then again, the same comments apply to bash. Distri

Re: zipfile + symlink [Solved]..

2005-06-24 Thread A. Murat Eren
Hi again, On Thursday 23 June 2005 23:43, A. Murat Eren wrote: > I have a problem about zipfile. I solved the problem and want to share my solution for archiving purposes (Hi Googlers ;)).. > ---8<---8<8<--8<--- > def add_file(self, fi

Re: suggestions invited

2005-06-24 Thread Aditi
Thank You All for your valuable suggestions. You people definitely eased out my problem and now I can start my work with an eclectic of all of your solutions. Greetings Aditi. -- http://mail.python.org/mailman/listinfo/python-list

Re: Favorite non-python language trick?

2005-06-24 Thread Lowell Kirsh
Check out lisp macros. Other languages have macro systems but none compare in power to lisp's. They are so powerful in lisp because lisp is the only language where the source code closely resembles its parse tree (created within the compiler/interpreter). Lowell Joseph Garvin wrote: > As someo

Re: A tool for Python - request for some advice

2005-06-24 Thread TPJ
> So, to make sure I've understood (...) : you want to provide > a specialized install script for Python (3rd party modules, > non-standard locations, etc.) yes > You started in bash to deal with minority cases without an extant > Python install. My motivation was rather to avoid a bootstrap-l

Re: suggestions invited

2005-06-24 Thread Aditi
Konstantin Veretennicov wrote: > Pardon me, is it a real company or a fictious one? I think my previous mail was in plain understandable english which can be easily interpreted and clearly says the project has been assigned in a not so intelligent spirit and thus sounds fictitious. I think going

Re: A tool for Python - request for some advice

2005-06-24 Thread TPJ
I've heard about this "EasyInstall" and I like this idea. If EI becomes a part of Python's standard library, my script will use it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Favorite non-python language trick?

2005-06-24 Thread Roel Schroeven
Joseph Garvin wrote: > As someone who learned C first, when I came to Python everytime I read > about a new feature it was like, "Whoa! I can do that?!" Slicing, dir(), > getattr/setattr, the % operator, all of this was very different from C. > > I'm curious -- what is everyone's favorite trick

Re: Favorite non-python language trick?

2005-06-24 Thread Claudio Grondi
> And you can do block comments with --[[ and ---]]. I am very happy not to have such "tricks" in Python. Any other (useful) suggestions? Claudio "Joseph Garvin" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > As someone who learned C first, when I came to Python everytime I

Re: don't understand MRO

2005-06-24 Thread Martin Franklin
Uwe Mayer wrote: > Thursday 23 June 2005 19:22 pm Terry Reedy wrote: > > [...] > >>In the absence of other information, I would presume that none of the >>other classes have a move() method. > > > move() is implemented in the class qtcanvas.QCanvasItem > I checked the pyqt sources and it is lin

Re: Favorite non-python language trick?

2005-06-24 Thread Joseph Garvin
Claudio Grondi wrote: >>And you can do block comments with --[[ and ---]]. >> >> > >I am very happy not to have such "tricks" in Python. > >Any other (useful) suggestions? > >Claudio > > I'm glad and all that not everyone shares my enthusiasm over Lua's trick, and I'm glad that C/C++ can do

Re: A tool for Python - request for some advice

2005-06-24 Thread Robert Kern
TPJ wrote: > I've heard about this "EasyInstall" and I like this idea. > > If EI becomes a part of Python's standard library, my script will use > it. Why wait? Just make it the second thing that the script installs after Python itself. -- Robert Kern [EMAIL PROTECTED] "In the fields of hell

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-24 Thread Kent Johnson
Robert Kern wrote: > > And floating point is about nothing if not being usefully wrong. > +1 QOTW and maybe it could be worked into the FAQ about floats as well :-) http://www.python.org/doc/faq/general.html#why-are-floating-point-calculations-so-inaccurate Kent -- http://mail.python.org/mailm

Re: printing indented html code

2005-06-24 Thread TechBookReport
Lowell Kirsh wrote: > Is there a module or library anyone knows of that will print html code > indented? What I'd like would be for a function or class which works > like this: > > htmlIndent(sys.stdout, 'foobar...') > > and will print somethinkg like this to stdout: > > > > foobar >

Re: printing indented html code

2005-06-24 Thread Lowell Kirsh
Thanks. At a glance, that looks like it's what I'm looking for. Lowell TechBookReport wrote: > Lowell Kirsh wrote: > >> Is there a module or library anyone knows of that will print html code >> indented? What I'd like would be for a function or class which works >> like this: >> >> htmlIndent(

Re: trouble subclassing str

2005-06-24 Thread Kent Johnson
Donn Cave wrote: > Left unexplained is ``true "is-a" relationships''. Sounds > like an implicit contradiction -- you can't implement > something that truly is something else. Without that, and > maybe a more nuanced replacement for "is-implemented-using-a", > I don't see how you could really be s

Re: Thanks for PIL (and other stuff)

2005-06-24 Thread Do Re Mi chel La Si Do
+1 -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: suggestions invited

2005-06-24 Thread Simon Brunning
On 23 Jun 2005 13:46:18 -0700, Peter Herndon <[EMAIL PROTECTED]> wrote: > Reasonable enough. As per Mike's suggestion below, building a few web > pages to document the apps is a good start. To expand on that idea, > you could write daemons/cron jobs, perhaps in Python if Python runs on > OS/400,

Re: formatted xml output from ElementTree inconsistency

2005-06-24 Thread Kent Johnson
Matthew Thorley wrote: > Greetings, perhaps someone can explain this. I get to different styles > of formatting for xmla and xmlb when I do the following: > > Is that because the some_file.xml is already nicely formatted? I thought > that the formatting was ignored when creating new elements. E

Re: Favorite non-python language trick?

2005-06-24 Thread Thomas Guettler
Am Fri, 24 Jun 2005 00:55:38 -0600 schrieb Joseph Garvin: > As someone who learned C first, when I came to Python everytime I read > about a new feature it was like, "Whoa! I can do that?!" Slicing, dir(), > getattr/setattr, the % operator, all of this was very different from C. > > I'm curious

Re: Help wanted in piping in Windows

2005-06-24 Thread Thomas Guettler
Am Fri, 24 Jun 2005 01:28:38 +0530 schrieb Apple Grew: > I want to develope a Winboard like application which will support > Winboard protocol. For that I require to know how to handle piping in > Python. I seperated out module popen2, but when I use > fileObject.readline() then it halts the pr

Re: getting tracebacks from traceback objects

2005-06-24 Thread Kent Johnson
Michael P. Soulier wrote: > Hello, > > For a GUI app I've tried resetting sys.excepthook to my own > exceptionhandler bound method, which accepts a type, value and traceback > object. > > Now, the traceback module has print_exc and format_exc methods that are > supposed to take a traceback objec

Re: printing indented html code

2005-06-24 Thread Konstantin Veretennicov
On 6/24/05, Lowell Kirsh <[EMAIL PROTECTED]> wrote: > Is there a module or library anyone knows of that will print html code > indented? Depends on whether you have to deal with xhtml, valid html or just any, possibly invalid, "pseudo-html" that abounds on the net. Here's an example of (too) simp

Re: printing indented html code

2005-06-24 Thread Lowell Kirsh
Looks good. I'll give it a try. Konstantin Veretennicov wrote: > On 6/24/05, Lowell Kirsh <[EMAIL PROTECTED]> wrote: > >>Is there a module or library anyone knows of that will print html code >>indented? > > > Depends on whether you have to deal with xhtml, valid html or just > any, possibly in

howto load and unload a module

2005-06-24 Thread Guy Robinson
Hello, I have a directory of python scripts that all (should) contain a number of attributes and methods of the same name. I need to import each module, test for these items and unload the module. I have 2 questions. 1.. How do unload an imported module? 2.. how do I test for the existance of

Re: howto load and unload a module

2005-06-24 Thread Peter Hansen
Guy Robinson wrote: > I have a directory of python scripts that all (should) contain a number > of attributes and methods of the same name. > > I need to import each module, test for these items and unload the > module. I have 2 questions. > > 1.. How do unload an imported module? Why would yo

Re: Help wanted in piping in Windows

2005-06-24 Thread Peter Hansen
Thomas Guettler wrote: > AFAIK ">file" and "2>file" does work on windows. Not, unfortunately (at least in the past), on Windows 98. That might no longer matter, however. How many people are still stuck using Windows 98? Given that in one year you won't even be able to get support from Microso

Sorting part of a list

2005-06-24 Thread Sibylle Koczian
Hello, I thought I understood list slices, but I don't. I want to sort only the last part of a list, preferably in place. If I do >>> ll = [3, 1, 4, 2] >>> ll[2:].sort() >>> ll [3, 1, 4, 2] ll isn't changed, because ll[2:] is a copy of the last part of the list, and this copy is sorted, not

help!

2005-06-24 Thread Eser Çetinkaya
Title: help! In your documentation, it is written :   "   os.path.getatime(path) Return the time of last access of path. The return value is a number giving the number of seconds since the epoch (see the time module). Raise os.error if the file does not exist or is inaccessible. N

help!

2005-06-24 Thread Eser Çetinkaya
Title: help! In your documentation, it is written :   "   os.path.getatime(path) Return the time of last access of path. The return value is a number giving the number of seconds since the epoch (see the time module). Raise os.error if the file does not exist or is inaccessible.

Re: OT: Re: Looking For Geodetic Python Software

2005-06-24 Thread Diez B. Roggisch
Dennis Lee Bieber wrote: > Of course, the great circle arc, except for paths with start/end > latitude of 0 (equator) or with (lon1 - lon2) = 0, require a constant > variation in compass heading -- and I don't think IFR currently make use > of great circle arcs (and GPS to maintain them). I'

Re: howto load and unload a module

2005-06-24 Thread Fuzzyman
Answer to 2 - ``hasattr(module, name)`` -- http://mail.python.org/mailman/listinfo/python-list

Re: howto load and unload a module

2005-06-24 Thread Guy Robinson
> > Why would you want to? Doing what you describe doesn't require that you > "unload" a module, unless that means something more to you than, say, > merely releasing the memory used by it (which is likely insignificant to > you). > Hi Peter, I have an application with Python embedded. I'm

Re: Sorting part of a list

2005-06-24 Thread Fuzzyman
You can assign to a slice in place, but referencing a slice creates a copy. I think you understand it quite well :-) a = ll[2:] a.sort() ll[2:] = a To do a partial sort, in place, you'll have to subclass list - but you'll still end up doing something similar unless you delve into C or write your

Re: help!

2005-06-24 Thread Andreas Kostyrka
Just out of curiosity, does the filesystem support seperate a/m/c times? Andreas On Fri, Jun 24, 2005 at 02:49:01PM +0300, Eser Çetinkaya wrote: > > > In your documentation, it is written : > " > os.path.getatime(path) > Return the time of last access of path. The return value

Re: Sorting part of a list

2005-06-24 Thread John Machin
Sibylle Koczian wrote: > Hello, > > I thought I understood list slices, but I don't. I want to sort only the > last part of a list, preferably in place. If I do > > >>> ll = [3, 1, 4, 2] > >>> ll[2:].sort() It may help in unravelling any bogglement to point out that this is equivalent to te

Re: Sorting part of a list

2005-06-24 Thread Benji York
Fuzzyman wrote: > a = ll[2:] > a.sort() > ll[2:] = a > > To do a partial sort, in place, you'll have to subclass list Or be using 2.4: >>> ll = [3, 1, 4, 2] >>> ll[2:] = sorted(ll[2:]) >>> ll [3, 1, 2, 4] -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: create a pdf file

2005-06-24 Thread Jim
If it is a plain text file (or close to it, like the Gutenburg Project files), think about using pdfLaTeX. Jim -- http://mail.python.org/mailman/listinfo/python-list

Re: help!

2005-06-24 Thread Benji York
Eser Çetinkaya wrote: > What can change an acess time of a path different from modification? > Is there any mistakes in the implementation or am i missing some points? When a file is read it is accessed but not modified: >>> import os.path >>> os.path.getmtime('a_file') 1119615705 >>> os.path.

webserver application (via Twisted?)

2005-06-24 Thread flupke
I need to program and setup serveral webservices. If i were still using jsp, i would use Tomcat to make the several applications available on a given port. How can i accomplish this in Python? I was thinking about Twisted but it's not clear to me what parts i need to make a webserver listen on a c

Re: Favorite non-python language trick?

2005-06-24 Thread Steven D'Aprano
On Fri, 24 Jun 2005 00:55:38 -0600, Joseph Garvin wrote: > I'm curious -- what is everyone's favorite trick from a non-python > language? And -- why isn't it in Python? Long ago, I used to dabble in Forth. You could say, the entire Forth language was a trick :-) It was interesting to be able to

Two questions on lambda:

2005-06-24 Thread Xavier Décoret
Hi, I cannot find the way to do generic lambda functions using the lambda syntax in python. I am probably missing a point. For example, the code # f = lambda : print "hello" # f() does not compile, although: # def f(): # print "hello" # f() does compile. Is there a particular syntax fo

Re: Looking For Geodetic Python Software

2005-06-24 Thread paron
Howard Butler http://hobu.biz/ has some nice Python wrappers for gdal and Frank Warmerdam's other tools. I have to say, though, that geodesy is inherently complicated. Python makes it easy to program, but not easy to understand. http://maps.hobu.net:7080/RPC2 is an XMLRPC service that he exposes th

Re: Favorite non-python language trick?

2005-06-24 Thread Claudio Grondi
I supose it will be very, very hard to find a trick which turns out useful in Python. The current set of features is from my point of view very well designed out of the experience with many other languages, so maybe you can use Python as reference telling you which tricks are really useful in progr

Re: howto load and unload a module

2005-06-24 Thread Peter Hansen
Guy Robinson wrote: > Some of these scripts could potentially be quite large. Also the list of > scripts could be quite large. So the main reason for unloading modules > is to save memory. Unless you're talking megabytes of bytecode (do a "wc *.pyc" on the compiled files and see) it's probably

Re: howto load and unload a module

2005-06-24 Thread John Machin
Peter Hansen wrote: > Guy Robinson wrote: > >> I have a directory of python scripts that all (should) contain a >> number of attributes and methods of the same name. >> >> I need to import each module, test for these items and unload the >> module. I have 2 questions. [snip] >> 2.. how do I test

Re: Two questions on lambda:

2005-06-24 Thread Kristian Zoerhoff
On 6/24/05, Xavier Décoret <[EMAIL PROTECTED]> wrote: > > For example, the code > > # f = lambda : print "hello" > # f() > does not compile, although: > > # def f(): > # print "hello" > # f() > > does compile. Is there a particular syntax for lambda that I am missing > or is it simply lim

Re: webserver application (via Twisted?)

2005-06-24 Thread Peter Hansen
flupke wrote: > I need to program and setup serveral webservices. > If i were still using jsp, i would use Tomcat to make the several > applications available on a given port. > How can i accomplish this in Python? > I was thinking about Twisted but it's not clear to me what parts i need > to make

Reminder: bug day on Saturday the 25th

2005-06-24 Thread A.M. Kuchling
The Python bug day is coming up tomorrow, Saturday June 25th, running from 1PM to 7PM UTC (9AM to 3PM Eastern). Stop by the IRC channel (#python-dev on irc.freenode.net) and join in! For more info, see . --amk -- http://mail.python.org/mailman/listinfo/

Re: howto load and unload a module

2005-06-24 Thread Peter Hansen
John Machin wrote: > Peter Hansen wrote: [sample code] > Ummm ... doesn't appear to scale well for multiple modules and multiple > attributes & functions. It certainly wouldn't! :-) I was posting mainly to elicit more information, since clearly you wouldn't get far hardcoding all the names yo

Re: Favorite non-python language trick?

2005-06-24 Thread utabintarbo
>with colour do begin >red := 0; blue := 255; green := 0; >end; > >instead of: > >colour.red := 0; colour.blue := 255; colour.green := 0; Why not: from color import * red := 0 blue := 255 green := 0 ... -- http://mail.python.org/mailman/listinfo/python-list

Re: webserver application (via Twisted?)

2005-06-24 Thread garabik-news-2005-05
flupke <[EMAIL PROTECTED]> wrote: > I need to program and setup serveral webservices. > If i were still using jsp, i would use Tomcat to make the several > applications available on a given port. > How can i accomplish this in Python? > I was thinking about Twisted but it's not clear to me what par

Re: Two questions on lambda:

2005-06-24 Thread Duncan Booth
Xavier Décoret wrote: > Is there a particular syntax for lambda that I am missing > or is it simply limited and I cannot do what I want with lambda. Lambda is deliberately limited. Just define a function. The only downside to defining a function is that you have to think of a name for it, but

Re: trouble subclassing str

2005-06-24 Thread Paul McGuire
>From purely Python terms, there is a distinction that one of these classes (PaddedStr) is immutable, while the other is not. Python only permits immutable objects to act as dictionary keys, so this would one thing to differentiate these two approaches. But on a more abstract, implementation-inde

Re: webserver application (via Twisted?)

2005-06-24 Thread Benedict Verheyen
flupke wrote: Thanks Peter & Radovan for the answers Regards, Benedict -- Benedict Verheyen Debian User http://www.heimdallitservices.bePublic Key 0x712CBB8D -- http://mail.python.org/mailman/listinfo/python-list

Re: Two questions on lambda:

2005-06-24 Thread John Roth
"Xavier Décoret" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I cannot find the way to do generic lambda functions using the lambda > syntax in python. I am probably missing a point. You are. Lambda is restricted to a _single expression_. Your first example is a stateme

autoconfigure vss python question

2005-06-24 Thread lode leroy
Hi folks, I'm trying to build a python module using MINGW on MSYS the "configure" script is determining where python is installed as follows: python.exe -c 'import sys; print sys.prefix' c:\Python24 which is good on native windows (i.e. when invoked from CMD.EXE) Is there a way to configure som

Re: Favorite non-python language trick?

2005-06-24 Thread Steven D'Aprano
On Fri, 24 Jun 2005 06:13:00 -0700, utabintarbo wrote: >>with colour do begin >>red := 0; blue := 255; green := 0; >>end; >> >>instead of: >> >>colour.red := 0; colour.blue := 255; colour.green := 0; > > Why not: > > from color import * > > red := 0 > blue := 255 > green := 0 Because colour is

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-24 Thread D H
Peter Hansen wrote: > D H wrote: > >> Peter Hansen wrote: >> >>> Bo Peng wrote: >>> I need to pass a bunch of parameters conditionally. In C/C++, I can do func(cond1?a:b,cond2?c:d,.) Is there an easier way to do this in Python? >>> >>> >>> Please read the FAQ to learn the a

Re: webserver application (via Twisted?)

2005-06-24 Thread D H
flupke wrote: > I need to program and setup serveral webservices. > If i were still using jsp, i would use Tomcat to make the several > applications available on a given port. > How can i accomplish this in Python? > I was thinking about Twisted but it's not clear to me what parts i need > to make

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-24 Thread Dave Brueck
D H wrote: > Peter Hansen wrote: >>D H wrote: >>>Peter Hansen wrote: Bo Peng wrote: >>Actually that's just one possible answer. Whether it's _the_ answer is >>obviously again a matter of opinion, and as usual we differ. > > Quit being such an idiot and refuting everything I say. The answer

Re: Favorite non-python language trick?

2005-06-24 Thread D H
Joseph Garvin wrote: > I'm curious -- what is everyone's favorite trick from a non-python > language? And -- why isn't it in Python? You can try out new features yourself now using various python extensions or descendants: http://livelogix.net/logix/ - macros, no statement/expression distinc

Frame widget (title and geometry)

2005-06-24 Thread Shankar Iyer ([EMAIL PROTECTED])
Hi, I am still new to Python and Tkinter, so I apologize in advance if I do not word my question optimally. I am trying to use a frame widget as the parent for other widgets. There is a class with the header "class classtitle(Frame):" in a script called classtitle.py. Having imported

Re: Favorite non-python language trick?

2005-06-24 Thread Peter Hansen
[EMAIL PROTECTED] wrote: >>with colour do begin >>red := 0; blue := 255; green := 0; >>end; >> >>instead of: >> >>colour.red := 0; colour.blue := 255; colour.green := 0; > > Why not: > from color import * > > red := 0 > blue := 255 > green := 0 What do you think this actually does? It doesn't d

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-24 Thread Richie Hindle
[Dave Brueck] > Please keep the discussion civil; please help keep c.l.py a nice place to > visit. +1 -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: webserver application (via Twisted?)

2005-06-24 Thread Jp Calderone
On Fri, 24 Jun 2005 12:35:40 GMT, flupke <[EMAIL PROTECTED]> wrote: >I need to program and setup serveral webservices. >If i were still using jsp, i would use Tomcat to make the several >applications available on a given port. >How can i accomplish this in Python? >I was thinking about Twisted but

Re: Favorite non-python language trick?

2005-06-24 Thread Doug Schwarz
In article <[EMAIL PROTECTED]>, "Enrico" <[EMAIL PROTECTED]> wrote: > "Joseph Garvin" <[EMAIL PROTECTED]> ha scritto nel messaggio > news:[EMAIL PROTECTED] > > --This code won't run because it's in a comment block > > --[[ > > print(10) > > --]] > > > > --This code will, because the first two das

Re: Favorite non-python language trick?

2005-06-24 Thread infidel
> def class Colour: > def __init__(self, blue=0, green=0, red=0): > # pseudo-Python code borrowing concept "with" from Pascal > with self: > blue = blue > green = green > red = red > > And now you can see why Python doesn't support this idiom.

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-24 Thread D H
Dave Brueck wrote: > Please keep the discussion civil; please help keep c.l.py a nice place > to visit. You didn't see Peter Hansen's previous post to which I made my reply, so I'd like to extend your recommendation to *everyone* here. Peter Hansen wrote: > Doug, please stop making an idiot of

Re: Favorite non-python language trick?

2005-06-24 Thread D H
infidel wrote: >>def class Colour: >>def __init__(self, blue=0, green=0, red=0): >># pseudo-Python code borrowing concept "with" from Pascal >>with self: >>blue = blue >>green = green >>red = red >> >>And now you can see why Python doesn't sup

Re: Thanks for PIL (and other stuff)

2005-06-24 Thread TZOTZIOY
On 23 Jun 2005 19:12:03 -0700, rumours say that "jean-marc" <[EMAIL PROTECTED]> might have written: >So I wish it and its author(s) a good day, week, month, year and more! >Really! That is, "So long and thanks for all the PIL." -- TZOTZIOY, I speak England very best. "Be strict when sending and

Re: Favorite non-python language trick?

2005-06-24 Thread Sergei Organov
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Fri, 24 Jun 2005 00:55:38 -0600, Joseph Garvin wrote: > > > I'm curious -- what is everyone's favorite trick from a non-python > > language? And -- why isn't it in Python? > > Long ago, I used to dabble in Forth. You could say, the entire Forth >

Re: Favorite non-python language trick?

2005-06-24 Thread Tom Anderson
On Fri, 24 Jun 2005, Joseph Garvin wrote: > Claudio Grondi wrote: > > So far we've got lisp macros and a thousand response's to the lua trick. > Anyone else have any actual non-python language tricks they like? Higher-order functions like map, filter and reduce. As of Python 3000, they're non-p

Re: Frame widget (title and geometry)

2005-06-24 Thread Jeff Epler
It would help if you posted your code, as we're in the dark about exactly what you tried to do and the error you received. It sounds like you may be using the wrong type of widget for what you want. The terms used in Tk are different than in some other systems. If you want a separate window with

Re: Thanks for PIL (and other stuff)

2005-06-24 Thread Rocco Moretti
jean-marc wrote: > PS If I knew that Python had a anniversary date, I'd also write to > thanks our BDFL (and authors)! But no such luck, so I'm restaining > myself! > ;-)) From the FAQ: > Here's a very brief summary of what started it all, written by Guido van > Rossum: > > > > During the 19

Re: Frame widget (title and geometry)

2005-06-24 Thread Eric Brunel
On Fri, 24 Jun 2005 10:21:01 -0400, Shankar Iyer ([EMAIL PROTECTED]) <[EMAIL PROTECTED]> wrote: > Hi, > > I am still new to Python and Tkinter, so I apologize in advance if I do not > word my question optimally. I am trying to use a frame widget as the parent > for other widgets. There is a cla

Re: Favorite non-python language trick?

2005-06-24 Thread Roy Smith
Tom Anderson <[EMAIL PROTECTED]> wrote: > The one thing i really do miss is method overloading by parameter > type. I used this all the time in java You do things like that in type-bondage languages like Java and C++ because you have to. Can you give an example of where you miss it in Python?

Re: Python as client-side browser script language

2005-06-24 Thread jeoffwilks
Sorry to resurrect a slightly older topic, but I want to clarify some points about how the browser DOM and the script language interact. Paul Rubin wrote: > Huh? The language itself has to provide the sandbox. > Remember that scripts have to be able to see > certain DOM elements but not others, a

Running Python scripts under W2K with I/O redirection

2005-06-24 Thread sub1ime_uk
I apologise if this is a well known problem. I've searched and can't find a clear description or fix. Hope someone can help. I am running my Python scripts under Windows 2000 using Python 2.4 Build 243 from Activestate. If I want to specify a file as standard input to my script I can just enter a

Re: help!

2005-06-24 Thread Johannes Findeisen
On Fri, 2005-06-24 at 14:14 +0200, Andreas Kostyrka wrote: > On Fri, Jun 24, 2005 at 02:49:01PM +0300, Eser Çetinkaya wrote: > > > > > > In your documentation, it is written : > > " > > os.path.getatime(path) > > Return the time of last access of path. The return value is a number

Re: Favorite non-python language trick?

2005-06-24 Thread D H
Roy Smith wrote: > Tom Anderson <[EMAIL PROTECTED]> wrote: > >>The one thing i really do miss is method overloading by parameter >>type. I used this all the time in java > > > You do things like that in type-bondage languages like Java and C++ > because you have to. Can you give an example of

Re: Two questions on lambda:

2005-06-24 Thread Christophe Delord
hello, On Fri, 24 Jun 2005 14:48:16 +0200, Xavier Décoret wrote: > Hi, > > In the same spirit, how can I do to compute intermediary values in the > > body of a lambda function. Let's say (dummy example): > > f = lambda x : y=x*x,y+y > > > In languages like Caml, you can do: > > let f = func

Re: Running Python interpreter in Emacs

2005-06-24 Thread Philippe C. Martin
Hi, Since I'm a Linux user, I went through the following procedure: I installed emacs 20.7.1 and Python 2.4 I installed python-mode 1.0A into site-lisp I added c:\python24 to my path I put this .emacs on c:\ (see further down - I'm sure you don't need half of it) And everyhing is working fine:

Re: Two questions on lambda:

2005-06-24 Thread Sean McIlroy
def PRINT(x): print x f = lambda: PRINT("hello") ### def let(x,y): globals()[x] = y return True f = lambda x: let('y',x*x) and y+y -- http://mail.python.org/mailman/listinfo/python-list

Parallel execution (CGI)

2005-06-24 Thread mmf
Hi! I am using Python for CGI scripting. I had the following script: #!/usr/bin/python import sys print 'Content-type: text/html\r\n\r\n' print 'starting...' sys.stdout.flush() x = 99 y = 5478 counter = 0 while counter < 1000: z = x^y counter += 1 print 'finished!' sys.std

Re: Favorite non-python language trick?

2005-06-24 Thread George Sakkis
"Joseph Garvin" wrote: > I'm curious -- what is everyone's favorite trick from a non-python > language? And -- why isn't it in Python? Although it's an optimization rather than language trick, I like the inline functions/methods in C++. There has been a thread on that in the past (http://tinyurl.

Re: trouble subclassing str

2005-06-24 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "Paul McGuire" <[EMAIL PROTECTED]> wrote: [ ... lots of interesting discussion removed ... ] > Most often, I see "is-a" confused with "is-implemented-using-a". A > developer decides that there is some benefit (reduced storage, perhaps) > of modeling a zip code usi

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-24 Thread Riccardo Galli
On Fri, 24 Jun 2005 09:00:04 -0500, D H wrote: >> Bo Peng wrote: >> >>> I need to pass a bunch of parameters conditionally. In C/C++, I can >>> do func(cond1?a:b,cond2?c:d,.) >>> >>> Is there an easier way to do this in Python? >> >> > The answer is simply no, just use an if statement instead.

Re: Favorite non-python language trick?

2005-06-24 Thread Jeffrey Maitland
1 trick I liked in C++ was for For loops. { for(int i = 0; i < 100; i++){ //do stuff } } wrapping the for loop in { } makes the i a local variable and then you can use it again in the code if not you will get a variable already defined error. As a side note python already keeps it a local var

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-24 Thread D H
Riccardo Galli wrote: > On Fri, 24 Jun 2005 09:00:04 -0500, D H wrote: > > >>>Bo Peng wrote: >>> >>> I need to pass a bunch of parameters conditionally. In C/C++, I can do func(cond1?a:b,cond2?c:d,.) Is there an easier way to do this in Python? >>> >>> >>The answer is simply

Looking for Python Finite State Machine Implementations

2005-06-24 Thread Leonard J. Reder
Hello, Although posted this a few weeks ago I still have gotten much feedback so I want to put this out again and see if the response gets a bit more interesting. I have been searching on the web for a while now for a specific Python implementation of an FSM. More specifically what I am looki

  1   2   >