Dr. Dobb's Python-URL! - weekly Python news and links (Jul 29)

2005-07-30 Thread Simon Brunning
QOTW: Guido has marked the trail; don't ignore the signs unless you really know where you're going. - Raymond Hettinger 'Proverbs 28:14 JPS Happy is the man that feareth alway; but he that hardeneth his heart shall fall into evil. Obviously an exhortation to not ignore raised exceptions with

Re: Python-cgi or Perl-cgi script doubt

2005-07-30 Thread EP
Prabahar wrote: I want to know difference between Python-cgi and Perl-cgi and also I want to which one is efficient from the performance. The difference between a cgi program written in Perl and a cgi program written in Python is the choice of programming language. Both work quite

Re: A replacement for lambda

2005-07-30 Thread Paul Rubin
James Richards [EMAIL PROTECTED] writes: Personally, I can't recall any decent programmer I know who objects to actually writing out a variable name. In fact, I don't know a single real programmer (this is one who writes programs he intends to look at again in, say, 3 weeks) who doesn't

Re: Wheel-reinvention with Python

2005-07-30 Thread Torsten Bronger
Hallöchen! Calvin Spealman [EMAIL PROTECTED] writes: The choice is GUI toolkits is largely seperate from Python. Consider that they are just bindings to libraries that are developed completely seperate of the language. GUI is should be seperate from the language, and thus not bound to same

Re: A replacement for lambda

2005-07-30 Thread Kay Schluehr
Tim Roberts schrieb: Scott David Daniels [EMAIL PROTECTED] wrote: What kind of shenanigans must a parser go through to translate: x**2 with(x)x**3 with(x) this is the comparison of two functions, but it looks like a left- shift on a function until the second with is encountered.

Re: A replacement for lambda

2005-07-30 Thread Paolino
why (x**2 with(x))(x**3 with(x)) is not taken in consideration? If 'with' must be there (and substitue 'lambda:') then at least the syntax is clear.IMO Ruby syntax is also clear. ___ Yahoo! Mail: gratis 1GB per i messaggi e

Re: Hiding

2005-07-30 Thread Jay
but also, wat if i needed to hide the loading of a file or the even hide the whole python window to run in background?? is there no module or function i can use -- http://mail.python.org/mailman/listinfo/python-list

Re: A replacement for lambda

2005-07-30 Thread D H
Mike Meyer wrote: Rewriting a canonical abuse of lambda in this idiom gives: myfunc = def @(*args): return sum(x + 1 for x in args) Nice proposal. Technically you don't need the @ there, it is superfluous. But then again so is the colon, so whatever floats your boat. class

Re: A replacement for lambda

2005-07-30 Thread Paul Rubin
D H [EMAIL PROTECTED] writes: where fdel = def (self): ... As you can see, it doesn't save much over the traditional way since you have to name the anonymous lambdas anyway. It saves polluting the surrounding namespace with superfluous variables

keylogger in Python

2005-07-30 Thread Jay
ok, i thought for 2 seconds i might have created a Keylogger in python but i still have one major think stopping me... PYTHON. when i run the program i have python create a file named keylog2.log and it then logs all keys pressed/typed in the python IDE into that file. All i want to know now is

Re: Block-structured resource handling via decorators

2005-07-30 Thread Michele Simionato
I will shamelessly point out my decorator module: http://www.phyast.pitt.edu/~micheles/python/decorator.zip The documentation is here: http://www.phyast.pitt.edu/~micheles/python/documentation.htm There is an example of redirecting stdout which is relevant to this thread. HTH,

Re: keylogger in Python

2005-07-30 Thread Paul Rubin
Jay [EMAIL PROTECTED] writes: ok, i thought for 2 seconds i might have created a Keylogger in python but i still have one major think stopping me... PYTHON. when i run the program i have python create a file named keylog2.log and it then logs all keys pressed/typed in the python IDE into that

Re: A replacement for lambda

2005-07-30 Thread Paddy
Christopher Subich [EMAIL PROTECTED] writes: Basically, I'd rewrite the Python grammar such that: lambda_form ::= expression with parameter_list I do prefer my parameter list to come before the expression. It would remain consistant with simple function definitions. - Cheers, Paddy. --

Re: To thread or not to thread

