Re: . is a good idea! (OT, was: Re: do you master list comprehensions?)

2004-12-27 Thread Steven Bethard
I wrote: Kent Johnson wrote: You can do the same thing using a PYTHONSTARTUP file - see http://docs.python.org/tut/node4.html#SECTION00424 You can change the prompts with import sys sys.ps1 = ' ' sys.ps2 = ' ... ' Very cool. I didn't know about this. Does anyone know how to

Re: Complementary language?

2004-12-27 Thread Alex Martelli
Mike Meyer [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Alex Martelli) writes: Objective-C is cool... on the Mac; I'm not sure how well-supported it is elsewhere, though. In addition to C's advantages, it would let you make Cocoa GUIs on the Mac easily (with PyObjC c). But then, the

Re: Are tuple really immutable?

2004-12-27 Thread Fredrik Lundh
Chris wrote: 1) Given a tuple, how can I know if it can be a dictionnary key or not? Of course I could call __hash__ and catch for a TypeError exception, but I'm looking for a better way to do it. calling hash(obj) is the only sane way to figure out if calling hash(obj) will work. 2)

built-in 'property'

2004-12-27 Thread Bob . Cowdery
Title: Message Hi Can any one explain how property works. It seems to be fine if executed on import i.e. if the property statement is at class scope. If I put the statement inside __init__() then it appears to work ok but when I try to access the property by e.g. klass.x it just tells me

Re: Improving Python (was: Lambda going out of fashion)

2004-12-27 Thread Fredrik Lundh
Dima Dorfman wrote: I happen to not mind the ''.join syntax, but if I did, I would use str.join('', seq) which is just like a join builtin except that it's not as easy to make it work on pre-string-method Pythons. just like join, except that it isn't: string.join(seq, sep) u'axbxc'

Re: Optional Static Typing - Haskell?

2004-12-27 Thread Alex Martelli
Donn Cave [EMAIL PROTECTED] wrote: ... And you probably think Eiffel supports fully modular programming, as I thought Objective CAML did. But Alex seems not to agree. Rather, I would say it's Dr Van Roy and Dr Haridi who do not agree; their definition of truly open programming being quite

Re: Unicode entries on sys.path

2004-12-27 Thread Bengt Richter
On Thu, 23 Dec 2004 19:24:58 +0100, =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= [EMAIL PROTECTED] wrote: Thomas Heller wrote: It seems that Python itself converts unicode entries in sys.path to normal strings using windows default conversion rules - is this a problem that I can fix by changing

Re: Tricks to install/run Python on Windows ?

2004-12-27 Thread StepH
It's me a écrit : Try running with the latest version of Python 2.3 instead of 2.4. May be you would have better luck. I've found similar stability problems with some of the tools (eventhough they have 2.4 releases) as well. I switched back to 2.3 and so far I have no complains. So far i

Re: Are tuple really immutable?

2004-12-27 Thread Alex Martelli
Chris [EMAIL PROTECTED] wrote: ... 3) In this example, is t considered mutable or not? Tuple are immutable says the doc, but: t[0].append(0) t ([1, 0], [2]) The tuple is immutable but its elements can be mutable: I tend to think that it means that the tuple is mutable. Indeed, it

Re: AttributeError of a module instance

2004-12-27 Thread Paolino
Terry Reedy wrote: I'd like to catch AttributeError on the module level,so that I can declare default bindings for useds defore definition.How is this to be done? 'defore' is obviously 'before', but what is 'useds'? In and case... Unresolved bindings,possibly like _rdf_type Traceback (most

Re: list IndexError

2004-12-27 Thread Alex Martelli
Scott David Daniels [EMAIL PROTECTED] wrote: Ishwor wrote: On Thu, 23 Dec 2004 13:57:55 -0300, Batista, Facundo [EMAIL PROTECTED] wrote: #- True, true. Maybe you could lobby for copy as a builtin in #- Python 3000? That's a good idea to me. But copy() as a builtin is not clear if

Re: A Revised Rational Proposal

2004-12-27 Thread Nick Coghlan
Mike Meyer wrote: Yup. Thank you. This now reads: Regarding str() and repr() behaviour, repr() will be either ''rational(num)'' if the denominator is one, or ''rational(num, denom)'' if the denominator is not one. str() will be either ''num'' if the denominator is one, or ''(num / denom)'' if the

