Re: New to programming question

2005-03-31 Thread Joal Heagney
Oh goddammmni. I seem to be doing this a lot today. Look below for the extra addition to the code I posted. Joal Heagney wrote: Here's my contribution anycase: count = 0 # Get first input name = raw_input("Guess my name: ") # Give the sucker two extra goes while count < 2: # Check the val

Re: New to programming question

2005-03-31 Thread Joal Heagney
Ben wrote: This is an exercise from the Non-programmers tutorial for Python by Josh Cogliati. The exercise is: Write a program that has a user guess your name, but they only get 3 chances to do so until the program quits. Here is my script: -- count = 0 name = raw_input("Gue

Re: Lambda: the Ultimate Design Flaw

2005-03-31 Thread alex goldman
Daniel Silva wrote: > At any rate, FOLD must fold. I personally think GOTO was unduly criticized by Dijkstra. With the benefit of hindsight, we can see that giving up GOTO in favor of other primitives failed to solve the decades-old software crisis. -- http://mail.python.org/mailman/listinfo/pyt

Re: dictionary: sorting the values preserving the order

2005-03-31 Thread Vikram
hi, assuming your key-value relationship is one-to-one then as a simple first pass you can simply initialize d1={} and for i in d.keys(): d1[d[i]] = i and pass d1 to your sortedDictValue3 function, no? thanks, Vikram On 31 Mar 2005, Rakesh wrote: > Hi, > For a partic

Re: Lambda: the Ultimate Design Flaw

2005-03-31 Thread Erik Max Francis
Daniel Silva wrote: Shriram Krishnamurthi has just announced the following elsewhere; it might be of interest to c.l.s, c.l.f, and c.l.p: http://list.cs.brown.edu/pipermail/plt-scheme/2005-April/008382.html April Fool's Day again, eh? -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.c

Ternary Operator in Python

2005-03-31 Thread praba kar
Dear All, I am new to Python. I want to know how to work with ternary operator in Python. I cannot find any ternary operator in Python. So Kindly clear my doubt regarding this With regards, Prabahar __ Do you Yahoo!? Yahoo! Mail - Helps p

Lambda: the Ultimate Design Flaw

2005-03-31 Thread Daniel Silva
Shriram Krishnamurthi has just announced the following elsewhere; it might be of interest to c.l.s, c.l.f, and c.l.p: http://list.cs.brown.edu/pipermail/plt-scheme/2005-April/008382.html The Fate Of LAMBDA in PLT Scheme v300 or La

Re: what's the use of __repr__?when shall I use it?

2005-03-31 Thread Vikram
__repr__ should return something that when eval'ed yields an identical object (if possible). essentially it should represent the programmer/debug view of the object. __str__ should mostly return a highly user-friendly string (note: str(obj) will use __repr__ if __str__ doesn't exist) you might a

Ternary Operator in Python

2005-03-31 Thread praba kar
Dear All, I am new to Python. I want to know how to work with ternary operator in Python. I cannot find any ternary operator in Python. So Kindly clear my doubt regarding this __ Yahoo! Messenger Show us what our next emoticon should look

Re: System bell

2005-03-31 Thread Steve Holden
Trent Mick wrote: [Baza wrote] Am I right in thinking that >>>print "\a" should sound the system, 'bell'? It works on the shell on Windows for me (WinXP). Trent Interesting. From a Cygwin bash shell I got an elegant little dingish sort of a beep (my volume control was set kind of low). I then ran

[python-perl] Translation review?

2005-03-31 Thread TSO
Hi there, I've recently tried to translate some Perl code into Python - code is below. Is there a more Pythonic form? Also, is there a good reason why there are plans to remove lambda from the language? yrs complements-of-the-season-ly... START OF CODE ## 2005-04-01 - T

Re: Little Q: how to print a variable's name, not its value?

2005-03-31 Thread Bengt Richter
On 31 Mar 2005 20:54:42 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >Bengt wrote: >"The way you use those words makes me wonder: "assign _it_"?? Which >'it'? " > >- it's probably evident to any close observer that my understanding of >objects is superficial, no doubt a reflection of the

Re: Stylistic question about inheritance