2005-07-30 Thread snacktime
On 28 Jul 2005 12:10:12 -0700, Sidd [EMAIL PROTECTED] wrote: Hello, I was recently reading an article on threading in python and I came across Global Interpreter Lock,now as a novince in python I was cusrious about 1.Is writing a threaded code in python going to perform well than a

Re: A replacement for lambda

2005-07-30 Thread Stefan Rank
on 30.07.2005 10:20 Paolino said the following: why (x**2 with(x))(x**3 with(x)) is not taken in consideration? If 'with' must be there (and substitue 'lambda:') then at least the syntax is clear.IMO Ruby syntax is also clear. I am sorry if this has already been proposed (I am sure it

rfc822 module bug?

2005-07-30 Thread Nemesis
Hi all, I found that the function parsedate_tz of the rfc822 module has a bug (or at least I think so). I found a usenet article (message-id: [EMAIL PROTECTED]) that has this Date field: Date: Tue,26 Jul 2005 13:14:27 GMT +0200 It seems to be correct¹, but parsedate_tz is not able to decode it,

Re: A replacement for lambda

2005-07-30 Thread Paul Rubin
Stefan Rank [EMAIL PROTECTED] writes: I am sorry if this has already been proposed (I am sure it has). Why not substitue python-lambdas with degenerated generator expressions:: (lambda x: func(x)) == (func(x) for x) I don't think I've seen that one before, and FWIW it's kind of cute. But

Re: Python-cgi web or Perl-cgi script doubt

2005-07-30 Thread Michael Sparks
praba kar wrote: I want to know difference between Python-cgi and Perl-cgi and also I want to which one is efficient from the performance. Possibly the most important difference between the two is when you're using JUST cgi - ie no mod_perl, no mod_python, etc. With python, if your cgi

Re: A replacement for lambda

2005-07-30 Thread Kay Schluehr
Mike Meyer schrieb: I know, lambda bashing (and defending) in the group is one of the most popular ways to avoid writing code. However, while staring at some Oz code, I noticed a feature that would seem to make both groups happy - if we can figure out how to avoid the ugly syntax. This

Re: multiple inheritance super()

2005-07-30 Thread Michele Simionato
If I understand correcly you have a situation like this: Base | Parent1 Mixin | | | | Children1 Base | Parent2 Mixin | | | | Children2 Base | Parent3 | | Children3 The Base class is pretty general, Parent1, Parent2 and Parent3 are more

Re: A replacement for lambda

2005-07-30 Thread Paul Rubin
Kay Schluehr [EMAIL PROTECTED] writes: Examples: f = ( || x=0 then f(x) || True then f(-x) from (x,) ) g = ( || x 0 then self._a -x || self._a - 0 from (x,)) Is this an actual language? It looks sort of like CSP. Python with native parallelism, m. --

Re: A replacement for lambda

2005-07-30 Thread Kay Schluehr
Paul Rubin wrote: Kay Schluehr [EMAIL PROTECTED] writes: Examples: f = ( || x=0 then f(x) || True then f(-x) from (x,) ) g = ( || x 0 then self._a -x || self._a - 0 from (x,)) Is this an actual language? It looks sort of like CSP. Python with native parallelism, m. The

How can I run a program?

2005-07-30 Thread Lad
Hello, I am running Python on XP and have a problem with a program if its name consists '-' for example: my-program.py When I try to run a program with such name I get the error : Traceback (most recent call last): File interactive input, line 1, in ? NameError: name 'my' is not defined

Re: Ten Essential Development Practices

2005-07-30 Thread matt . schinckel
Dark Cowherd wrote: GUI, Web development, Application Framework - it is shambles. Yeah, I agree. When I finally make that GUI application I still don't know whether I am going to use wx or PyGTK. I was part of the anygui development team, back when it was still active (I think I technically am

Re: Graphics files Python

2005-07-30 Thread Pekka Karjalainen
In article [EMAIL PROTECTED], Terry Reedy wrote: Besides the other responses, you might also check out the pygame site where there once were some tutorial examples of manipulating bitmaps with Numerical Python to get various effects. I'll keep this in mind too. Thanks to both for helpful

Re: functions without parentheses

2005-07-30 Thread phil hunt
On Fri, 29 Jul 2005 06:37:52 GMT, Bengt Richter [EMAIL PROTECTED] wrote: I suggested in a previous thread that one could support such a syntax by supporting an invisible binary operator between two expressions, That's a truely appalling idea. so that examine string translates to

Re: How can I run a program?

2005-07-30 Thread Thorsten Kampe
* Lad (2005-07-30 11:33 +0100) I am running Python on XP and have a problem with a program if its name consists '-' for example: my-program.py When I try to run a program with such name /How/ do you run the program for Guido's sake?! I get the error : Traceback (most recent call last):

PyPy sprint announcement: Heidelberg 22nd - 29th August 2005

2005-07-30 Thread Carl Friedrich Bolz
PyPy Sprint in Heidelberg 22nd - 29th August 2005 == The next PyPy sprint will take place at the Heidelberg University in Germany from 22nd August to 29th August (both days included). Its main focus is translation of the whole PyPy interpreter to a

Re: Hiding

2005-07-30 Thread Thorsten Kampe
* Jay (2005-07-30 08:51 +0100) but also, wat if i needed to hide the loading of a file As others have pointed out: your question is pointless as opening a file doesn't load it or open it in your preferred application. You are confusing Operating System semantics with Python semantics. You're

Re: Block-structured resource handling via decorators

2005-07-30 Thread John Perks and Sarah Mount
The only cases I see the first school of thought is when the resource in question is scarce in some way. By resource I meant anything with some sort of acquire/release semantics. There may be plenty of threading.Locks available, but it's still important that a given Lock is released when not

Comparison of functions

2005-07-30 Thread Steven D'Aprano
Playing around with comparisons of functions (don't ask), I discovered an interesting bit of unintuitive behaviour: (lambda y: y) (lambda y: y) False Do the comparison again and things become even more bizarre: (lambda y: y) (lambda y: y) True (lambda y: y) (lambda y: y) False This

Re: Path inherits from basestring again

2005-07-30 Thread Reinhold Birkenfeld
NickC wrote: [Re: alternatives to overloading '/'] Is there a reason the Path constructor is limited to a single argument? If it allowed multiple arguments, the following would seem very straightforward: p = Path(somePath, user.getFolder(), 'archive', oldPath + .bak) That's a quite good

Re: [path-PEP] Path inherits from basestring again

2005-07-30 Thread Reinhold Birkenfeld
Ivan Van Laningham wrote: Hi All-- Tony Meyer wrote: So far, there have been various statements that look like +0 for __div__, but no-one with a +1. (And I've said this a couple of times now, which really is just trolling for a +1 from someone). It's not a question of saving

Re: Comparison of functions

2005-07-30 Thread Peter Hansen
Steven D'Aprano wrote: Playing around with comparisons of functions (don't ask), I discovered an interesting bit of unintuitive behaviour: (lambda y: y) (lambda y: y) False Do the comparison again and things become even more bizarre: (lambda y: y) (lambda y: y) True (lambda y: y)

Re: Comparison of functions

2005-07-30 Thread tiissa
Steven D'Aprano wrote: Playing around with comparisons of functions (don't ask), I discovered an interesting bit of unintuitive behaviour: a = lambda y: y b = lambda y: y a function lambda at 0xf70598ec b function lambda at 0xf7059844 a b False So I'm puzzled about how Python compares

Problems installing Python

2005-07-30 Thread BadBob
I have been trying to install python on an older pc. At first I tryed to install from the Suse 9.1 Pro Cd's. However it reported an error with the core php 4 file. I tried again with the same result. So I checked with Suse and there was an updated version. I downloaded it and it also reported an

Re: PEP on path module for standard library

2005-07-30 Thread Reinhold Birkenfeld
Mike Orr wrote: The main changes I'd like to see in Path (some of these have been made in Python CVS at nondist/sandbox/path/path.py) are: Thanks for the comments! They are greatly appreciated. - When methods create path objects, use self.__class__() instead of Path(). This makes it

Re: Path inherits from basestring again

2005-07-30 Thread Reinhold Birkenfeld
NickC wrote: [Re: how to get at the base class] Do you really want to have a only works for Path way to get at the base class, rather than using the canonical Path.__bases__[0]? How about a new property in the os.path module instead? Something like os.path.path_type. Then

Re: A replacement for lambda

2005-07-30 Thread Reinhold Birkenfeld
Stefan Rank wrote: on 30.07.2005 10:20 Paolino said the following: why (x**2 with(x))(x**3 with(x)) is not taken in consideration? If 'with' must be there (and substitue 'lambda:') then at least the syntax is clear.IMO Ruby syntax is also clear. I am sorry if this has already been

Re: Comparison of functions

2005-07-30 Thread Steven D'Aprano
On Sat, 30 Jul 2005 08:13:26 -0400, Peter Hansen wrote: Beginners should not be comparing lambdas. Neither should you. ;-) Actually, yes I should, because I'm trying to make sense of the mess that is Python's handling of comparisons. At least two difference senses of comparisons is jammed

