Re: Pythons & Ladders

2008-02-28 Thread castironpi
On Feb 28, 1:10 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 27 Feb 2008 19:18:27 -0800, Jeff Schwab wrote: > > Benoit wrote: > >> I've been teaching myself the python language over the past few months > >> using Mark Lutz' Learning Python, 3ed.  Python is also the first > >> p

Re: How about adding rational fraction to Python?

2008-02-28 Thread Paul Rubin
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > For implementing this in Python you have to carry an "is allowed to be > coerced to float" flag with every integer object to decide at run time if > it is an error to add it to a float or not. Yeah, I guess it's not workable in a dynamic langu

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-28 Thread castironpi
On Feb 27, 8:47 pm, Michael Robertson <[EMAIL PROTECTED]> wrote: > Michael Robertson wrote the following on 02/27/2008 06:40 PM: > > > Hi, > > > I need a generator which produces all ways to place n indistinguishable > > items into k distinguishable boxes. > > My first thought was to generate all i

Re: threading/Queue: join() and task_done() not working? (deadlock)

2008-02-28 Thread Gal Aviel
7stud yahoo.com> writes: > What is task_done()? The python docs don't list any such function. I'm using Python 2.5 and it's in the docs ... -- http://mail.python.org/mailman/listinfo/python-list

Re: threading/Queue: join() and task_done() not working? (deadlock)

2008-02-28 Thread Gal Aviel
Dennis Lee Bieber ix.netcom.com> writes: > I didn't even know Queue objects /had/ a join() method... The only > .join() I'm familiar with is the one that waits for a thread to > complete... Well it's probably new in Python 2.5 although I'm not sure. -- http://mail.python.org/mailman/

Re: is there enough information?