2005-03-31 Thread Steve Holden
Andrew Koenig wrote: ""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] You would normally try to avoid type queries, and rely on virtual methods instead, if possible. Of course. It seems likely for the application that code can be shared across different subclasse

what's the use of __repr__?when shall I use it?

2005-03-31 Thread could ildg
What's the difference between __repr__ and __str__? When will __repr__ be useful? -- http://mail.python.org/mailman/listinfo/python-list

dictionary: sorting the values preserving the order

2005-03-31 Thread Rakesh
Hi, For a particular problem of mine, I want to sort pairs by its value. Eg: Input: A, 4 B, 5 C, 1 D, 2 E, 3 I would like the output to be: C D E A B i.e. I would like to get the keys in the sorted order of values. I did google around a little bit. One solution to a similar problem sugges

Re: unittest vs py.test?

2005-03-31 Thread Nigel Rowe
Roy Smith wrote: > I've used the standard unittest (pyunit) module on a few projects in the > past and have always thought it basicly worked fine but was just a little > too complicated for what it did. > > I'm starting a new project now and I'm thinking of trying py.test > (http://codespeak.net/

Re: Grouping code by indentation - feature or ******?

2005-03-31 Thread Greg Ewing
Javier Bezos wrote: 2) You have an ending point (e) and a length: lst[e-t+1:e+1]. If you use the "slice indices represent points between the elements" mental model, then you don't have an ending point here, you have one less than the ending point -- hence it's not surprising that you need to add

Re: unittest vs py.test?

2005-03-31 Thread Raymond Hettinger
[Roy Smith] > I've used the standard unittest (pyunit) module on a few projects in the > past and have always thought it basicly worked fine but was just a little > too complicated for what it did. > > I'm starting a new project now and I'm thinking of trying py.test > (http://codespeak.net/py/curr

Re: Things you shouldn't do

2005-03-31 Thread Greg Ewing
Paul McGuire wrote: The code was filled with two key variables: t_1 and t_l. Printing out the source in a Courier font made these two vars completely indistinguishable, Are you sure it was Courier? I'm looking at it now in Courier, and they are different, although very similar. -- Greg Ewing, Comp

Re: mod_python and zope

2005-03-31 Thread grahamd
David Bear wrote: > I will be running zope, and I would also like to run mod_python. The problem > arised when zope wants a threaded version of python and mod_python wants > no_threads. Threads work fine with mod_python. What makes you think they don't? What versions of Apache/Python/mod_python a

48-hour game programming competition only 14 days away

2005-03-31 Thread richard
The 48-Hour Game Programming Competition is a "mostly from scratch", timed, solo coding challenge where all willing game developers spend their allowed time making the best game they can under a common theme. http://www.mechanicalcat.net/tech/ld48/ There have been numerous entries in the past usi

Re: Problem with national characters

2005-03-31 Thread "Martin v. Löwis"
Leif B. Kristensen wrote: Is there a way around this problem? My character set in Linux is ISO-8859-1. In Windows 2000 it should be the equivavent Latin-1, though I'm not sure about which character set the command shell is using. You need to do locale.setlocale(locale.LC_ALL, "") to get locale-spec

Re: Our Luxurious, Rubinesque, Python 2.4

2005-03-31 Thread "Martin v. Löwis"
Larry Hastings wrote: Can someone tell me what made it 80% larger? python24.dll includes many of the extension modules that were separate .pyd files in 2.3, namely _csv, _sre, _symtable, _winreg, datetime, mmap, and parser, i.e. all extension modules that don't require specific libraries. Further

Re: Change between Python 2.3 and 2.4 under WinXP

2005-03-31 Thread "Martin v. Löwis"
Cappy2112 wrote: Do you really think this is a safe solution? Not sure which of the three solutions I mentioned you are referring to as "this". How do you deal with features that are in new 2.4, but you invoke it with the exe from 2.3? If you want to have the script run with both Python 2.3 and 2.4

Re: New to programming question

2005-03-31 Thread Ron_Adam
On 31 Mar 2005 20:03:00 -0800, "Ben" <[EMAIL PROTECTED]> wrote: >Could someone tell me what is wrong and give me a better alternative to >what I came up with. Seperate you raw input statements from your test. Your elsif is skipping over it. Try using only one raw imput statement right after y