Re: Comparison of functions

2005-07-30 Thread Steven D'Aprano
On Sat, 30 Jul 2005 14:20:50 +0200, tiissa wrote: Steven D'Aprano wrote: Playing around with comparisons of functions (don't ask), I discovered an interesting bit of unintuitive behaviour: a = lambda y: y b = lambda y: y a function lambda at 0xf70598ec b function lambda at 0xf7059844 a b

Re: Comparison of functions

2005-07-30 Thread Adriano Varoli Piazza
Steven D'Aprano ha scritto: On Sat, 30 Jul 2005 08:13:26 -0400, Peter Hansen wrote: Beginners should not be comparing lambdas. Neither should you. ;-) Actually, yes I should, because I'm trying to make sense of the mess that is Python's handling of comparisons. At least two difference

Re: Comparison of functions

2005-07-30 Thread Adriano Varoli Piazza
Adriano Varoli Piazza ha scritto: As far as I recall from Math Analysis, which I studied two months ago, you can't sort complex numbers. It makes no sense. The reason being (reading from my book), it's not possible to define an order that preserves the properties of arithmetical operations

Re: Comparison of functions

2005-07-30 Thread Reinhold Birkenfeld
Steven D'Aprano wrote: On Sat, 30 Jul 2005 08:13:26 -0400, Peter Hansen wrote: Beginners should not be comparing lambdas. Neither should you. ;-) Actually, yes I should, because I'm trying to make sense of the mess that is Python's handling of comparisons. At least two difference senses