2008-02-28 Thread castironpi
On Feb 28, 2:30 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > "It is time to show your cards or fold" Here. Run it. Download Python 3.0a2. from thread import start_new_thread as launch from threading import Lock import time from functools import partial class WithObj: def __init__( se

Re: threading/Queue: join() and task_done() not working? (deadlock)

2008-02-28 Thread Gal Aviel
Raymond Hettinger rcn.com> writes: > Does the problem persist with a queue size of 2? > > Raymond > Unfortunately yes. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about PyPI and 'easy_install'

2008-02-28 Thread Richard Jones
makoto kuwata wrote: > Your patch shows that both project name (Tenjin) and package name > (pyTenjin) should be the same name. > And, I'm afraid that your patch seems to require user to install > setuptools. > I want Tenjin to be install not only with easy_install but also > without setuptools. Yo

Re: Python IRC Zork

2008-02-28 Thread Erik Max Francis
Kris Davidson wrote: > If this has been done before in another language could someone please > tell me, if not I was wondering is its possible and what the easier > way is to create an IRC bot that allows you to play Zork: > > I was thinking of just creating a simple Python IRC bot or finding an

Re: Pythons & Ladders

2008-02-28 Thread Erik Max Francis
Marc 'BlackJack' Rintsch wrote: > On Wed, 27 Feb 2008 19:18:27 -0800, Jeff Schwab wrote: >> Benoit wrote: >>> I've been teaching myself the python language over the past few months >>> using Mark Lutz' Learning Python, 3ed. Python is also the first >>> programming language I've ever taken up. I

Re: How about adding rational fraction to Python?

2008-02-28 Thread Steven D'Aprano
On Thu, 28 Feb 2008 00:30:11 -0800, Dennis Lee Bieber wrote: > On Thu, 28 Feb 2008 01:25:32 -, Steven D'Aprano > <[EMAIL PROTECTED]> declaimed the following in > comp.lang.python: > >> When it comes to mixed arithmetic, it's just too darn inconvenient to >> forbid automatic conversions. Other

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-28 Thread Michael Robertson
[EMAIL PROTECTED] wrote the following on 02/28/2008 12:36 AM: > On Feb 27, 8:47 pm, Michael Robertson <[EMAIL PROTECTED]> wrote: > Your only casualty here is all the zeroes in (4,0,0,..). You don't > want to swap k_2 and k_3 in (4,0,0). (Is that what permutation > means?) Correct. Though by 'pe

Re: Python's BNF

2008-02-28 Thread MartinRinehart
Thanks so much Gabriel. -- http://mail.python.org/mailman/listinfo/python-list

more pythonic

2008-02-28 Thread Temoto
Hello. There is a Django application, i need to place all its data into Access mdb file and send it to user. It seems to me that params filling for statement could be expressed in a more beautiful way. Since i'm very new to Python, i don't feel that, though. Could you tell your opinion on that sn

Re: threading/Queue: join() and task_done() not working? (deadlock)

2008-02-28 Thread 7stud
On Feb 28, 1:47 am, Gal Aviel <[EMAIL PROTECTED]> wrote: > 7stud yahoo.com> writes: > > > What is task_done()?  The python docs don't list any such function. > > I'm using Python 2.5 and it's in the docs ... According to the docs, join() unblocks only after you call task_done() for every item tha

Re: more pythonic

2008-02-28 Thread 7stud
On Feb 28, 4:40 am, Temoto <[EMAIL PROTECTED]> wrote: > Hello. > > There is a Django application, i need to place all its data into > Access mdb file and send it to user. > It seems to me that params filling for statement could be expressed in > a more beautiful way. > Since i'm very new to Python,

Re: more pythonic

2008-02-28 Thread 7stud
On Feb 28, 4:48 am, 7stud <[EMAIL PROTECTED]> wrote: > > It's my understanding that the way you insert arguments into queries > has to be done in a db specific way.   > Rather: It's my understanding that the way you insert arguments into queries *should* be done in a db specific way.   -- http:/

Re: Official IRC channel for Python?

2008-02-28 Thread js
I saw bad guys on IRC a few days ago, but it was not a problem because Ignore user function in IRC client makes his/her messages invisible. BTW,who's the maintainer of the channel? On 27 Feb 2008 11:34:54 -0800, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > "Guilherme Polo" <[EMAIL PROTECT

Re: more pythonic

2008-02-28 Thread Paul McGuire
On Feb 28, 5:40 am, Temoto <[EMAIL PROTECTED]> wrote: > Hello. > > There is a Django application, i need to place all its data into > Access mdb file and send it to user. > It seems to me that params filling for statement could be expressed in > a more beautiful way. > Since i'm very new to Python,

URLlib2?

2008-02-28 Thread rodmc
Hi, Probably a silly question but I am writing a CGI script which need to check the referring URL, can anyone provide any pointers? I have looked at URLLib2 and a couple of other libraries, but am slightly confused. Thanks in advance, rod -- http://mail.python.org/mailman/listinfo/python-list

Re: URLlib2?

2008-02-28 Thread Jarek Zgoda
rodmc napisał(a): > Probably a silly question but I am writing a CGI script which need to > check the referring URL, can anyone provide any pointers? I have > looked at URLLib2 and a couple of other libraries, but am slightly > confused. Using httplib you can issue HEAD request to check if it doe

Re: call by reference howto????

2008-02-28 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Feb 27, 10:38 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: > >> What exactly are you wanting to do? > > I'm having a hard time considering your question in the general case. > I'm thinking of too many cases, the details of which are relevant to > the answer, to even sub

Nested module import clutters package namespace?

2008-02-28 Thread Dr. Rüdiger Kupper
Hi! I'd be grateful for help with a problem of package and module namespaces. The behaviour I observe is unexpected (to me), and I couldn't find the answer in the docs, the tutorial, or the mailing list archive. So here we go: I have a package named 'pack'. Apart from the '__init__.py' file th

Re: Python IRC Zork

2008-02-28 Thread Kris Davidson
> The bigger picture would be writing a full Z machine in Python, which is > something I embarked on for my own amusement a while back but never got > far enough to do anything useful at all, given the size of the task. Might be worth trying that or setting up a project somewhere, do any exist?

Re: URLlib2?

2008-02-28 Thread Steve Holden
Jarek Zgoda wrote: > rodmc napisał(a): > >> Probably a silly question but I am writing a CGI script which need to >> check the referring URL, can anyone provide any pointers? I have >> looked at URLLib2 and a couple of other libraries, but am slightly >> confused. > > Using httplib you can issue

RE: anydbm safe for simultaneous writes?

2008-02-28 Thread Brian Smith
Chris wrote: > I need simple data persistence for a cgi application that > will be used potentially by multiple clients simultaneously. > So I need something that can handle locking among writes. > Sqlite probably does this, but I am using Python 2.4.4, which > does not include sqlite. The d

Re: non-sequitur: Re: Python-URL! - weekly Python news and links (Feb 18)

2008-02-28 Thread Steve Holden
Dennis Lee Bieber wrote: > On Wed, 27 Feb 2008 13:38:59 +0100, Peter Otten <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> My google is better than yours then: >> > Why am I visualizing a face off in a super cheap martial arts movie? > > Python-style kung fu?

Re: URLlib2?

2008-02-28 Thread Jarek Zgoda
Steve Holden napisał(a): >>> Probably a silly question but I am writing a CGI script which need to >>> check the referring URL, can anyone provide any pointers? I have >>> looked at URLLib2 and a couple of other libraries, but am slightly >>> confused. >> >> Using httplib you can issue HEAD reques

message entry box at center

2008-02-28 Thread asit
from Tkinter import * def callback(): print e.get() master=Tk() e=Entry(master) e.pack(anchor=CENTER) e.focus_set() b=Button(master,text="get",width=10,command=callback) b.pack(anchor=CENTER) master.mainloop() i want to show the entry button at the center of the window. How is it possible

Re: Indentation and optional delimiters

2008-02-28 Thread castironpi
On Feb 28, 12:46 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > By the way bearophile... the readability of your posts will increase a > LOT if you break it up into paragraphs, rather than use one or two giant > run-on paragraphs. > > My comments follow. > > On Tue, 26 Feb 2008

Re: How about adding rational fraction to Python?

2008-02-28 Thread Carl Banks
On Feb 28, 3:30 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > Automatic conversions, okay... but converting a result when all > inputs are of one time, NO... People, this is so cognitive dissonance it's not even funny. There is absolutely nothing obvious about 1/2 returning a number

Re: Python's BNF

2008-02-28 Thread MartinRinehart
Implemented all your suggestions, with two exceptions. Changed file read to readlines(), but not open(...).readlines(). I love to say file.close(). Gives me a feeling of security. (We could discuss RAM waste v. I/O speed but this input file is just 10KB, so neither matters.) Removed one of the th

Re: How about adding rational fraction to Python?

2008-02-28 Thread Grant Edwards
On 2008-02-28, Carl Banks <[EMAIL PROTECTED]> wrote: >> Automatic conversions, okay... but converting a result when >> all inputs are of one time, NO... > > People, this is so cognitive dissonance it's not even funny. > > There is absolutely nothing obvious about 1/2 returning a number that > isn'

Re: Indentation and optional delimiters

2008-02-28 Thread bearophileHUGS
Steven D'Aprano: >the readability of your posts will increase a LOT if you break it up into >paragraphs,< You are right, I'll try to do it (when I go in flux state I write quickly, but I tend to produce long paragraphs). >The thing is, make-another-copy and make-another-reference are semantica

Re: URLlib2?

2008-02-28 Thread Bryan Olson
rodmc wrote: > Probably a silly question but I am writing a CGI script which need to > check the referring URL, can anyone provide any pointers? I have > looked at URLLib2 and a couple of other libraries, but am slightly > confused. When you say, "check the referring URL," what are checking about

Re: Pythons & Ladders

2008-02-28 Thread Alan Isaac
Benoit wrote: > Give > me something to do! Help to improve one of the experimental writers for docutils. IIRC, the ODT writer does not yet support figures and tables. http://www.rexx.com/~dkuhlman/odtwriter.html The rst2wordml writer appears to be getting its features in place, but when I las

Re: message entry box at center

2008-02-28 Thread Peter Otten
asit wrote: > i want to show the entry button at the center of the window. How is it > possible ?? > from Tkinter import * > > > def callback(): > print e.get() > > > master=Tk() > e=Entry(master) e.pack(expand=True) > e.focus_set() > > > b=Button(master,text="get",width=10,command=callba

Re: more pythonic

2008-02-28 Thread Temoto
On 28 фев, 15:42, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Feb 28, 5:40 am, Temoto <[EMAIL PROTECTED]> wrote: > > > > > Hello. > > > There is a Django application, i need to place all its data into > > Access mdb file and send it to user. > > It seems to me that params filling for statement cou

Re: How about adding rational fraction to Python?

2008-02-28 Thread Torsten Bronger
Hallöchen! Grant Edwards writes: > [...] > >> You people can't tell the difference between "obvious" and >> "learned conventions that came about because in limitations in >> the hardware at the time". > > It seems to me that the expectation that 1/2 yield 0.5 is just as > much a convention as tha

Re: How about adding rational fraction to Python?

2008-02-28 Thread Carl Banks
On Feb 28, 9:36 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-02-28, Carl Banks <[EMAIL PROTECTED]> wrote: > > >> Automatic conversions, okay... but converting a result when > >> all inputs are of one time, NO... > > > People, this is so cognitive dissonance it's not even funny. > > > Ther

Re: Indentation and optional delimiters

2008-02-28 Thread castironpi
On Feb 28, 8:40 am, [EMAIL PROTECTED] wrote: > But the default behavior may become the "true" copy, that seems > simpler for a newbie to grasp. The language then may give a tool to > use references too (like passing arrays to functions in Pascal, you > can use "var" for pass-by-reference reference)

Re: more pythonic

2008-02-28 Thread Paul McGuire
On Feb 28, 8:58 am, Temoto <[EMAIL PROTECTED]> wrote: > On 28 ÆÅ×, 15:42, Paul McGuire <[EMAIL PROTECTED]> wrote: > > > > > > > On Feb 28, 5:40 am, Temoto <[EMAIL PROTECTED]> wrote: > > > > Hello. > > > > There is a Django application, i need to place all its data into > > > Access mdb file and sen

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-28 Thread Mark Dickinson
On Feb 28, 5:02 am, Michael Robertson <[EMAIL PROTECTED]> wrote: > Thanks again for your efforts here.  This particular problem didn't > appear in any course I took...certainly similar problems did. And here's the obligatory not-very-obfuscated one-liner: from itertools import combinations as c;

feedback requested

2008-02-28 Thread castironpi
I have a data structure I think would be very useful. It passes a few test cases, but one attempt to optimize it failed, so that may indicate a bug. Will anyone help me debug it, verify it, or clean it? It pertains to multi-threading and is a synchro. structure. If it is not an interest of your

Re: How about adding rational fraction to Python?

2008-02-28 Thread D'Arcy J.M. Cain
On Thu, 28 Feb 2008 10:39:51 - "Steven D'Aprano" <[EMAIL PROTECTED]> wrote: > On Thu, 28 Feb 2008 00:30:11 -0800, Dennis Lee Bieber wrote: > > Automatic conversions, okay... but converting a result when all > > inputs are of one time, NO... > > What? How does that make any sense? > > By t

Re: Python's BNF

2008-02-28 Thread Gabriel Genellina
En Thu, 28 Feb 2008 12:33:33 -0200, <[EMAIL PROTECTED]> escribi�: > Implemented all your suggestions, with two exceptions. > > Changed file read to readlines(), but not open(...).readlines(). I > love to say file.close(). Gives me a feeling of security. (We could > discuss RAM waste v. I/O speed b

Re: How about adding rational fraction to Python?

2008-02-28 Thread D'Arcy J.M. Cain
On Thu, 28 Feb 2008 06:10:13 -0800 (PST) Carl Banks <[EMAIL PROTECTED]> wrote: > On Feb 28, 3:30 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > Automatic conversions, okay... but converting a result when all > > inputs are of one time, NO... > > People, this is so cognitive dissonanc

Re: Raising exception on STDIN read

2008-02-28 Thread Ian Clark
On 2008-02-27, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Wed, 27 Feb 2008 15:06:36 -0200, Ian Clark <[EMAIL PROTECTED]> > escribi�: > >> On 2008-02-27, Michael Goerz <[EMAIL PROTECTED]> wrote: >>> Hi, >>> >>> I would like to raise an exception any time a subprocess tries to read >>> fro

TypeError: only length-1 arrays can be converted to Python scalars.

2008-02-28 Thread nure123
Hi All, Could anybody tell me what is the problem with the following sequence with which I always get the above error message. I use Numeric and Python 2.4 x=array([1,2,3,4]) y=exp(x) Nure -- http://mail.python.org/mailman/listinfo/python-list

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-28 Thread Arnaud Delobelle
On Feb 28, 2:40 am, Michael Robertson <[EMAIL PROTECTED]> wrote: > Hi, > > I need a generator which produces all ways to place n indistinguishable > items into k distinguishable boxes. > > For n=4, k=3, there are (4+3-1)!/(3-1)!/4! = 15 ways. > > (0,0,4) [...] Here is my little function:

Re: Raising exception on STDIN read

2008-02-28 Thread Gabriel Genellina
En Thu, 28 Feb 2008 14:29:04 -0200, Ian Clark <[EMAIL PROTECTED]> escribió: > On 2008-02-27, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> En Wed, 27 Feb 2008 15:06:36 -0200, Ian Clark <[EMAIL PROTECTED]> >> escribi�: >> >>> On 2008-02-27, Michael Goerz <[EMAIL PROTECTED]> wrote: Hi, >>

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-28 Thread Arnaud Delobelle
On Feb 28, 4:44 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > ... here is another attempt on the same principle: > > --- > def boxings(n, k): >     """boxings(n, k) -> iterator > >     Generate all ways to place n indistiguishable items into k >     distinguishable boxes >     """

Re: anydbm safe for simultaneous writes?

2008-02-28 Thread chris
On Feb 28, 7:47 am, "Brian Smith" <[EMAIL PROTECTED]> wrote: > Chris wrote: > > I need simple data persistence for a cgi application that > > will be used potentially by multiple clients simultaneously. > > So I need something that can handle locking among writes. > > Sqlite probably does this, but

Re: Raising exception on STDIN read

2008-02-28 Thread Ian Clark
On 2008-02-28, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Thu, 28 Feb 2008 14:29:04 -0200, Ian Clark <[EMAIL PROTECTED]> > escribió: > >> On 2008-02-27, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >>> En Wed, 27 Feb 2008 15:06:36 -0200, Ian Clark <[EMAIL PROTECTED]> >>> escribi�: >>

Re: message entry box at center

2008-02-28 Thread asit
On Feb 28, 7:53 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > asit wrote: > > i want to show the entry button at the center of the window. How is it > > possible ?? > > from Tkinter import * > > > def callback(): > > print e.get() > > > master=Tk() > > e=Entry(master) > > e.pack(expand=True) > > > e

Re: How about adding rational fraction to Python?

2008-02-28 Thread J. Cliff Dyer
On Thu, 2008-02-28 at 11:22 -0500, D'Arcy J.M. Cain wrote: > Not obvious to you. You are using subjective perception as if it was > a > law of nature. If "obvious" was the criteria then I would argue that > the only proper result of integer division is (int, int). Give me the > result and the re

Re: Pythons & Ladders

2008-02-28 Thread Jeff Schwab
Marc 'BlackJack' Rintsch wrote: > On Wed, 27 Feb 2008 19:18:27 -0800, Jeff Schwab wrote: > >> Benoit wrote: >>> I've been teaching myself the python language over the past few months >>> using Mark Lutz' Learning Python, 3ed. Python is also the first >>> programming language I've ever taken up.

Re: message entry box at center

2008-02-28 Thread Peter Otten
asit wrote: > On Feb 28, 7:53 pm, Peter Otten <[EMAIL PROTECTED]> wrote: >> asit wrote: >> > i want to show the entry button at the center of the window. How is it >> > possible ?? >> > from Tkinter import * >> >> > def callback(): >> > print e.get() >> >> > master=Tk() >> > e=Entry(master) >> >>

Decorators and buffer flushing

2008-02-28 Thread Ethan Metsger
Hi, all. I apologize for what is perhaps a newb question. I'm in the process of transitioning our testing framework from Perl to Python. While that alone probably sets off some red flags, I'm afraid it's what I'm stuck with. I'm modeling a test with five operations: build, execute, validate, p

Re: first time use of swig, python and c++ .. it's a mess ... please advice

2008-02-28 Thread Eric von Horst
On Feb 27, 9:44 pm, "Bronner, Gregory" <[EMAIL PROTECTED]> wrote: > The operator= stuff is usually innocuous. > The compiler died because it couldn't find 'vector', which is reasonable, > since it thought it was compiling a C file. > > Probably because you swigged the file without the magic "-c++"

Re: Decorators and buffer flushing

2008-02-28 Thread castironpi
On Feb 28, 11:49 am, "Ethan Metsger" <[EMAIL PROTECTED]> wrote: > Hi, all. > > I apologize for what is perhaps a newb question.  I'm in the process of   > transitioning our testing framework from Perl to Python.  While that alone   > probably sets off some red flags, I'm afraid it's what I'm stuck

Re: How about adding rational fraction to Python?

2008-02-28 Thread Ross Ridge
D'Arcy J.M. Cain wrote: > Not obvious to you. You are using subjective perception as if it was > a law of nature. If "obvious" was the criteria then I would argue that > the only proper result of integer division is (int, int). Give me the > result and the remainder and let me figure it out. J

Re: TypeError: only length-1 arrays can be converted to Python scalars.

2008-02-28 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Hi All, > > Could anybody tell me what is the problem with the following sequence > with which I always get the above error message. I use Numeric and > Python 2.4 > > x=array([1,2,3,4]) > y=exp(x) Presumably, you are using exp() from the builtin module math, which kno

Re: call by reference howto????

2008-02-28 Thread castironpi
On Feb 27, 6:02 pm, Tamer Higazi <[EMAIL PROTECTED]> wrote: > Hi! > Can somebody of you make me a sample how to define a function based on > "call by reference" ??? > > I am a python newbie and I am not getting smart how to define functions, > that should modify the variable I passed by reference.

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-28 Thread castironpi
On Feb 28, 10:07 am, Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Feb 28, 5:02 am, Michael Robertson <[EMAIL PROTECTED]> wrote: > > > Thanks again for your efforts here.  This particular problem didn't > > appear in any course I took...certainly similar problems did. > > And here's the obligatory

Re: How about adding rational fraction to Python?

2008-02-28 Thread D'Arcy J.M. Cain
On Thu, 28 Feb 2008 13:32:06 -0500 "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote: > On Thu, 2008-02-28 at 11:22 -0500, D'Arcy J.M. Cain wrote: > > Not obvious to you. You are using subjective perception as if it was > > a > > law of nature. If "obvious" was the criteria then I would argue that > > th

Re: Python's BNF

2008-02-28 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Implemented all your suggestions, with two exceptions. > > Changed file read to readlines(), but not open(...).readlines(). I > love to say file.close(). Gives me a feeling of security. (We could > discuss RAM waste v. I/O speed but this input file is just 10KB, so > nei

Re: Pythons & Ladders

2008-02-28 Thread castironpi
On Feb 28, 12:34 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Marc 'BlackJack' Rintsch wrote: > > Hey a flame bait.  I'll bite. [ redirected to OP ] >>> OP.flamebait= 1.0. >>> bait.bite() Traceback (most recent call last): File "", line 1, in AttributeError: 'FlameBait' object has no attribute

Re: Pythons & Ladders

2008-02-28 Thread Benoit
Forgive my language concerning C++ as its turned the thread into something I did not intend. I merely wished to point out that Python was easier for me to learn than C++. To Schwab, its likely that Mark Lutz is simply a better instructor than my professor. -- http://mail.python.org/mailman/listin

Re: TypeError: only length-1 arrays can be converted to Python scalars.

2008-02-28 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hi All, > > Could anybody tell me what is the problem with the following sequence > with which I always get the above error message. I use Numeric and > Python 2.4 > > x=array([1,2,3,4]) > y=exp(x) The meaning of the error message is fairly obvious - exp() can't operat

Re: How about adding rational fraction to Python?

2008-02-28 Thread Paul Rubin
"D'Arcy J.M. Cain" <[EMAIL PROTECTED]> writes: > > I'd like to point out that now you are talking about int OP int > > returning a tuple, not an int. > > Which would be stupid. Good thing I don't think that "obvious" should > be the criteria. We already have that function (divmod) and it is very

rstrip error python2.4.3 not in 2.5.1?

2008-02-28 Thread dirkheld
Hi, I wrote some python code that retrieves urls from a txt file. In this code I use .rstrip() for removing the '\n' at the end of every url. While this code works on my mac (leopard) with python 2.5.1, this same code fails to work on an ubuntu server with python 2.4.3 I was wondering if there is

Re: XML expat error

2008-02-28 Thread dirkheld
On 28 feb, 08:18, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 27 Feb 2008 14:02:25 -0800, dirkheld wrote: > > Something strange here. The xml file causing the problem has only 361 > > lines. Isn't there a way to catch this error, ignore it and continu > > with the rest of the othe

Re: XML expat error

2008-02-28 Thread Stefan Behnel
dirkheld wrote: > On 28 feb, 08:18, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> On Wed, 27 Feb 2008 14:02:25 -0800, dirkheld wrote: >>> Something strange here. The xml file causing the problem has only 361 >>> lines. Isn't there a way to catch this error, ignore it and continu >>> with t

Re: How about adding rational fraction to Python?

2008-02-28 Thread D'Arcy J.M. Cain
On 28 Feb 2008 12:25:14 -0800 Paul Rubin <"http://phr.cx"@NOSPAM.invalid> wrote: > "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> writes: > > > I'd like to point out that now you are talking about int OP int > > > returning a tuple, not an int. > > > > Which would be stupid. Good thing I don't think that

Re: Pythons & Ladders

2008-02-28 Thread Marc 'BlackJack' Rintsch
On Thu, 28 Feb 2008 10:34:45 -0800, Jeff Schwab wrote: >> Hey a flame bait. I'll bite. > > Excuse me? Somebody posts about an introductory course on C++ covering > "dynamic arrays using pointers" and literally says "kill me now," and > I'm the flamer for asking him not to hold the language re

Re: Decorators and buffer flushing

2008-02-28 Thread Ethan Metsger
On Thu, 28 Feb 2008 14:48:55 -0500, <[EMAIL PROTECTED]> wrote: > Can you reproduce the bug on the console? Or, try starting with a new > line in the output. Or, try a input(). I can reproduce the issue in the console. I'm not convinced it's actually a bug, unless for some reason the interpre

Re: XML expat error

2008-02-28 Thread Marc 'BlackJack' Rintsch
On Thu, 28 Feb 2008 12:37:10 -0800, dirkheld wrote: >> Yes of course: handle the exception instead of letting it propagate to the >> top level and ending the program. > > Ehm, maybe a stupid question... how. I'm rather new to python and I > never user error handling. Then you should work through

Re: Pythons & Ladders

2008-02-28 Thread Paul Boddie
On 28 Feb, 21:08, Benoit <[EMAIL PROTECTED]> wrote: > Forgive my language concerning C++ as its turned the thread into > something I did not intend. I merely wished to point out that Python > was easier for me to learn than C++. To Schwab, its likely that Mark > Lutz is simply a better instructor

Re: Indentation and optional delimiters

2008-02-28 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | But the default behavior may become the "true" copy, that seems | simpler for a newbie to grasp. To me, it is the opposite. If I say gvr = Guido_van_Russum # or any natural language equivalent do you really think a copy is made? Cop

Re: rstrip error python2.4.3 not in 2.5.1?

2008-02-28 Thread Terry Reedy
"dirkheld" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hi, | | I wrote some python code that retrieves urls from a txt file. In this | code I use .rstrip() for removing the '\n' at the end of every url. | While this code works on my mac (leopard) with python 2.5.1, this same | c

Re: rstrip error python2.4.3 not in 2.5.1?

2008-02-28 Thread subeen
rstrip() works fine in python 2.4.3. May be the problem lies in somewhere else. I tried it in FC6 with Python 2.4.3: >>> url = "abc.com\n" >>> url.rstrip() 'abc.com' regards, Subeen. http://love-python.blogspot.com/ On Feb 29, 2:30 am, dirkheld <[EMAIL PROTECTED]> wrote: > Hi, > > I wrote some

Permission to use Mac OS 'rocketship' dock icon?

2008-02-28 Thread Anand Patil
Hi all, The image of a rocket with the Python logo that occasionally shows up in the dock would make part of a nice logo for PyMC, an open-source Python Bayesian statistics package. Anyone know who we would have to ask to get permission to use it? Thanks, Anand -- http://mail.python.org/mailman/

You have to see this - http://ilaarijs.blogspot.com/ :D

2008-02-28 Thread [EMAIL PROTECTED]
You have to see this - http://ilaarijs.blogspot.com/ :D -- http://mail.python.org/mailman/listinfo/python-list

Re: How about adding rational fraction to Python?

2008-02-28 Thread Steven D'Aprano
On Thu, 28 Feb 2008 11:13:27 -0500, D'Arcy J.M. Cain wrote: >> >Automatic conversions, okay... but converting a result when all >> > inputs are of one time, NO... >> >> What? How does that make any sense? >> >> By that logic, we should see this: >> >> >>> len("a string") >> '8' >> >>> len([

Re: How about adding rational fraction to Python?

2008-02-28 Thread Steven D'Aprano
On Thu, 28 Feb 2008 11:22:43 -0500, D'Arcy J.M. Cain wrote: > Calculating machines that handled > floating point are older than Python by far. Yes, and they almost universally give the result 1/2 -> 0.5. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: How about adding rational fraction to Python?

2008-02-28 Thread Steven D'Aprano
On Thu, 28 Feb 2008 14:41:56 -0500, Ross Ridge wrote: > You're just going to have to accept that there that there is no > concensus on this issue and there never was. But that's not true. The consensus, across the majority of people (both programmers and non-programmers alike) is that 1/2 should

Running test01.py under Windows (basic level)

2008-02-28 Thread K Viltersten
I have v2.5.2 installed and i've composed a source code i'm sure everybody will be impressed by. It goes like this. def bloppA (): print "a very advanced piece of code" What i get to work is to make it run from the the snakes shell. Then, i realised that such a masterpiece needs storing in

Odd handling of type.__init__ bases

2008-02-28 Thread quick
I encountered an oddity in attempting to use a metaclass to perform mix-in inheritance for classes. I've attached a small demonstration file. Have I misunderstood the bases argument for type.__init__ or should this be submitted as a bug? Python 2.5 (r25:51908, Feb 22 2007, 19:05:27) [GCC 4.1

convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-28 Thread davidj411
i am parsing a cell phone bill to get a list of all numbers and the total talktime spend on each number. i already have a unique list of the phone numbers. now i must go through the list of numbers and add up the totals for each number. on the bill, each line has a few fields,one field containing

Windows gzip problem

2008-02-28 Thread John Earls
Hello, I am having a problem with gzip. The code worked fine under linux but when I moved it over to windows it is getting stuck unzipping a gz file. -- snippet -- fileObj = gzip.GzipFile(iceGetter.file.localFileName, 'rb') uncompressedFileName = iceGetter.file.localFileName[:-3

Python app at startup!

2008-02-28 Thread SMALLp
Hy. I create simple application. Yust an windows and "compile" it with py2exe. I add registry value reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v MyApp /t REG_SZ /d C:\myapp.exe /f' And it wont start. When i use console instead od window in py2exe i get console op

Re: How about adding rational fraction to Python?

2008-02-28 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > any restriction that functions must return the same > type as all its arguments is just crazy. I don't think anyone is saying that they should necessarily do that in general. Just in some specific cases. -- http://mail.python.org/mailman/listinfo/py

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-28 Thread D'Arcy J.M. Cain
On Thu, 28 Feb 2008 14:56:10 -0800 (PST) davidj411 <[EMAIL PROTECTED]> wrote: > ValueError: invalid literal for int() with base 10: '"2"' > > > here is the question: > > How can i convert a string number like "2" to a true number that can > be added. You have to get rid of the double quotes fir

Re: How about adding rational fraction to Python?

2008-02-28 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > > Calculating machines that handled > > floating point are older than Python by far. > > Yes, and they almost universally give the result 1/2 -> 0.5. Can you name an example of a calculating machine that both: 1) represents the integer 1 and the rea

How to configure Python in Windows

2008-02-28 Thread cosmo_general
Hi Folks, I just downloaded precompiled Python for Windows, and it runs. Now I have got the command line coding. However, I can't run my python scripts. My python script, foo.py, is located in C:\\\pydir, and I have set the python interpreter on the directory. When I run os.listdir(), I found

Re: Raising exception on STDIN read

2008-02-28 Thread Gabriel Genellina
En Thu, 28 Feb 2008 15:22:21 -0200, Ian Clark <[EMAIL PROTECTED]> escribió: > On 2008-02-28, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> En Thu, 28 Feb 2008 14:29:04 -0200, Ian Clark <[EMAIL PROTECTED]> >> escribió: >> >>> On 2008-02-27, Gabriel Genellina <[EMAIL PROTECTED]> wrote: En

Re: Odd handling of type.__init__ bases

2008-02-28 Thread Arnaud Delobelle
On Feb 28, 10:50 pm, [EMAIL PROTECTED] wrote: > I encountered an oddity in attempting to use a metaclass to perform mix-in > inheritance for classes.  I've attached a small demonstration file.  Have I > misunderstood the bases argument for type.__init__ or should this be submitted > as a bug? Afte

Run wxPython app remotely under XWindows

2008-02-28 Thread Sean DiZazzo
Is there something special you have to do to get a wxPython app to run remotely under xwindows? My Tkinter apps always automatically work that way, so I was surprised to even be confronted with this problem. ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-28 Thread Larry Bates
davidj411 wrote: > i am parsing a cell phone bill to get a list of all numbers and the > total talktime spend on each number. > > i already have a unique list of the phone numbers. > now i must go through the list of numbers and add up the totals for > each number. > on the bill, each line has a f

  1   2   >