Re: assignments - want a PEP

2005-03-31 Thread Kay Schluehr
Bengt Richter wrote: > you can do what you like, pretty much. I.e., > > cas = CAS() > cas.a# like your plain a, where you said "that's it" > > > cas.a, cas.b = cas.Expr(), cas.Expr() > (cas.a + cas.b)/cas.c > > Etc. Hmmm... feels like a good idea if extended to use propert

Re: itertools to iter transition (WAS: Pre-PEP: Dictionary accumulator methods)

2005-03-31 Thread Greg Ewing
Ville Vainio wrote: The issue that really bothers me here is bloating the builtin space. We already have an uncomfortable amount of builtin functions. Maybe what we're really after here is the notion of a builtin module that's pre-imported into the builtin namespace. -- Greg Ewing, Computer Science

Re: __init__ method and raising exceptions

2005-03-31 Thread Leif K-Brooks
NavyJay wrote: I have a simple for-loop, which instantiates a class object each iteration. As part of my class constructor, __init__(), I check for valid input settings. If there is a problem with this iteration, I want to abort the loop, but equivalently 'continue' on in the for-loop. I can't us

Re: itertools to iter transition (WAS: Pre-PEP: Dictionary accumulator methods)

2005-03-31 Thread Greg Ewing
Steven Bethard wrote: I'd argue that for the same reasons that dict.fromkeys is a dict classmethod, the itertools methods could be iter classmethods (or staticmethods). The basic idea being that it's nice to place the methods associated with a type in that type's definiton. The parallel's a l

Re: Little Q: how to print a variable's name, not its value?

2005-03-31 Thread [EMAIL PROTECTED]
Bengt wrote: "The way you use those words makes me wonder: "assign _it_"?? Which 'it'? " - it's probably evident to any close observer that my understanding of objects is superficial, no doubt a reflection of the fact that I started programming on punch cards a very long time ago. I use objects e

Re: System bell

2005-03-31 Thread Daniel Bickett
Trent Mick wrote: > I suspect that you are misinterpreting failure as success here. This is > probably only resulting in a bell from the shell when it complains that > it doesn't know of any command called "\a" to run. Contrarily, \a is in fact the escape sequence for, as the OP put it, the system

Re: Stylistic question about inheritance

2005-03-31 Thread Ivan Van Laningham
Hi All-- Michele Simionato wrote: > > recently I realized that they look better on the paper > than in practice. A non-needed class just adds cognitive > burden to the maintainer. Agreed. Too many classes make me think I'm back trying to figure out what the )([EMAIL PROTECTED] those guys were t

Re: New to programming question