Re: Selection, picking with PyOpenGL?

2005-07-30 Thread Mike C. Fletcher
Erik Max Francis wrote: I was interesting in adding selection and hit testing to ZOE, and was looking at the PyOpenGL wrappers' handling of selection and picking. I see glSelectBuffer to specify the size of the buffer, and glRenderMode properly returns the number of hits when put back into

Dr. Dobb's Python-URL! - weekly Python news and links (Jul 29)

2005-07-30 Thread Simon Brunning
QOTW: Guido has marked the trail; don't ignore the signs unless you really know where you're going. - Raymond Hettinger 'Proverbs 28:14 JPS Happy is the man that feareth alway; but he that hardeneth his heart shall fall into evil. Obviously an exhortation to not ignore raised exceptions with

Re: Wheel-reinvention with Python

2005-07-30 Thread Peter Decker
On 7/30/05, Torsten Bronger [EMAIL PROTECTED] wrote: I've been having a closer look at wxPython which is not Pythonic at all and bad documented. Probably I'll use it nevertheless. PyGTK and PyQt may have their own advantages and disadvantages. However, in my opinion we don't need yet

Re: [path-PEP] Path inherits from basestring again

2005-07-30 Thread Ivan Van Laningham
Hi All-- Tony Meyer wrote: (Those who are offended by sweeping generalisations should ignore this next bit) [...generalisation bit snipped...] This is not only bullshit, it's elitist bullshit. Windows users are more clueless than users of posix systems. Pfui. Prove it or withdraw

Re: How can I run a program?

2005-07-30 Thread phil hunt
On 30 Jul 2005 03:33:14 -0700, Lad [EMAIL PROTECTED] wrote: Hello, I am running Python on XP and have a problem with a program if its name consists '-' for example: my-program.py When I try to run a program with such name I get the error : Traceback (most recent call last): File interactive

Re: Wheel-reinvention with Python

2005-07-30 Thread phil hunt
On Sat, 30 Jul 2005 08:54:59 +0200, Torsten Bronger [EMAIL PROTECTED] wrote: Hallöchen! Calvin Spealman [EMAIL PROTECTED] writes: The choice is GUI toolkits is largely seperate from Python. Consider that they are just bindings to libraries that are developed completely seperate of the

Re: [path-PEP] Path inherits from basestring again