Re: Improving Python

2004-12-27 Thread Steve Holden
Aahz wrote: In article [EMAIL PROTECTED], Fredrik Lundh [EMAIL PROTECTED] wrote: func(*arg) instead of apply() is a step back -- it hides the fact that functions are objects, and it confuses the heck out of both C/C++ programmers and Python programmers that understand the def func(*arg) form,

Re: Creating Image Maps

2004-12-27 Thread Steve Holden
Aaron wrote: Thanks for the responses guys! The first option you provided sounds great, Steve. I think I'm gonna try it that way. OK. It's usually the easiest way if the subsections are at all regular. If they are irregular it's often the *only* way! This is a technique that can also be used on

RE: A Revised Rational Proposal

2004-12-27 Thread Batista, Facundo
Title: RE: A Revised Rational Proposal [Mike Meyer] #- When combined with a floating type - either complex or float - or a #- decimal type, the result will be a TypeError. The reason for this is #- that floating point numbers - including complex - and decimals are #- already imprecise. To

RE: A Revised Rational Proposal

2004-12-27 Thread Batista, Facundo
Title: RE: A Revised Rational Proposal [Dan Bishop] #- I disagree with raising a TypeError here. If, in mixed-type #- expressions, we treat ints as a special case of rationals, it's #- inconsistent for rationals to raise TypeErrors in situations #- where int #- doesn't. I think it never

Re: Optional Static Typing

2004-12-27 Thread Luis M. Gonzalez
Robert Kern wrote: Starkiller, at least, can deal with cases where a variable might be one of a set of types and generates code for each of this set. Explicit type declarations can help keep these sets small and reduces the number of times that Starkiller needs to fall back to PyObject_*

RE: A Revised Rational Proposal

2004-12-27 Thread Batista, Facundo
Title: RE: A Revised Rational Proposal [Dan Bishop] #- * Binary operators with one Rational operand and one float or Decimal #- operand will not raise a TypeError, but return a float or Decimal. I think this is a mistake. Rational should never interact with float. #- * Expressions of

Re: Python To Send Emails Via Outlook Express

2004-12-27 Thread Steve Holden
[EMAIL PROTECTED] wrote: Hi David, I'd be happy to post it to python-win32 but don't know how. Ian Send mail to [EMAIL PROTECTED] If you want to see it arrive you might join the list beforehand - go to www.python.org and follow the Mailing Lists link to find out how to subscribe. regards

Re: Detecting if a program is currently running.

2004-12-27 Thread Brian
Thanks, that does the trick. Mike Meyer [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: Yeah, but it takes work on both ends. You could wrap your mpg123 in a shell script like so: #!/bin/sh mpg123 $@ echo $! /tmp/mpg123.pid Or in python 2.4: #!/usr/bin/env python from

Customizing interpreter behavior [was: Clearing the screen]

2004-12-27 Thread Steve Holden
John Machin wrote: Ishwor wrote: i was just tinkering with it actually. ;-) In your command prompt just do Pythonwin.exe /run C:\Python24\file\PyFiles\clear.py It's not a very good idea to store your own scripts in the PythonXY directory -- other than tested working modules which you install in

Re: WxListBox

2004-12-27 Thread Steve Holden
LutherRevisited wrote: I'm wanting to put a listbox in the place of a textctrl I'm using in my application because I'm running out of space in my textctrl. The online documentation is down at wxpython.org so I have no idea how to construct this control or anything. Can someone help me out.

Re: SimpleHTTPServer, queries unhandled?

2004-12-27 Thread Steve Holden
Bryan Rasmussen wrote: Hey just doing some preliminary testing with SimpleHTTPServer, and i noticed that when i request a resource with a query string parameters that this was not handled. is this correct, or is there a method to set query string handling? Well, since SimpleHTTPServer doesn't

Re: Jython IronPython Under Active Development?

