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 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 i

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'axb

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 qu

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

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 remembe

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 mutabl

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 (mos

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

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 d

Re: Python Interactive Shell - outputting to stdout?

2004-12-27 Thread Steve Holden
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 se

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 t

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 th

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 St

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 pyt

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. Here'

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 imp

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 o

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 or

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 o

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.

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 c

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 hangs

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.

Re: Python Interactive Shell - outputting to stdout?

2004-12-27 Thread Avi Berkovich
Hey Steve, Well, I've tried flush() before, but I didn't know about the "-u" switch. Thank you for tinkering on this, I shall post again if I make any progress. Avi Steve Holden wrote: Steve Holden wrote: Avi Berkovich wrote: Hey, I can't make it work, I don't get any data from either stdout nor s

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 inco

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''

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

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 se

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

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 A

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 tha

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

Tutorial problem

2004-12-27 Thread Rÿffffe9veillÿffffe9
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 user. This is the code

Re: Unicode entries on sys.path

2004-12-27 Thread "Martin v. Löwis"
Bengt Richter wrote: The real question here is: why does Python not support arbitrary Unicode strings on sys.path? It could, in principle, atleast on Windows NT+ (and also on OSX). Patches are welcome. What about removable drives? And mountable multiple file system types? I'm not sure I understand

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, bec

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

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 preproce

Re: Tutorial problem

2004-12-27 Thread Steven Bethard
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 us

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 sho

Re: Optional Static Typing

2004-12-27 Thread Michael Hobbs
Rahul <[EMAIL PROTECTED]> wrote: > I am assuming that optional type checking is being added for easier > debugging only. So if 'expects' are turned on , python raises > warnings(which do not halt the system) but not when they are turned > off. These will enable easier debugging for new people while

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 cgi-bin

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 us

Re: embedding: forcing an interpreter to end

2004-12-27 Thread Peter Hansen
dan charnitsky wrote: I wish (hope) Python will move in that direction along with scaling down more easily for embedded use. That won't happen if you just wait for the existing development team to do it (nor even if you ask them, I suspect), as this is likely of little interest to any of them. Onl

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 cla

Re: More elegant way to cwd?

2004-12-27 Thread F. Petitjean
On Mon, 27 Dec 2004 11:53:57 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: > 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 >

Re: python metrics program/script sample

2004-12-27 Thread Philippe C. Martin
>>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 count, but the only thing I've >>noticed lately that counts lines of Python code, and I'm fairly >>sure it would run fine on Linux,

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

Re: python metrics program/script sample

2004-12-27 Thread F. Petitjean
On Mon, 27 Dec 2004 12:09:16 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: > 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

Re: Python 3000, zip, *args and iterators

2004-12-27 Thread Raymond Hettinger
[Steven Bethard] > What I would prefer is something like: > > >>> zip(*g(4)) > > >>> x, y, z = zip(*g(4)) > >>> x, y, z > (, So I guess my real question is, should I expect Python 3000 to play > nicely with *args and iterators? Are there reasons (besides backwards > incompatibility) that pars

Re: need some help with threading module...

2004-12-27 Thread chahnaz.ourzikene
Hi everybody, "Daniel Bickett" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] > Instead of having the Controller query the Subject (not exactly > plausible), I had it wait for a signal (threading.Event) as set by the > Subject. You could also have it query a queue, as that

Re: need some help with threading module...

2004-12-27 Thread chahnaz.ourzikene
"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 using threads if i avoid

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 http://www

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 -- (t

Re: Optional Static Typing

2004-12-27 Thread Alex Martelli
Donn Cave <[EMAIL PROTECTED]> wrote: ... > > > Most of the kinds of error that static typing is supposed > > > to catch simply don't persist for more than a minute when > > > you do test driven development. > > > > ...which is exactly the point of the famous post by Robert ("Uncle Bob") > > Mar

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

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 servin

Re: Python 3000, zip, *args and iterators

2004-12-27 Thread Alex Martelli
Raymond Hettinger <[EMAIL PROTECTED]> wrote: ... > "Not everything that can be done, should be done." Or, to quote Scripture...: "'Everything is permissible for me' -- but not everything is beneficial" (1 Cor 6:12)... Alex -- http://mail.python.org/mailman/listinfo/python-list

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 tupl

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 serve

Re: Problem with os.listdir and delay with unreachable network drives on Windows

2004-12-27 Thread Read Roberts
Thank you for your response - this was very helpful. I find that 'win32net.NetGetUseInfo()' does not deal with UNC names - it seems to require a drive specification in the form of a single letter. The following sequence worked well for me, resulting in a much shorter 'hang time' for unreachab

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 quit

Re: Python 3000, zip, *args and iterators

2004-12-27 Thread Steven Bethard
Raymond Hettinger wrote: [Steven Bethard] What I would prefer is something like: >>> zip(*g(4)) >>> x, y, z = zip(*g(4)) >>> x, y, z (, at ...) 2. It is instructive to look at Guido's reactions to other *args proposals. His receptivity to a,b,*c=it wanes whenever someone then requests support fo

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 heartbea

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 ba

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 dete

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 ho

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. (

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)'' i

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 bel

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

Re: objects as mutable dictionary keys

2004-12-27 Thread Andrew Koenig
"Peter Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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 unhashab

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 ha

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 sp

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 objec

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 ... >>

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

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 ar

  1   2   >