2005-07-30 Thread phil hunt
On Fri, 29 Jul 2005 14:38:23 +1200, Tony Meyer [EMAIL PROTECTED] wrote: def functions_which_modifies_some_file_in_place(path): output = open(path+'.tmp', 'w') . I dont want a seperator inserted between path and the new extension. Fair enough. Forget using '+' for join, then (which I

Re: [path-PEP] Path inherits from basestring again

2005-07-30 Thread phil hunt
On Fri, 29 Jul 2005 14:48:55 +1200, Tony Meyer [EMAIL PROTECTED] wrote: Would you really choose this: p = Path() / build / a / very / very / long / path Over this: p = Path(os.path.join(build, a, very, very, long, path)) Or have the constructor accept multiple arguments. ? A saving

Re: Comparison of functions

2005-07-30 Thread Georg Neis
* Reinhold Birkenfeld [EMAIL PROTECTED] wrote: Steven D'Aprano wrote: 1+0j == 1 0 True (1+0j == 1) yields True, which is comparable to 0. a == b c is equivalent to a == b and b c: 1 == 1+0j 0 Traceback (most recent call last): File stdin, line 1, in ? TypeError: cannot compare

How to do this?

2005-07-30 Thread flyaflya
the codes as follow: class Base: def fun(self): print base_fun def fun2(self): print base_fun2 class Foo: def __init__(self, base): self.__base = base def fun3(self): print foo_fun3 b = Base() foo = Foo(b) my aim is:when foo.fun3() be called,it run as usually,

Re: Wheel-reinvention with Python

2005-07-30 Thread Torsten Bronger
Hallöchen! Peter Decker [EMAIL PROTECTED] writes: On 7/30/05, Torsten Bronger [EMAIL PROTECTED] wrote: I've been having a closer look at wxPython which is not Pythonic at all and bad documented. Probably I'll use it nevertheless. PyGTK and PyQt may have their own advantages and

Re: Wheel-reinvention with Python

2005-07-30 Thread Torsten Bronger
Hallöchen! [EMAIL PROTECTED] (phil hunt) writes: [...] How about sometihing with the same API as Tkinter (so no need to relearn), but which looks prettier? Would that fix your gripes? I haven't learned Tkinter. Well, I programed toy applications with different toolkits (including Tkinter)

showing help(M) when running module M standalone

2005-07-30 Thread Chris
hello, I have a small module which only contains some utility functions. when running this standalone I would like to show the module docs and each function docs, as if doing import M help(M) I came up with the following but I reckon there is a much simpler way? if __name__ ==

Re: Wheel-reinvention with Python

2005-07-30 Thread Peter Decker
On 7/30/05, Torsten Bronger [EMAIL PROTECTED] wrote: I'm aware of it (and there is Wax and maybe a third one). Actually it illustrates my point quite well: These projects are small and instable (Dabo has a developer basis of very few people, Wax has only one); they are even worse documented;

string methods

2005-07-30 Thread anthonyberet
I am an abject newbie, so mock away (actually no-one ever does that in this group..) Anyway, I want to replace one character in a string, based in that character's position in the string. For example if I wanted to replace the 4th character in 'foobar' (the b)with the contents of another

Re: [path-PEP] Path inherits from basestring again

2005-07-30 Thread Steven D'Aprano
On Sat, 30 Jul 2005 14:10:52 +0200, Reinhold Birkenfeld wrote: Above all, nobody can tell me that there's any programmer who doesn't instantly recognize '/' as a directory separator. Is classic Macintosh OS still supported on Python? Because Mac programmers who haven't made the jump to OS X

Re: How to do this?

2005-07-30 Thread Dan Sommers
On Fri, 29 Jul 2005 22:34:23 +0800, flyaflya [EMAIL PROTECTED] wrote: the codes as follow: class Base: def fun(self): print base_fun def fun2(self): print base_fun2 class Foo: def __init__(self, base): self.__base = base def fun3(self): print foo_fun3

Re: showing help(M) when running module M standalone

2005-07-30 Thread Dan Sommers
On Sat, 30 Jul 2005 17:04:50 +0200, Chris [EMAIL PROTECTED] wrote: hello, I have a small module which only contains some utility functions. when running this standalone I would like to show the module docs and each function docs, as if doing import M help(M) I came up with

Re: Wheel-reinvention with Python

2005-07-30 Thread Torsten Bronger
Hallöchen! Peter Decker [EMAIL PROTECTED] writes: On 7/30/05, Torsten Bronger [EMAIL PROTECTED] wrote: I'm aware of it (and there is Wax and maybe a third one). Actually it illustrates my point quite well: These projects are small and instable (Dabo has a developer basis of very few

Re: PEP on path module for standard library

2005-07-30 Thread Steven D'Aprano
On Sat, 30 Jul 2005 14:43:27 +0200, Reinhold Birkenfeld wrote: Less important but non-controversial: - Path.tempfile(), Path.tempdir(): Create a temporary file using tempfile.mkstemp, tempfile.mkdtemp - Path.tempfileobject(): Create a temporary file object using tempfile.TemporaryFile.

Re: showing help(M) when running module M standalone

2005-07-30 Thread tiissa
Chris wrote: hello, I have a small module which only contains some utility functions. when running this standalone I would like to show the module docs and each function docs, as if doing import M help(M) I came up with the following but I reckon there is a much simpler way?

Re: Ten Essential Development Practices

2005-07-30 Thread Kay Schluehr
Dark Cowherd wrote: -Quote - Phillip J. Eby from dirtsimple.org Python as a community is plagued by massive amounts of wheel-reinvention. The infamous web framework proliferation problem is just the most egregious example. Why is Python blessed with so much reinvention? Because it's often

Re: Comparison of functions

2005-07-30 Thread Steven D'Aprano
On Sat, 30 Jul 2005 13:22:47 +, Adriano Varoli Piazza wrote: As far as I recall from Math Analysis, which I studied two months ago, you can't sort complex numbers. It makes no sense. The reason being (reading from my book), it's not possible to define an order that preserves the

Re: Comparison of functions

2005-07-30 Thread Steven D'Aprano
On Sat, 30 Jul 2005 13:30:20 +, Adriano Varoli Piazza wrote: But tell me, how do you think sort works if not with , , ==, = and = ? I'm really interested. How do you sort words in a dictionary? Why does five come before four when the number five is larger than the number four? Why does

Re: Comparison of functions

2005-07-30 Thread Adriano Varoli Piazza
Steven D'Aprano ha scritto: It was easy. I never once asked myself whether some complex number was greater or less than another, I just asked which one comes first in a lexicographic sort? The two questions are NOT the same, and it is an ugliness in an otherwise beautiful language that

Re: Comparison of functions

2005-07-30 Thread Adriano Varoli Piazza
Steven D'Aprano ha scritto: On Sat, 30 Jul 2005 13:30:20 +, Adriano Varoli Piazza wrote: But tell me, how do you think sort works if not with , , ==, = and = ? I'm really interested. How do you sort words in a dictionary? Why does five come before four when the number five is

Re: Wheel-reinvention with Python

2005-07-30 Thread Peter Decker
On 7/30/05, Torsten Bronger [EMAIL PROTECTED] wrote: Well, wxPython itself is largely the work of a single person, but I doubt that many consider that a reason to avoid it. But the developer and contributor base is much larger, so the project has reached the critical mass. So until it

Re: Comparison of functions

2005-07-30 Thread Steven D'Aprano
On Sat, 30 Jul 2005 15:32:45 +0200, Reinhold Birkenfeld wrote: Um, I didn't ask to compare complex numbers using comparison operators. I asked to sort a list. And please don't tell me that that sorting is implemented with comparison operators. That just means that the implementation is

Re: string methods

2005-07-30 Thread Brian Beck
anthonyberet wrote: I know this touches on immutability etc, but I can't find string methods to return the first 3 characters, and then the last 2 characters, which I could concatenate with newchar to make a new string. As tiissa said, you want slicing: py s = foobar py s[:3] 'foo' py s[:3] +

2-player game, client and server at localhost

2005-07-30 Thread Michael Rybak
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do computations, the only data transfered is user mouse/kbd input. It works synchronously, but somehow, when I

Python language ver 2.4 , development platform 0.4

2005-07-30 Thread Dark Cowherd
The Python language is at ver 2.4 and a thing of beauty. As a development environment IMHO it is probably 0.4 I really like what I read when I say import this in Python. But as a development environment - TOOWTDI and batteries included are just not true. I would like to place my position in

Re: Wheel-reinvention with Python

2005-07-30 Thread Ed Leafe
On Saturday 30 July 2005 12:28, Peter Decker wrote: It would be great if the wxPython folks would adopt Dabo, and eventually integrate it so that there is but a single, Pythonic way of working with wxPython, but it seems that they have their hands full just wrapping the C++ code of wxWidgets.

Re: Comparison of functions

2005-07-30 Thread Adriano Varoli Piazza
Steven D'Aprano ha scritto: On Sat, 30 Jul 2005 13:22:47 +, Adriano Varoli Piazza wrote: As far as I recall from Math Analysis, which I studied two months ago, you can't sort complex numbers. It makes no sense. The reason being (reading from my book), it's not possible to define an order

Re: showing help(M) when running module M standalone

2005-07-30 Thread Thomas Heller
Chris [EMAIL PROTECTED] writes: hello, I have a small module which only contains some utility functions. when running this standalone I would like to show the module docs and each function docs, as if doing import M help(M) I came up with the following but I reckon there is a

Re: Comparison of functions

2005-07-30 Thread Kay Schluehr
Some indications: for i in range(5): ... x = lambda x:x ... y = lambda y:y ... print x,y,xy,id(x)id(y) ... function lambda at 0x00EE83F0 function lambda at 0x00EE8FB0 True True function lambda at 0x00EE8AB0 function lambda at 0x00EE83F0 False False function lambda at 0x00EE8FB0

Re: Comparison of functions

2005-07-30 Thread tiissa
Steven D'Aprano wrote: It was easy. I never once asked myself whether some complex number was greater or less than another, I just asked which one comes first in a lexicographic sort? The two questions are NOT the same, and it is an ugliness in an otherwise beautiful language that Python

Re: How can I run a program?

2005-07-30 Thread Calvin Spealman
did you try to put the filename in quotes? On 30 Jul 2005 03:33:14 -0700, Lad [EMAIL PROTECTED] wrote: Hello, I am running Python on XP and have a problem with a program if its name consists '-' for example: my-program.py When I try to run a program with such name I get the error :

Re: [path-PEP] Path inherits from basestring again

2005-07-30 Thread Brian Beck
Ivan Van Laningham wrote: I like / as a shortcut to joinwith(). I like it a lot. I like it so much I'll give you a +2. +1 here. Extremely practical. -- Brian Beck Adventurer of the First Order -- http://mail.python.org/mailman/listinfo/python-list

Re: Path inherits from basestring again

2005-07-30 Thread Michael Hoffman
Reinhold Birkenfeld wrote: It's much the same as with @ decorators. Those who have used them much don't object to the syntax any more. I do and I still think they are ugly. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: [path-PEP] Path inherits from basestring again

2005-07-30 Thread Reinhold Birkenfeld
phil hunt wrote: On Fri, 29 Jul 2005 14:38:23 +1200, Tony Meyer [EMAIL PROTECTED] wrote: def functions_which_modifies_some_file_in_place(path): output = open(path+'.tmp', 'w') . I dont want a seperator inserted between path and the new extension. Fair enough. Forget using '+' for

Re: [path-PEP] Path inherits from basestring again

2005-07-30 Thread Reinhold Birkenfeld
phil hunt wrote: def normalizePath(p, *pathParts): Normalize a file path, by expanding the user name and getting the absolute path.. @param p [string] = a path to a file or directory @param pathParts [list of string] = optional path parts @return [string] = the same path,

Re: [path-PEP] Path inherits from basestring again

2005-07-30 Thread Reinhold Birkenfeld
Steven D'Aprano wrote: On Sat, 30 Jul 2005 14:10:52 +0200, Reinhold Birkenfeld wrote: Above all, nobody can tell me that there's any programmer who doesn't instantly recognize '/' as a directory separator. Is classic Macintosh OS still supported on Python? Because Mac programmers who

Re: Comparison of functions

2005-07-30 Thread Reinhold Birkenfeld
Georg Neis wrote: * Reinhold Birkenfeld [EMAIL PROTECTED] wrote: Steven D'Aprano wrote: 1+0j == 1 0 True (1+0j == 1) yields True, which is comparable to 0. a == b c is equivalent to a == b and b c: Right. Stupid me :) Doesn't do much to the point, though. 1 == 1+0j 0 Traceback

Re: Comparison of functions

2005-07-30 Thread Reinhold Birkenfeld
Steven D'Aprano wrote: On Sat, 30 Jul 2005 15:32:45 +0200, Reinhold Birkenfeld wrote: Um, I didn't ask to compare complex numbers using comparison operators. I asked to sort a list. And please don't tell me that that sorting is implemented with comparison operators. That just means that the

Re: Path inherits from basestring again

2005-07-30 Thread Reinhold Birkenfeld
Michael Hoffman wrote: Reinhold Birkenfeld wrote: It's much the same as with @ decorators. Those who have used them much don't object to the syntax any more. I do and I still think they are ugly. Shouldn't have generalized that. Add most of where you like. Reinhold --

Re: Python language ver 2.4 , development platform 0.4

2005-07-30 Thread Michael Sparks
Dark Cowherd wrote: The Python language is at ver 2.4 and a thing of beauty. As a development environment IMHO it is probably 0.4 Have you considered looking at any of the commercial IDEs? Personally I *like* command line based systems, but I do know many people who swear by GUI based IDEs. If

Re: PEP on path module for standard library

2005-07-30 Thread Peter Hansen
Reinhold Birkenfeld wrote: Mike Orr wrote: - I saw in a thread that .name and .parent were removed. I use them very frequently, along with .ext and .namebase. I don't want to call methods for these. They are now named .basename and .directory. Reinhold, is .parent now .directory? Does that

Re: Wheel-reinvention with Python

2005-07-30 Thread Torsten Bronger
Hallöchen! Peter Decker [EMAIL PROTECTED] writes: On 7/30/05, Torsten Bronger [EMAIL PROTECTED] wrote: [...] I didn't want to say that Dabo is bad. I just wanted to point out that its presence (and the presence of comparable projects) doesn't ease the IMO unfortunate situation with GUI

Re: PEP on path module for standard library

2005-07-30 Thread Peter Hansen
Reinhold Birkenfeld wrote: Mike Orr wrote: - Who needs .open()? open(myPath) is fine. But it can stay for backward compatibility. Right. I think it's nice for people who like a more OO approach. There's one very good reason to use .open() on a Path object, and in fact it's a (for me)

Re: PEP on path module for standard library

2005-07-30 Thread Reinhold Birkenfeld
Peter Hansen wrote: Reinhold Birkenfeld wrote: Mike Orr wrote: - I saw in a thread that .name and .parent were removed. I use them very frequently, along with .ext and .namebase. I don't want to call methods for these. They are now named .basename and .directory. Reinhold, is .parent now

Re: Comparison of functions

2005-07-30 Thread Steven D'Aprano
On Sat, 30 Jul 2005 16:13:22 +, Adriano Varoli Piazza wrote: Steven D'Aprano ha scritto: It was easy. I never once asked myself whether some complex number was greater or less than another, I just asked which one comes first in a lexicographic sort? The two questions are NOT the

The state of OO wrappers on top of wxPython (was Re: Wheel-reinvention with Python)

2005-07-30 Thread Peter Hansen
Ed Leafe wrote: On Saturday 30 July 2005 12:28, Peter Decker wrote: It would be great if the wxPython folks would adopt Dabo, Thanks for the vote of encouragement! Our goal isn't to muddy the waters; it is simply to create a consistent API for coding. There is already a great GUI

Re: string methods

2005-07-30 Thread Peter Hansen
Brian Beck wrote: anthonyberet wrote: I know this touches on immutability etc, but I can't find string methods to return the first 3 characters, and then the last 2 characters, which I could concatenate with newchar to make a new string. As tiissa said, you want slicing: py s = foobar py

Re: PEP on path module for standard library

2005-07-30 Thread Mike Orr
Sorry for the formatting of my first message; I haven't posted via Google Groups before. Reinhold Birkenfeld wrote: - Some way to pretty-print paths embedded in lists/dicts as strings. I have a .repr_as_str class attribute that toggles this. I think str() does its job nicely there.

Re: 2-player game, client and server at localhost

2005-07-30 Thread Peter Hansen
Michael Rybak wrote: I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do computations, the only data transfered is user mouse/kbd input. It works synchronously, but

Re: Comparison of functions

2005-07-30 Thread Adriano Varoli Piazza
Steven D'Aprano ha scritto: Do you understand the difference between partial and total ordering, or weakly and strongly ordered? When you do understand them, come back and tell me again whether you still think lexicographic sorting has no meaning whatsoever. I think I answered this in

  1   2   >