2004-12-27 Thread Steve Holden
HackingYodel wrote: Cameron Laird wrote: In article [EMAIL PROTECTED], Robert Kern [EMAIL PROTECTED] wrote: . . . It should be noted that Jim Hugunin no longer works on Jython although he did start the project (possibly with others, I'm not sure).

Re: A Revised Rational Proposal

2004-12-27 Thread Steve Holden
Dan Bishop wrote: Steven Bethard wrote: Dan Bishop wrote: Mike Meyer wrote: PEP: XXX I'll be the first to volunteer an implementation. Very cool. Thanks for the quick work! For stdlib acceptance, I'd suggest a few cosmetic changes: No problem. Implementation of rational arithmetic. [Yards of

Re: Jython IronPython Under Active Development?

2004-12-27 Thread Kent Johnson
Steve Holden wrote: Just a little further background. The Python Software Foundation recently awarded a grant to help to bring Jython into line with the current CPython release. Is information publicly available about this and other PSF grants? I don't see any announcement on the PSF web site

Re: Jython IronPython Under Active Development?

2004-12-27 Thread Steve Holden
Kent Johnson wrote: Steve Holden wrote: Just a little further background. The Python Software Foundation recently awarded a grant to help to bring Jython into line with the current CPython release. Is information publicly available about this and other PSF grants? I don't see any announcement

Re: Python on Linux

2004-12-27 Thread Philippe C. Martin
On Red Hat 9, Python is installed by default and it's version is 2.2.2 If I want to upgrade Python to 2.3.4(newer version), how could I do? If I compile source code of Python, how do I uninstall the old version? I tried rpm packages but failed with dependence. I didn't try the rpm's.  Just

Red Robin Jython JDK classes

2004-12-27 Thread Henri Sivonen
I am trying to set up the Red Robin Jython Development Tools for Eclipse. It finds the Python libraries of Jython and my own jars. It does not find the JDK classes. If I try to add classes.jar from the JDK to the Jython Class Path of the project, the plug-in no longer finds even my own Java

Re: Python Interactive Shell - outputting to stdout?

2004-12-27 Thread Steve Holden
Steve Holden wrote: Avi Berkovich wrote: Hey, I can't make it work, I don't get any data from either stdout nor stderr. If I send lines and then close the stdin pipe, I may get an exception message from several lines up. I tried manually reading from the stdout pipe, but it just blocks and

Re: A Revised Rational Proposal

2004-12-27 Thread Skip Montanaro
Mike ... or making them old-style classes, which is discouraged. Since when is use of old-style classes discouraged? Skip -- http://mail.python.org/mailman/listinfo/python-list

MDaemon Warning - virus found: Returned mail: see transcript for details

2004-12-27 Thread Mail Delivery Subsystem
*** WARNING ** Este mensaje ha sido analizado por MDaemon AntiVirus y ha encontrado un fichero anexo(s) infectado(s). Por favor revise el reporte de abajo. AttachmentVirus name Action taken

RE: Best GUI for small-scale accounting app?

2004-12-27 Thread Gabriel Cosentino de Barros
Title: RE: Best GUI for small-scale accounting app? From: Paul Rubin [mailto:http://phr.cx@NOSPAM.invalid] Dave Cook [EMAIL PROTECTED] writes: You might not care. And in that case Tk is much simpler than just about anything else, unless looks are really important. I've used

Re: A Revised Rational Proposal

2004-12-27 Thread Steve Holden
Skip Montanaro wrote: Mike ... or making them old-style classes, which is discouraged. Since when is use of old-style classes discouraged? Well, since new-style classes came along, surely? I should have thought the obvious way to move forward was to only use old-style classes when their

Re: A Revised Rational Proposal

2004-12-27 Thread Mike Meyer
Nick Coghlan [EMAIL PROTECTED] writes: Mike Meyer wrote: Yup. Thank you. This now reads: Regarding str() and repr() behaviour, repr() will be either ''rational(num)'' if the denominator is one, or ''rational(num, denom)'' if the denominator is not one. str() will be either ''num'' if the

Re: A Revised Rational Proposal

2004-12-27 Thread Mike Meyer
Skip Montanaro [EMAIL PROTECTED] writes: Mike ... or making them old-style classes, which is discouraged. Since when is use of old-style classes discouraged? I was under the imperssion that old-style classes were going away, and hence discouraged for new library modules. However, a way

Re: Unicode entries on sys.path

2004-12-27 Thread Thomas Heller
Martin v. Löwis [EMAIL PROTECTED] writes: Thomas Heller wrote: It seems that Python itself converts unicode entries in sys.path to normal strings using windows default conversion rules - is this a problem that I can fix by changing some regional setting on my machine? You can set the system

Re: program in interactive mode

2004-12-27 Thread Mike Meyer
John Machin [EMAIL PROTECTED] writes: Mike Meyer wrote: I've discovered a truly elegant trick with python programs that interpret other data. Q0. Other than what? Other than Python code. You make them ignore lines that start with # at the beginning of the line, Q1. After the first user

Re: Optional Static Typing - Haskell?

2004-12-27 Thread Mike Meyer
Donn Cave [EMAIL PROTECTED] writes: Quoth Mike Meyer [EMAIL PROTECTED]: | [EMAIL PROTECTED] (Alex Martelli) writes: ... | But then, the above criticism applies: if interface and implementation | of a module are tightly coupled, you can't really do fully modular | programming AND static

RE: A Revised Rational Proposal

2004-12-27 Thread Batista, Facundo
Title: RE: A Revised Rational Proposal [Mike Meyer] #- I don't think so, as I don't see it coming up often enough to warrant #- implementing. However, Rational(x / y) will be an acceptable #- string format as fallout from accepting floating point string #- representations. Remember that

python metrics program/script sample

2004-12-27 Thread Philippe C. Martin
Hi, I am looking for an eric3/linux compatible alternative to checking code metrics (ex: true lines of code count) Regards, Philippe -- http://mail.python.org/mailman/listinfo/python-list

RE: Tutorial problem

2004-12-27 Thread Batista, Facundo
Title: RE: Tutorial problem [Rÿe9veillÿe9] #- The problem is that it doesnt print the #- #- [ choice = input ('Pick a number:') ] #- #- command. It just runs thru the whole thing without #- allowing the user a selection. Are you sure? It should raise a NameErrorin the while,

Re: Tutorial problem

2004-12-27 Thread Paul Robson
On Mon, 27 Dec 2004 08:15:51 -0800, Rÿe9veillÿe9 wrote: The problem is that it doesnt print the [ choice = input ('Pick a number:') ] command. It just runs thru the whole thing without allowing the user a selection. Are you running it from the command line ? Some editors do not

Re: Unicode entries on sys.path

2004-12-27 Thread Martin v. Löwis
Thomas Heller wrote: How should these patches be approached? Please have a look as to how posixmodule.c and fileobject.c deal with this issue. On windows, it would probably be easiest to use the MS generic text routines: _tcslen instead of strlen, for example, and to rely on the _UNICODE

Re: More elegant way to cwd?

2004-12-27 Thread Peter Hansen
Kamilche wrote: Is there a more elegant way to change the working directory of Python That depends on how you define elegant, I guess. to the directory of the currently executing script, and add a folder called 'Shared' to the Python search path? This is what I have. It seems like it could be

Re: where is ctypes.py?

2004-12-27 Thread Peter Hansen
[EMAIL PROTECTED] wrote: I'm a complete newbie in learning python. I was testing some sample codes I found in this newsgroup and seems it could not locate the module ctypes.py. I installed python 2.4, wxPython and pywin32. Just could not find this file. I thought it should be in Lib/site-packages/

Re: python metrics program/script sample

2004-12-27 Thread Peter Hansen
Philippe C. Martin wrote: I am looking for an eric3/linux compatible alternative to checking code metrics (ex: true lines of code count) I don't know what eric3/linux compatible might be, I'm not sure what this would be an alternative _to_, and I don't know what you mean by true lines of code

Re: Optional Static Typing - Haskell?

2004-12-27 Thread Michael Hobbs
Neal D. Becker [EMAIL PROTECTED] wrote: I've just started learning about Haskell. I suggest looking at this for an example. A good intro: http://www.haskell.org/tutorial I've always found that with Haskell, if I can get my program to compile without error, it usually runs flawlessly.

Re: SimpleHTTPServer, queries unhandled?

2004-12-27 Thread Kartic
Try this in IDLE: import CGIHTTPServer CGIHTTPServer.test() This starts serving right away. You can also look at CGIHTTPServer.py in your Python/Lib to see how test() has been implemented. test() starts serving from the current directory (of running python). If you create a folder called

Re: Tutorial problem

2004-12-27 Thread Steve Holden
Rÿe9veillÿe9 wrote: Hello, I have just started doing the python tutorials and i tried to modify one of the exercises, it has to to with defining functions. I wanted the user to be able to enter an option and then get a print of the selected option. I also wanted to have an exit for the

Re: Optional Static Typing

2004-12-27 Thread Donn Cave
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Alex Martelli) wrote: John Roth [EMAIL PROTECTED] wrote: ... question: static typing is an answer. What's the question? (That's a paraphrase.) The answer that everyone seems to give is that it prevents errors and clarifies the

Re: where is ctypes.py?

2004-12-27 Thread [EMAIL PROTECTED]
Peter, Thank you very much. I'll keep that in mind. - wcc -- http://mail.python.org/mailman/listinfo/python-list

Re: list addition methods compared.

2004-12-27 Thread François Granger
Le 27/12/04 1:03, « Ishwor » [EMAIL PROTECTED] a écrit : so indeed method 2 (l2.extend() ) is the fastest ?? In 2/3 times, method 3 (l3 += [x] seems faster than method 1/2 in my P2.4GHZ machine with 512mb??? :-( Could u run the code in your machine and perhaps and let me know what the

help - problem installing pywin32

2004-12-27 Thread [EMAIL PROTECTED]
Hello, I was trying to install pywin32 on one computer which has Python 2.4 installed and it failed. The error message I got was Can't load Python for pre-install script. I tried unintalling reinstalling python and that didn't fix the problem. What might be the problem? Thank you very much.

Re: python metrics program/script sample

2004-12-27 Thread Philippe C. Martin
pylint looks good! thanks Philippe -- http://mail.python.org/mailman/listinfo/python-list

Re: test

2004-12-27 Thread flippetygibbet
Tim Peters wrote: try: sdfdsafasd except NameError: pass else: True = None is None and 1 != 2 False = None is not None or 1 == 2 A simple Google search reveals that sdfdsafasd is misspelled, and helpfully gives the correct spelling: Did you mean: sdfasdfasd

Re: Complementary language?

2004-12-27 Thread Donn Cave
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Alex Martelli) wrote: Robin Becker [EMAIL PROTECTED] wrote: Alex Martelli wrote: . If you're looking for SERIOUS multiparadigmaticity, I think Oz may be best -- http://www.info.ucl.ac.be/people/PVR/book.html (the book's

Re: python metrics program/script sample

2004-12-27 Thread Peter Hansen
Philippe C. Martin wrote: true lines of code meant no blanks or comment - pycount calls those normal source code: Pycount does not treat a blank line as normal source code, at least in the version I'm using. It quite clearly differentiates between various types of lines, including a header in

Re: Optional Static Typing

2004-12-27 Thread Alex Martelli
Michael Hobbs [EMAIL PROTECTED] wrote: Your proposition reminds me very much of Design by Contract, which is a prominent feature of the Eiffel programming language. Considering that Python is an interpreted language where type checking would naturally occur at runtime, I think Design by

Re: PHP vs. Python (speed-wise comparison)

2004-12-27 Thread Jon Perez
[EMAIL PROTECTED] wrote: Anyone know which is faster? I'm a PHP programmer but considering getting into Python ... did searches on Google but didn't turn much up on this. Thanks! Stephen If you're talking about usage as a server side scripting language, then PHP will likely give better page

Re: Python 3000, zip, *args and iterators

2004-12-27 Thread Steve Holden
Raymond Hettinger wrote: [...] Not everything that can be done, should be done. ... and not everything that should be done, can be done. regards Steve -- Steve Holden http://www.holdenweb.com/ Python Web Programming http://pydish.holdenweb.com/ Holden Web LLC +1 703 861 4237

Re: Are tuple really immutable?

2004-12-27 Thread Terry Reedy
Chris [EMAIL PROTECTED] wrote: ... 3) In this example, is t considered mutable or not? Tuple are immutable says the doc, but: t[0].append(0) t ([1, 0], [2]) The tuple is immutable but its elements can be mutable: I tend to think that it means that the tuple is mutable. Indeed, it

PyHeartBeat Client in PERL?

2004-12-27 Thread GMane Python
Hello Everyone. Whil e reading the Python Cookbook as a means of learning Python, I came across the script by Nicola Larosa. Not knowing anything about PERL, I was wondering if there were a translation in PERL so I could have my Netware servers send heartbeats to the heartbeat

Re: where is ctypes.py?

2004-12-27 Thread Terry Reedy
Peter Hansen I see others have pointed you to the module, but nobody has yet told you how you could have found it yourself. ctypes and many other such modules are third-party packages which do not come with Python itself. In almost all cases, you should be able to use Google quite easily

Re: PyHeartBeat Client in PERL?

2004-12-27 Thread Skip Montanaro
Dave While reading the Python Cookbook as a means of learning Python, I Dave came across the script by Dave Larosa. Not knowing anything about Dave PERL, I was wondering if there were a translation in PERL so I Dave could have my Netware servers send heartbeats to the heartbeat

Re: Optional Static Typing - Haskell?

2004-12-27 Thread Scott David Daniels
Michael Hobbs wrote: I've always found that with Haskell, if I can get my program to compile without error, it usually runs flawlessly. (Except for the occasional off-by-one error. :-) Then you need Scott and Dave's Programming Language -- SAD/PL. By providing separate data types for even and odd

Re: Optional Static Typing

2004-12-27 Thread Robert Kern
Luis M. Gonzalez wrote: Robert Kern wrote: Starkiller, at least, can deal with cases where a variable might be one of a set of types and generates code for each of this set. Explicit type declarations can help keep these sets small and reduces the number of times that Starkiller needs to fall

Reading a HP Printer Web Interface

2004-12-27 Thread rbt
Hello there, Depending on the firmware version of the HP printer and the model type, one will encounter a myriad of combinations of the following strings while reading the index page: hp HP color Color Printer Printer Status Status: Device: Device Status laserjet LaserJet How can I go about

Re: need some help with threading module...

2004-12-27 Thread M.E.Farmer
chahnaz.ourzikene wrote: M.E.Farmer [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Just a warning! Threads and newbies don't mix well, many pitfalls and hard to find bugs await you. I would avoid using threads if at all possible. Indeed :). But how will i learn

RFC 2965 cookies, cookielib, and mailman.

2004-12-27 Thread C. Titus Brown
Hi all, just spent some time playing with cookielib in Python 2.4, trying to get the cookielib example [0] to work with my mailman admindb page. The problem was that cookies weren't getting saved. The issue turned out to be that mailman sends out RFC 2965 [1] cookies, which are by default rejected

Re: Optional Static Typing

2004-12-27 Thread Ville Vainio
Alex == Alex Martelli [EMAIL PROTECTED] writes: Alex I've always liked the (theoretical) idea that assertions Alex (including of course contracts) could be used as axioms used Alex to optimize generated code, rather than (necessarily) as a Alex runtime burden. E.g. (and I don't

Re: Optional Static Typing - Haskell?

2004-12-27 Thread Robin Becker
Scott David Daniels wrote: Then you need Scott and Dave's Programming Language -- SAD/PL. By providing separate data types for even and odd numbers, you can avoid off-by-one errors ;-) mmmhhh off by two-licious -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list

Re: A Revised Rational Proposal

2004-12-27 Thread John Roth
Mike Meyer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Nick Coghlan [EMAIL PROTECTED] writes: Mike Meyer wrote: Yup. Thank you. This now reads: Regarding str() and repr() behaviour, repr() will be either ''rational(num)'' if the denominator is one, or ''rational(num, denom)'' if the

objects as mutable dictionary keys

2004-12-27 Thread Peter Maas
There was a huge and sometimes heated debate about tuples, lists and dictionaries recently, and the mainstream opinion was that dictionary keys must not be mutable, so lists are not allowed as dictionary keys. BUT: objects are allowed as dictionary keys, aren't they? See the interpreter session

Re: Best GUI for small-scale accounting app?

2004-12-27 Thread JanC
McBooCzech schreef: IMHO this is the worst think for the Python community: you can find one Python only with an excellent support. Great But on the other hand it is possible to find plenty of GUI tools and for the beginner (and may be not just for the beginner) it is so hard to choose the

Re: objects as mutable dictionary keys

2004-12-27 Thread Steven Bethard
Peter Maas wrote: This strikes me because if one can do this with instances of user defined classes why not with lists? Trying to use lists as dict keys yields TypeError: list objects are unhashable. So why are list objects unhashable and user defined objects hashable? For user defined objects

Re: PHP vs. Python (speed-wise comparison)

2004-12-27 Thread JZ
Dnia Tue, 28 Dec 2004 02:54:13 +0800, Jon Perez napisa(a): If you're talking about usage as a server side scripting language, then PHP will likely give better page serving throughput for the same hardware configuration versus even something that is mod_python based (but I believe the speed

Re: objects as mutable dictionary keys

2004-12-27 Thread Peter Maas
Andrew Koenig schrieb: This strikes me because if one can do this with instances of user defined classes why not with lists? Trying to use lists as dict keys yields TypeError: list objects are unhashable. So why are list objects unhashable and user defined objects hashable? For user defined

Re: objects as mutable dictionary keys

2004-12-27 Thread Andrew Dalke
Andrew Koenig: If d is a dict and t1 and t2 are tuples, and t1 == t2, then d[t1] and d[t2] are the same element. So long as the elements of t1 and t2 are well-behaved. class Spam: ... def __hash__(self): ... return id(self) ... def __eq__(self, other): ... return True ... t1 =

Re: Optional Static Typing

2004-12-27 Thread Ryan Paul
On Thu, 23 Dec 2004 01:49:35 -0800, bearophileHUGS wrote: Adding Optional Static Typing to Python looks like a quite complex thing, but useful too: http://www.artima.com/weblogs/viewpost.jsp?thread=85551 I wrote a blog post this morning in which I briefly argue using DbC and predicate based

Re: objects as mutable dictionary keys

2004-12-27 Thread Peter Maas
Steven Bethard schrieb: If lists were hashable, new programmers to Python would almost certainly make mistakes like: py d = {[1, 2, 3]: 'abc'} The coder here almost certainly *doesn't* want that list to be compared by id. The only way to get a binding for that list would be using the dict's

Re: objects as mutable dictionary keys

2004-12-27 Thread John Roth
Peter Maas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] There was a huge and sometimes heated debate about tuples, lists and dictionaries recently, and the mainstream opinion was that dictionary keys must not be mutable, so lists are not allowed as dictionary keys. BUT: objects are

Re: objects as mutable dictionary keys

2004-12-27 Thread Andrew Koenig
Peter Maas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This leads to the question: Why does (t1 == t2 = d[t1] identical to d[t2]) hold for user defined objects and not for lists? My answer: because the cmp function looks at id() for user defined objects and at list content for

Re: Complementary language?

2004-12-27 Thread Martin Drautzburg
HackingYodel [EMAIL PROTECTED] writes: Does any single language do a better job in Python's weaker areas? Would anyone care to suggest one to supplement Python. My first real OO language was Smalltalk. But the existing Smalltalk implementations all have some severe shortcomings. Either they

wxTreeCtrl checking for valid IDs

2004-12-27 Thread Martin Drautzburg
I have run across a weired problem: I am using a wxTreeCtrl with a model for each tree node. The tree expands lazily and each time a node is expanded, its children (Views) are completely rebuilt, creating new IDs. The children register their respecive models using two self written classes Model

Re: Are tuple really immutable?

2004-12-27 Thread Brian Beck
Terry Reedy wrote: No, not in the way intended by the word 'mutable'. A tuple is like an ordered club roster written in indelible ink before the time of whiteout. The members of the club may change (change jobs, residence, relationships, etc) but the roster remains the same: same members, same

Re: objects as mutable dictionary keys

2004-12-27 Thread Steven Bethard
Peter Maas wrote: Steven Bethard schrieb: If lists were hashable, new programmers to Python would almost certainly make mistakes like: py d = {[1, 2, 3]: 'abc'} The coder here almost certainly *doesn't* want that list to be compared by id. The only way to get a binding for that list would

Re: More elegant way to cwd?

2004-12-27 Thread M.E.Farmer
Peter Hansen wrote: [snip] Other than using os.pardir instead of '..', and possibly adding an os.path.abspath() call to the last bit (or does realpath already do that? It's unclear from the docs) [snip] I believe os.path.abspath and os.path.realpath are the same. realpath is just an alias for

Re: WxListBox

2004-12-27 Thread M.E.Farmer
I think he is using an GUI editor wxGlade or BOA. He has two problems he is trying to figure out wxPython and he is trying to figure out his drag and drop editor. On top of that he seems to be having a design problem. I am gonna let him stew in it, it will be good for him ;) He will get more out

Confusion About Classes

2004-12-27 Thread flamesrock
Hi, I've been playing like mad with all sorts of python modules..but I still can't seem to get my head around the proper use of a class and self. The question stems from this code I made(snippet): -- import

Re: Confusion About Classes

2004-12-27 Thread Steven Bethard
flamesrock wrote: Hi, I've been playing like mad with all sorts of python modules..but I still can't seem to get my head around the proper use of a class and self. The question stems from this code I made(snippet): [snip misaligned code] When posting to c.l.py it's greatly appreciated if you use

Re: built-in 'property'

2004-12-27 Thread Shalabh Chaturvedi
[EMAIL PROTECTED] wrote: Hi Can any one explain how property works. It seems to be fine if executed on import i.e. if the property statement is at class scope. Properties are meant to be used at the class scope. A property is a kind of descriptor. See

Re: Python Interactive Shell - outputting to stdout?

2004-12-27 Thread Avi Berkovich
Avi Berkovich wrote: Hey, I can't make it work, I don't get any data from either stdout nor stderr. If I send lines and then close the stdin pipe, I may get an exception message from several lines up. I tried manually reading from the stdout pipe, but it just blocks and hangs no matter what I

Tkinter vs wxPython

2004-12-27 Thread Esmail Bonakdarian
Greetings all. I will have about 2 weeks to pursue some Python related activities and would like to learn more about the graphical end of things. In that vein I would like some opinions regarding Tkinter and wxPython. (The previously recommended PyGame is appropriate for me for now, but I am

Is it possible to open a dbf

2004-12-27 Thread John Fabiani
Hi, I'm wondering if there is a module available that will open a dbf (actually sco foxpro 2.6) file under linux. Hopefully it will be DAPI 2.0 but I'll accept anything at this point. John -- http://mail.python.org/mailman/listinfo/python-list

Mixing metaclasses and exceptions

2004-12-27 Thread Steve Menard
In writing the next version of Jpype (Python to Java bridge), I have hot a rather unpleasant wall ... Hopefully it is I who is doing something wrong and i can be fixed ... Since I am bridging Java classes and presenting them as Python classes, I decided to try to create a corresponding python

Re: Is it possible to open a dbf

2004-12-27 Thread Paul Rubin
John Fabiani [EMAIL PROTECTED] writes: I'm wondering if there is a module available that will open a dbf (actually sco foxpro 2.6) file under linux. Hopefully it will be DAPI 2.0 but I'll accept anything at this point. Yes, there is, I found such a thing with a minute or so of Google

Re: argument type

2004-12-27 Thread Brian Beck
It's me wrote: How do I know if arg1 is a single type (like a number), or a list? isinstance is probably good enough for your needs. if isinstance(arg1, (list, tuple, dict)): print arg1 is a container else: print arg1 is (probably) not a container -- Brian Beck Adventurer of the First

Re: WxListBox

2004-12-27 Thread LutherRevisited
This was the aforementioned doublepost guys, thanks for all the help though. At that point I was using WxGlade if you were wondering, that's why my controls have such funny names, glade did it!..lol I've since then got my gui to a point where I can live with it, other than the sizing problem

Re: FutureWarning

2004-12-27 Thread Bengt Richter
On Fri, 24 Dec 2004 10:10:38 -0500, Peter Hansen [EMAIL PROTECTED] wrote: Egor Bolonev wrote: = C:\Documents and Settings\ŠÕÀ³\My Documents\Scripts\octopus_eye\1\oct_eye_db.py: 213: FutureWarning: hex()/oct() of negative int will return a signed string in P ython 2.4 and

  1   2   >