2005-03-31 Thread Michael Spencer
Ben wrote: This is an exercise from the Non-programmers tutorial for Python by Josh Cogliati. The exercise is: Write a program that has a user guess your name, but they only get 3 chances to do so until the program quits. Here is my script: -- count = 0 name = raw_input("Gue

Re: string goes away

2005-03-31 Thread Jack Diederich
On Thu, Mar 31, 2005 at 08:32:20PM -0800, Andreas Beyer wrote: > Hi: > > If I am getting the docs etc. correctly, the string-module is depricated > and is supposed to be removed with the release of Python 3.0. > I still use the module a lot and there are situations in which I don't > know what t

New to programming question

2005-03-31 Thread Ben
This is an exercise from the Non-programmers tutorial for Python by Josh Cogliati. The exercise is: Write a program that has a user guess your name, but they only get 3 chances to do so until the program quits. Here is my script: -- count = 0 name = raw_input("Guess my

Re: Pre-PEP: Dictionary accumulator methods

2005-03-31 Thread Greg Ewing
Steven Bethard wrote: py> def defaultdict(*args, **kwargs): ... defaultfactory, args = args[0], args[1:] which can be written more succinctly as def defaultdict(defaultfactory, *args, **kwargs): ... -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Z

JOB: CONTRACT: Python Programmer – 90% Telecommute

2005-03-31 Thread techdude27
JOB: CONTRACT: Python Programmer – 90% Telecommute We're looking for Python programmer, to work 10-20hours a week, starting immediately, through mid-June, to help us complete develop on a web-based collaboration service (development, testing, production). REQUIRED: Experience in Web scripting (s

Re: string goes away

2005-03-31 Thread Dan Christensen
"Delaney, Timothy C (Timothy)" <[EMAIL PROTECTED]> writes: > Andreas Beyer wrote: > >> Yeeh, I was expecting something like that. The only reason to use >> map() at all is for improving the performance. >> That is lost when using list comprehensions (as far as I know). So, >> this is *no* option f

Re: Stylistic question about inheritance

2005-03-31 Thread Michele Simionato
Koenig: > want to know about the Python community's stylistic > preferences for defing > such hierarchies that don't absolutely need a root. I don't know if there is an official style guide or a Guido's prononcement on the issue. Personally I found such hierarchies attractive in the past, but rece

Re: Our Luxurious, Rubinesque, Python 2.4

2005-03-31 Thread Jeff Epler
In my experience, when built with the same compiler (gcc 3.3.3) the size of the python library file (libpython2.x.a on unix machines) hasn't changed much between 2.3, 2.4, and current CVS: -rw-r--r-- 1 jepler jepler 950426 Mar 31 21:37 libpython2.3.a -rw-rw-r-- 1 jepler jepler 1002158 Mar 31 21:

Re: string goes away

2005-03-31 Thread Skip Montanaro
Andreas> Yeeh, I was expecting something like that. The only reason to Andreas> use map() at all is for improving the performance. That is Andreas> lost when using list comprehensions (as far as I know). So, Andreas> this is *no* option for larger jobs. Did you test your hypothes

Re: string goes away

2005-03-31 Thread alex23
Hey Andreas, > I loved to use > >>> string.join(list_of_str, sep) > instead of > >>> sep.join(list_of_str) > > I think the former is much more telling what is happening than the > latter. However, I will get used to it. I find that binding a name to the separator makes it more readable (YMMV):

__init__ method and raising exceptions

2005-03-31 Thread NavyJay
I have a simple for-loop, which instantiates a class object each iteration. As part of my class constructor, __init__(), I check for valid input settings. If there is a problem with this iteration, I want to abort the loop, but equivalently 'continue' on in the for-loop. I can't use 'break' or '

RE: string goes away

2005-03-31 Thread Delaney, Timothy C (Timothy)
Andreas Beyer wrote: > Yeeh, I was expecting something like that. The only reason to use > map() at all is for improving the performance. > That is lost when using list comprehensions (as far as I know). So, > this is *no* option for larger jobs. Try it and see. You'll probably be pleasantly surp

Re: string goes away

2005-03-31 Thread Ivan Van Laningham
Hi All-- Andreas Beyer wrote: > > I loved to use > >>> string.join(list_of_str, sep) > instead of > >>> sep.join(list_of_str) > > I think the former is much more telling what is happening than the > latter. However, I will get used to it. > I disagree, but maybe you could think of it as a mu

Re: string goes away

2005-03-31 Thread Andreas Beyer
Yeeh, I was expecting something like that. The only reason to use map() at all is for improving the performance. That is lost when using list comprehensions (as far as I know). So, this is *no* option for larger jobs. Andreas Skip Montanaro wrote: >>> upper_list = map(string.upper, list_of_st

Re: string goes away

2005-03-31 Thread Skip Montanaro
>>> upper_list = map(string.upper, list_of_str) Andreas> What am I supposed to do instead? Try [s.upper() for s in list_of_str] Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: File Uploads

2005-03-31 Thread Doug Helm
You're right, of course, and I do appreciate it. I generally am calling functions and returning strings and then printing the entire string. For example: def SomeFunc(): lstrRetVal = '' lstrRetVal += 'Content-type: text/html\n\n' lstrRetVal += more HTML here... return lstrRetVal Then, th

string goes away

2005-03-31 Thread Andreas Beyer
Hi: If I am getting the docs etc. correctly, the string-module is depricated and is supposed to be removed with the release of Python 3.0. I still use the module a lot and there are situations in which I don't know what to do without it. Maybe you can give me some help. I loved to use >>> string

Re: Printing Varable Names Tool.. Feedback requested.

2005-03-31 Thread Ron_Adam
On Thu, 31 Mar 2005 19:13:39 GMT, Ron_Adam <[EMAIL PROTECTED]> wrote: >On Thu, 31 Mar 2005 18:37:53 GMT, Ron_Adam <[EMAIL PROTECTED]> >wrote: > >> >>Hi, Sometimes it just helps to see what's going on, so I've been >>trying to write a tool to examine what names are pointing to what >>objects in the

unittest vs py.test?

2005-03-31 Thread Roy Smith
I've used the standard unittest (pyunit) module on a few projects in the past and have always thought it basicly worked fine but was just a little too complicated for what it did. I'm starting a new project now and I'm thinking of trying py.test (http://codespeak.net/py/current/doc/test.html).

Our Luxurious, Rubinesque, Python 2.4

2005-03-31 Thread Larry Hastings
I finally got 'round to installing Python 2.4. I'm planning on using Python for downloadable software, where every kilobyte counts and smaller is definitely better. Imagine my surprise when I looked up python24.dll and found SWEET JUMPING CHRISTMAS it's ballooned up to 1.8MB! This isn't a deal-k

Re: Printing Varable Names Tool.. Feedback requested.

2005-03-31 Thread Ron_Adam
Fixed it so it now runs from the command line and from winpython as well as idle in Python 2.4 on Windows Xp. I still don't know about linux systems. I decided on viewnames.py as the filename and viewit() as the calling name. #---start--- # viewnames.py """ A utility to print the value of

Re: pySerial- need help.

2005-03-31 Thread Joal Heagney
Joal Heagney wrote: kamarudin samsudin wrote: Hi all, I try to invoke python serial script via my browser using PHP (exec function). For the serial communication, i used pySerial module. It fine when it run it as root but when i try to run it from browser, i got this error in my httpd/error_log F

Re: pySerial- need help.

2005-03-31 Thread Joal Heagney
kamarudin samsudin wrote: Hi all, I try to invoke python serial script via my browser using PHP (exec function). For the serial communication, i used pySerial module. It fine when it run it as root but when i try to run it from browser, i got this error in my httpd/error_log File "weather1.py", l

Re: property and virtuality

2005-03-31 Thread Steven Bethard
Steven Bethard wrote: Laszlo Zsolt Nagy wrote: My problem is about properties and the virtuality of the methods. I would like to create a property whose get and set methods are virtual. Perhaps you want to roll your own VirtualProperty descriptor? Here's one based off the property implementation

Re: System bell

2005-03-31 Thread Trent Mick
[Mr6 wrote] > Matt wrote: > >Try: > >import os > >os.system('\a') > > > > Ta, that's got it. I suspect that you are misinterpreting failure as success here. This is probably only resulting in a bell from the shell when it complains that it doesn't know of any command called "\a" to run. Trent -

Re: LD_LIBRARY_PATH - how to set?

2005-03-31 Thread Joal Heagney
Antoon Pardon wrote: Op 2005-03-31, Joal Heagney schreef <[EMAIL PROTECTED]>: Joal Heagney wrote: Roman Yakovenko wrote: Thanks for help. But it is not exactly solution I am looking for. I would like to do it from python script. For example update_env() #<- this function will change LD_LIBRARY_PAT

Re: Controling the ALU

2005-03-31 Thread M.E.Farmer
Cesar Andres Roldan Garcia wrote: > Hi > > How can I control an ALU from a PC using Python? > > Thanks! Py>def PyAnswers(you) ...your = you ...If you want to control the ALU in the computer: ...# maybe you can use assembler ...pyasm ...elif you want to control an externa

Re: System bell

2005-03-31 Thread Mr6
Matt wrote: Try: import os os.system('\a') Ta, that's got it. B -- http://mail.python.org/mailman/listinfo/python-list

Re: assignments - want a PEP

2005-03-31 Thread Bengt Richter
On 31 Mar 2005 14:48:00 -0800, "Kay Schluehr" <[EMAIL PROTECTED]> wrote: >>From time to time I still use my old Mathematica system. The >Mathematica language has some nice properties. The one I like best is >the possibility to create symbols from nothing. Translated into the >Python realm followin

Re: is there a problem on this simple code

2005-03-31 Thread jrlen balane
i would just like to apologize for my mistake, rest assured everything was taken in helpful way. On Thu, 31 Mar 2005 17:40:06 GMT, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 31 Mar 2005 10:56:07 -0500, Peter Hansen <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: >

Re: Controling the ALU

2005-03-31 Thread Bengt Richter
On Thu, 31 Mar 2005 20:42:30 -, Grant Edwards <[EMAIL PROTECTED]> wrote: >On 2005-03-31, Cesar Andres Roldan Garcia <[EMAIL PROTECTED]> wrote: > >> How can I control an ALU from a PC using Python? > >The ALU is buried pretty deep in the CPU. The ALU is part of >what is actually executing the

Re: Making a DLL with python?

2005-03-31 Thread jppx1
I can't use a COM object because I'm trying to integrate with someone else's product, and they will only accept a DLL. I've already written the basics of the DLL in C++, but doing so has reminded me why I grew to dislike C++! I'd love to do the whole thing in Python, but I don't know how to make

Re: System bell

2005-03-31 Thread Trent Mick
[Baza wrote] > Am I right in thinking that >>>print "\a" should sound the system, 'bell'? It works on the shell on Windows for me (WinXP). Trent -- Trent Mick [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Making a DLL with python?

2005-03-31 Thread alex23
Larry Bates wrote: > Almost all languages can dispatch a COM object easily. Being stuck using VBScript at work, I kind of poked around COM creation one day and was surprised to find that it's possible to just drop python script directly into COM objects. Five minutes later and I was finally using

Re: Newbie Shell Editor Question

2005-03-31 Thread Scott David Daniels
Tim Roberts wrote: Kash <[EMAIL PROTECTED]> wrote: ...However when I start idle and run a program from it; I get the following types of errors Idle is already running the python interpreter. You don't need to start another copy. It is just like you had typed "python" at a command line. If you

Re: System bell

2005-03-31 Thread Matt
Try: import os os.system('\a') -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with national characters

2005-03-31 Thread Max M
Leif B. Kristensen wrote: Is there a way around this problem? My character set in Linux is ISO-8859-1. In Windows 2000 it should be the equivavent Latin-1, though I'm not sure about which character set the command shell is using. The unicode methods seems to do it correctly. So you can decode your

assignments - want a PEP

2005-03-31 Thread Kay Schluehr
>From time to time I still use my old Mathematica system. The Mathematica language has some nice properties. The one I like best is the possibility to create symbols from nothing. Translated into the Python realm following creations are possible: >>> a a That's it. Just make an 'a' as a pure symb

Re: Problem with national characters

2005-03-31 Thread Leif B. Kristensen
Leif B. Kristensen skrev: >Is there something else I have to do? Please forgive me for talking with myself here :-) I should have looked up Unicode in "Learning Python" before I asked. This seems to work: >>> u'før'.upper() u'F\xd8R' >>> u'FØR' u'F\xd8R' >>> 'FØR' 'F\xd8R' So far, so good. Note

System bell

2005-03-31 Thread Baza
Am I right in thinking that >>>print "\a" should sound the system, 'bell'? B -- Computer says, 'no' -- http://mail.python.org/mailman/listinfo/python-list

Re: assignments - want a PEP

2005-03-31 Thread Paul Rubin
"Kay Schluehr" <[EMAIL PROTECTED]> writes: > >>> a = Symbol() > >>> a > a Use a = Symbol('a') instead and it should solve most of the problems you mention. What's supposed to happen anyway, in your proposal, after a = Symbol() b = a print b ? -- http://mail.python.org/mailman/listi

assignments - want a PEP

2005-03-31 Thread Kay Schluehr
>From time to time I still use my old Mathematica system. The Mathematica language has some nice properties. The one I like best is the possibility to create symbols from nothing. Translated into the Python realm following creations are possible: >>> a a That's it. Just make an 'a' as a pure symb

Re: split an iteration

2005-03-31 Thread Robin Becker
Raymond Hettinger wrote: [Robin Becker] This function from texlib in oedipus.sf.net is a real cpu hog and I determined to see if it could be optimized. def add_active_node(self, active_nodes, node): """Add a node to the active node list. The node is added so that the list of active nodes is

Re: Numarray newbie question

2005-03-31 Thread Colin J. Williams
ChinStrap wrote: I know there are probably alternatives for this with the standard library, but I think that would kill the speed I get with numarray: Say I have two 2-dimensional numarrays (x_mat and y_mat, say), and a function f(x,y) that I would like to evaluate at every index. Basically I want

Re: Change between Python 2.3 and 2.4 under WinXP

2005-03-31 Thread Cappy2112
Do you really think this is a safe solution? How do you deal with features that are in new 2.4, but you invoke it with the exe from 2.3? The imports have to be handled as well, and the dlls, and the libs too -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with national characters

2005-03-31 Thread Leif B. Kristensen
> [EMAIL PROTECTED] wrote: > >> put >> >> import sys >> sys.setdefaultencoding('UTF-8') >> >> into sitecustomize.py in the top level of your PYTHONPATH . I found out of it, sort of. Now I've got a PYTHONPATH that points to my home directory, and followed your instructions. The first time I got

Re: split an iteration

2005-03-31 Thread Robin Becker
Peter Otten wrote: Robin Becker wrote: Is there a fast way to get enumerate to operate over a slice of an iterable? I think you don't need that here: e = enumerate(active_nodes) for insert_index, a in e: # ... for index, a in e: # ... Peter I tried your solution, but I think we miss the s

mod_python and zope

2005-03-31 Thread David Bear
I will be running zope, and I would also like to run mod_python. The problem arised when zope wants a threaded version of python and mod_python wants no_threads. I've been searching the mod_python site for pointers on how to install two instances of python, then configuring mod_python to use the n

Re: Stylistic question about inheritance

2005-03-31 Thread Lonnie Princehouse
Well, that's true, but I meant to convey that no grammatical entity is the base class of another entity, so it's a flat inheritance tree in that respect. ASTNode would not be something that the parser would know anything about. I guess that's sort of moot if your expression trees are just a contr

Re: Problem with national characters

2005-03-31 Thread Leif B. Kristensen
[EMAIL PROTECTED] wrote: > put > > import sys > sys.setdefaultencoding('UTF-8') > > into sitecustomize.py in the top level of your PYTHONPATH . Uh ... it doesn't seem like I've got PYTHONPATH defined on my system in the first place: [EMAIL PROTECTED] leif $ env |grep -i python PYTHONDOCS=/usr/

Re: redundant imports

2005-03-31 Thread Steve Holden
Peter Hansen wrote: max(01)* wrote: this leads me to another question. since *.pyc files are automatically created the first time an import statement in executed on a given module, i guess that if i ship a program with modules for use in a directory where the user has no write privileges then i

Re: Problem with national characters

2005-03-31 Thread david . tolpin
> Is there a way around this problem? put import sys sys.setdefaultencoding('UTF-8') into sitecustomize.py in the top level of your PYTHONPATH . -- http://mail.python.org/mailman/listinfo/python-list

Re: split an iteration

2005-03-31 Thread Raymond Hettinger
[Robin Becker] > This function from texlib in oedipus.sf.net is a real cpu hog and I determined > to see if it could be optimized. > > def add_active_node(self, active_nodes, node): > """Add a node to the active node list. > The node is added so that the list of active nodes is always >

Re: Controling the ALU

2005-03-31 Thread Michael Spencer
Grant Edwards wrote: On 2005-03-31, Cesar Andres Roldan Garcia <[EMAIL PROTECTED]> wrote: How can I control an ALU from a PC using Python? The ALU is buried pretty deep in the CPU. The ALU is part of what is actually executing the instructions that _are_ Python. Maybe: >>> from __builtin__ impo

Re: Stylistic question about inheritance

2005-03-31 Thread Steven Bethard
Andrew Koenig wrote: "Carl Banks" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Well, Python seems to get along fine without the ability to do isinstance(foo,file_like_object); probably better off in the end for it. So I'd say you should generally not do it. Inheritence is for whe

Re: Stylistic question about inheritance

2005-03-31 Thread Bengt Richter
On Thu, 31 Mar 2005 20:24:08 GMT, "Andrew Koenig" <[EMAIL PROTECTED]> wrote: >""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] > >> You would normally try to avoid type queries, and rely on virtual >> methods instead, if possible. > >Of course. > >> It seems likely

Re: Stylistic question about inheritance

2005-03-31 Thread "Martin v. Löwis"
Andrew Koenig wrote: So, for example, you don't think it's worth including the base class as a way of indicating future intent? No. In this respect, I believe in XP: refactor when the need comes up, but not before. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

(no subject)

2005-03-31 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1765 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!195.241.76.212.MISMATCH!transit1.news.tiscali.nl!tiscali!transit0.news.tiscali.nl!tudelft.nl!130.161.131.117.MISMATCH!tudelft.nl!newsfeed.multikabel.nl!gatel-ffm!gatel-ffm!proxad.net!pro

Re: Stylistic question about inheritance

2005-03-31 Thread Stefan Seefeld
Andrew Koenig wrote: Of course, there are reasons to have a base class anyway. For example, I might want it so that type queries such as isinstance(foo, Expr) work. My question is: Are there other reasons to create a base class when I don't really need it right now? Coming from C++ myself, I s

Re: Change between Python 2.3 and 2.4 under WinXP

2005-03-31 Thread Peter Hansen
Martin v. Löwis wrote: Franz Steinhäusler wrote: Is there any possibility under WinXP, to alterntate quickly (with batch file or similary) between python23 and python24. If you are concerned that the .py association changes, you have two options: 1. manually edit the registry. Under HKEY_CLASSES_

RE: IMAP4.search by message-id ?

2005-03-31 Thread Sean Dodsworth
Tony Meyer wrote: >> Can anyone tell me how to get a message's number from the message-id >> using IMAP4.search? >> I've tried this: >> resp, items = server.search(None, 'HEADER', >> '"Message-id"', msgID) but it gives me a 'bogus search criteria' error > import imaplib i = imaplib.

Re: Stylistic question about inheritance

2005-03-31 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "Andrew Koenig" <[EMAIL PROTECTED]> wrote: > "Carl Banks" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > Well, Python seems to get along fine without the ability to do > > isinstance(foo,file_like_object); probably better off in the end for

Re: Controling the ALU

2005-03-31 Thread Grant Edwards
On 2005-03-31, Cesar Andres Roldan Garcia <[EMAIL PROTECTED]> wrote: > How can I control an ALU from a PC using Python? The ALU is buried pretty deep in the CPU. The ALU is part of what is actually executing the instructions that _are_ Python. -- Grant Edwards grante

Re: Stylistic question about inheritance

2005-03-31 Thread Irmen de Jong
Andrew Koenig wrote: > "Lonnie Princehouse" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > >>If you try this sort of inheritance, I'd recommend writing down the >>formal grammar before you start writing classes. Don't try to define >>the grammar through the inheritance hierar

Re: Stylistic question about inheritance

2005-03-31 Thread Andrew Koenig
"Lonnie Princehouse" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If you try this sort of inheritance, I'd recommend writing down the > formal grammar before you start writing classes. Don't try to define > the grammar through the inheritance hierarchy; it's too easy to > accide

Re: Change between Python 2.3 and 2.4 under WinXP

2005-03-31 Thread "Martin v. Löwis"
Franz Steinhäusler wrote: Is there any possibility under WinXP, to alterntate quickly (with batch file or similary) between python23 and python24. No need to change between them. Just install them both, and select which one to use on a per-invocation base. I.e. do c:\python23\python.exe foo.py c:\

Re: Stylistic question about inheritance

2005-03-31 Thread Andrew Koenig
""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > You would normally try to avoid type queries, and rely on virtual > methods instead, if possible. Of course. > It seems likely for the application > that code can be shared across different subclasses, for example

Re: Stylistic question about inheritance

2005-03-31 Thread Andrew Koenig
"Carl Banks" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Well, Python seems to get along fine without the ability to do > isinstance(foo,file_like_object); probably better off in the end for > it. So I'd say you should generally not do it. Inheritence is for > when different c

  1   2   >