Re: Python less error-prone than Java

2006-06-04 Thread Kaz Kylheku
Christoph Zwerschke wrote: > You will often hear that for reasons of fault minimization, you should > use a programming language with strict typing: > http://turing.une.edu.au/~comp284/Lectures/Lecture_18/lecture/node1.html Quoting from that web page: "A programming language with strict typing an

Re: Python less error-prone than Java

2006-06-04 Thread Peter Otten
Kaz Kylheku wrote: > Would that be a case-insensitive lexicographic comparison, or > case-insensitive? How do you specify what kind of less-than and equal > you want to do? class Key(object): def __init__(self, value, key): self.keyval = key(value) self.key = key def __lt_

Re: Python less error-prone than Java

2006-06-04 Thread Kaz Kylheku
Ilpo Nyyssönen wrote: > This is one big thing that makes code > less error-prone: using existing well made libraries. > You can find binary search from python standard library too (but actually the > API > in Java is a bit better, see the return values). > Well, you can say that the binary search

Re: Hostmask matching

2006-06-04 Thread John Machin
On 4/06/2006 4:45 PM, Nexu wrote: > On Sun, 2006-06-04 at 06:26 +, Marc Schoechlin wrote: >> Hi ! >> >> Nexu <[EMAIL PROTECTED]> schrieb: >>> I'm trying to write a def to match a string that is an irc hostmask. eg: >>> [EMAIL PROTECTED] >>> But using re.search(). I get an error when the string

Re: Python less error-prone than Java

2006-06-04 Thread Christoph Zwerschke
>> Simon Percivall wrote: >>> First: It's perfectly simple in Java to create a binary sort that >>> sorts all arrays that contain objects; so wrong there. >> My point was that the *same* Java source example, directly converted to >> Python would *automatically* accept all kinds of arrays. > > And

Re: Python less error-prone than Java

2006-06-04 Thread Fredrik Lundh
Kaz Kylheku wrote: > The trouble with your point is that Christoph's original posting refers > to an article, which, in turn, at the bottom, refers to a bug database > which shows that the very same defect had been found in Sun's Java > library! and as he points out at the top, it was the article

Re: Python less error-prone than Java

2006-06-04 Thread Christoph Zwerschke
Kaz Kylheku wrote: > You can have statically typed languages with inadequate type safety, > and you can have dynamically typed languages with inadequate type > safety. But the point in this example was that the Java program ironically had the bug *because* Java handles ints in a type-safe way,

Re: Python + WinCE + serial port

2006-06-04 Thread pcm
Fuzzyman wrote: > > pcm wrote: >> Hi, >> >> Has anyone ever worked on a Python-WinCE-based program that involved >> serial port management ? >> > > Because of the size of the runtime and the fragility of the GUI > toolkits, there has been little serious development with PythonCE. > (Little not n

Re: Pyrex list/array

2006-06-04 Thread Jim Lewis
Thanks for your comments. > You probably didn't expect the Inquisition... Correct ;-) > 1. What is your speed requirement and how far short of that are you at the > moment? ~10 times faster. > 2. Are you sure there is no Python or third-party module that does what you > want? Yes. > 3. Is

Re: Pyrex list/array

2006-06-04 Thread skip
>> 5. Does your architecture support psyco? If so, have you tried that >>and what were the results? Jim> Already using psyco. Is it substantially faster with psyco than without? If psyco is performing its magic on the critical section of code already, you are going to lose that

Re: Pyrex list/array

2006-06-04 Thread Jim Lewis
> Is it substantially faster with psyco than without? If psyco is performing > its magic on the critical section of code already, you are going to lose > that when switching to Pyrex. Yes but from what I read Pyrex can be a lot faster than psyco under the right circumstances. -- http://mail.pyt

Re: Pyrex list/array

2006-06-04 Thread skip
>> Is it substantially faster with psyco than without? If psyco is >> performing its magic on the critical section of code already, you are >> going to lose that when switching to Pyrex. Jim> Yes but from what I read Pyrex can be a lot faster than psyco under Jim> the right c

Re: if not CGI:

2006-06-04 Thread Max
Bruno Desthuilliers wrote: > Max a écrit : (snip) > > RoR is not bad, but really over-hyped. There's no shortage of at least > as good solutions in Python. You may want to look at Django, Turbogears, > Pylons, web.py etc. for fullstack MVC frameworks. That's what I thought! (snip) > > So the

in python , could I accomplish the purpose that "a=Console.read()" used in C?

2006-06-04 Thread python
in python , could I accomplish the purpose that "a=Console.read()" used in C? when program is running, I wanna add a statement like "a=Console.read()" in C language,it will wait for user's input, after user's typing a character , and click "enter" key, the program will go on running. -- http://ma

HOST - dreamhost.com / Liberality (Hosting, Basic Requirement)

2006-06-04 Thread Ilias Lazaridis
crossposted to 5 groups, which are affected by this case. followup not applicable. - I am currently selecting a Hosting Provider / Project Host... http://case.lazaridis.com/multi/wiki/Host For this larger scale project... http://case.lazaridis.com/multi - An incident within usenet has remin

Re: ANN: PQRC - Python Quick Reference Card - v 0.55

2006-06-04 Thread Kent Johnson
Laurent Pointal wrote: > And I'll maintain a fixed URL at > > http://laurent.pointal.org/python/pqrc/ Broken at the moment. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyrex list/array

2006-06-04 Thread John Machin
On 4/06/2006 7:59 PM, Jim Lewis wrote: > Thanks for your comments. > >> You probably didn't expect the Inquisition... > > Correct ;-) Nobody does :-) > >> The question might be better asked on the Pyrex mailing list. > > I did not find it - where is it? Evidently somewhere near the Hall of t

Re: logging

2006-06-04 Thread Vinay Sajip
Hello Baurzhan, > Consider the following scenario: root is CRITICAL, l01 is DEBUG, a debug > message is logged on l01. l01 decides that the message should be > printed, and _both_ root and l01 print it. Now, it is good that the > message is propagated to root, but why doesn't root decide for itsel

Re: Python less error-prone than Java

2006-06-04 Thread nikie
Let's look at two different examples: Consider the following C# code: static decimal test() { decimal x = 10001; x /= 100; x -= 100; return x; } It returns "0.01", as you would expect it. Now, consider the python equivalent: def test(): x = 10001 x /= 100 x -= 100 ret

Pyrex newbie question

2006-06-04 Thread Philip Smith
Just starting to use pyrex on windows. Using pyrex version 0.9.3.1.win32 Using Activestate Python 2.4.3.12 Using Mingw compiler When I try to run the pyrex demo it fails with a message: "undefined reference to '_imp__Py_NoneStruct' " Anyone know why? -- http://mail.python.org/mailman/list

Re: ANN: PQRC - Python Quick Reference Card - v 0.55

2006-06-04 Thread gene tani
Laurent Pointal wrote: > [for those who dont read clp.announce] > > The Python Quick Reference Card (PQRC) aims to provide a printable quick > reference documentation for the Python language and some of its main > standard libraries (currently for Python 2.4). > > PQRC tries to group informations

Re: Pyrex list/array

2006-06-04 Thread Jim Lewis
> cunningly concealed in the last place one would think of finding it: under > the heading "Mailing List" on the Pyrex home page :-) Hmmm - maybe I should try the scroll bar occassionally ;-) > Do you mean alist[x:x+n] == alist[y:y+n] ? OK, probably you an Skip are right - let's see if I missed

Re: PUDGE - Project Status, Alternative Solutions

2006-06-04 Thread Ilias Lazaridis
Ilias Lazaridis wrote: > What is going on with the pudge project? Any chance to get an comment on this? > Mr. Patrik O'Brien (Orbtech LLC) had told me that there is no similar > tool available within the python domain, thus I have invested some > effort to create a Website template, and to enab

Re: Python less error-prone than Java

2006-06-04 Thread D H
Christoph Zwerschke wrote: > > See the following web page if you dont find it ;-) > http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html > The point of that is that it did fail. It threw an ArrayIndexOutOfBoundsException exception. But it was just luck that h

Re: HOST - dreamhost.com / Liberality (Hosting, Basic Requirement)

2006-06-04 Thread Joachim Durchholz
Ilias Lazaridis schrieb: > crossposted to 5 groups, which are affected by this case. > > followup not applicable. Actually, in this case, yes. > It _seems_ that Mr. Xah Les's account was terminated by dreamhost.com > because of > > a) the inability of several people to detect the interconnectio

Re: linking errors with debug build of Python2.4.3

2006-06-04 Thread Martin Wiechert
You were right, leaving out --with-pydebug did the trick. Thanks, Martin On Sunday 28 May 2006 03:53, [EMAIL PROTECTED] wrote: > Martin Wiechert wrote: > > Hi list, > > > > I've created a fresh build of Python 2.4.3 using the following > > configuration > > > > $ ./configure --with-pydebug --pre

Re: create a text file

2006-06-04 Thread Stan Cook
Fredrik Lundh wrote: > Stan Cook wrote: > >> I'm writing a script to list all of my music files' id3 tags to a >> comma delimited file. The only part I'm missing seems like it should >> be the simplest. I haven't used Python for the last couple of years. >> My question is this: >> >> When I

Re: in python , could I accomplish the purpose that "a=Console.read()" used in C?

2006-06-04 Thread Dennis Benzinger
python wrote: > in python , could I accomplish the purpose that "a=Console.read()" used > in C? > when program is running, I wanna add a statement like > "a=Console.read()" in C language,it will wait for user's input, after > user's typing a character , and click "enter" key, the program will go >

Re: carshing the interpreter in two lines

2006-06-04 Thread Mel Wilson
sam wrote: > Mel: > Wow that book brings back memories. I scanned my copy to review the > subject covered, and came to the conclusion that mind reading > algorithms are the answer. > I gathered from somewhere (but not the index to Andrew Hodges' biography) that Turing was toying with an idea for

Re: how to print newline in xml?

2006-06-04 Thread uche . ogbuji
[EMAIL PROTECTED] wrote: > I use Python/XML packages are xml.dom.minidom and xml.dom.ext (second > just for PrettyPrint) You don't need xml.dom.ext for prettyprint. You can use doc.toprettyxml() I gather you want to tweak the prettyprinter to not add the newline before the comment. The only way

Re: Proposed new PEP: print to expand generators

2006-06-04 Thread Mel Wilson
Terry Reedy wrote: > "James J. Besemer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> I propose that we extend the semantics of "print" such that if the object >> to >> be printed is a generator then print would iterate over the resulting >> sequence of sub-objects and recursiv

mutable member, bug or ...

2006-06-04 Thread Sambo
By accident I assigned int to a class member 'count' which was initialized to (empty) string and had no error till I tried to use it as string, obviously. Why was there no error on assignment( near the end ). class Cgroup_info: group_name = "" count = "0" #last time checked and proces

Installation Problem

2006-06-04 Thread Marshall Dudley
I am trying to install python, but am having problems. I did what the README file said, and it created an executible code in the current directory as it said it would when I typed "make". It seemed to say to copy the executable over to the /usr/local directory, which I did. If I type ./python in

Re: ideas for programs?

2006-06-04 Thread Florian Diesch
Brandon McGinty <[EMAIL PROTECTED]> wrote: > I've been learning python for the past couple of months and writing > misc scripts here and there, along with some web apps. > I'm wondering if anyone has ideas of programs I might try my hand at making? Something I wanted a few days ago: I have a gra

Re: Installation Problem

2006-06-04 Thread Fredrik Lundh
Marshall Dudley wrote: > I am trying to install python, but am having problems. I did what the > README file said, and it created an executible code in the current > directory as it said it would when I typed "make". "make" doesn't install the interpreter by itself; you're supposed to use "make

Re: mutable member, bug or ...

2006-06-04 Thread Fredrik Lundh
Sambo wrote: > By accident I assigned int to a class member 'count' which was > initialized to (empty) string and had no error till I tried to > use it as string, obviously. Why was there no error on assignment > (near the end ). Python uses dynamic typing, which means that objects have types,

Re: deleting texts between patterns

2006-06-04 Thread Baoqiu Cui
John Machin <[EMAIL PROTECTED]> writes: > Uh-oh. > > Try this: > pat = re.compile('(?<=abc\n).*?(?=xyz\n)', re.DOTALL) re.sub(pat, '', linestr) > 'blahfubarabc\nxyz\nxyzzy' This regexp still has a problem. It may remove the lines between two lines like 'aaabc' and 'xxxyz' (and also rem

Re: carshing the interpreter in two lines

2006-06-04 Thread Aahz
In article <[EMAIL PROTECTED]>, gangesmaster <[EMAIL PROTECTED]> wrote: > >the following (random) code crashes my interpreter >(python 2.4.3/winxp): > >from types import CodeType as code >exec code(0, 5, 8, 0, "hello moshe", (), (), (), "", "", 0, "") > >i would expect the interpreter to do some ve

Re: Installation Problem

2006-06-04 Thread Marshall Dudley
Sorry, this is a FreeBSD system 4.8-RELEASE I found another set of documents that say to use the following to install:: python setup.py install but after running it, I still have the same problem. Marshall Marshall Dudley wrote: > I am trying to install python, but am having problems. I did

Re: Installation Problem

2006-06-04 Thread Marshall Dudley
Fredrik Lundh wrote: > Marshall Dudley wrote: > > I am trying to install python, but am having problems. I did what the > > README file said, and it created an executible code in the current > > directory as it said it would when I typed "make". > > "make" doesn't install the interpreter by itsel

Re: grouping a flat list of number by range

2006-06-04 Thread joh12005
Hello > ... _, first_n = group[0] what is the meaning of the underscore "_" ? is it a special var ? or should it be readed as a way of unpacking a tuple in a non useful var ? like lost, first_n = group[0] best regards. -- http://mail.python.org/mailman/listinfo/python-list

Re: Installation Problem

2006-06-04 Thread Warren Block
Marshall Dudley <[EMAIL PROTECTED]> wrote: > Sorry, this is a FreeBSD system 4.8-RELEASE > > I found another set of documents that say to use the following to > install:: > > python setup.py install > > but after running it, I still have the same problem. [top-posting trimmed, please don't do that

Re: grouping a flat list of number by range

2006-06-04 Thread K.S.Sreeram
Yup! '_' is just used as a dummy. Its a pretty common idiom. There's nothing special about that variable. [EMAIL PROTECTED] wrote: > Hello > >> ... _, first_n = group[0] > > what is the meaning of the underscore "_" ? is it a special var ? or > should it be readed as a way of unpacking a

Re: grouping a flat list of number by range

2006-06-04 Thread Steven Bethard
[EMAIL PROTECTED] wrote: >> ... _, first_n = group[0] > > what is the meaning of the underscore "_" ? is it a special var ? or > should it be readed as a way of unpacking a tuple in a non useful var ? > like > > lost, first_n = group[0] Yep, it's just another name. "lost" would have wo

Python netstring module

2006-06-04 Thread Will McGugan
Hi folks, I have just posted a python 'netstring' module on my blog. Comments welcome! http://www.willmcgugan.com/2006/06/04/python-netstring-module/ Regards, Will McGugan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python less error-prone than Java

2006-06-04 Thread Christoph Zwerschke
nikie wrote: > Let's look at two different examples: Consider the following C# code: > > static decimal test() { >decimal x = 10001; >x /= 100; >x -= 100; >return x; > > It returns "0.01", as you would expect it. Yes, I would expect that because I have defined x as decimal

Re: ANN: PQRC - Python Quick Reference Card - v 0.55

2006-06-04 Thread Laurent Pointal
Kent Johnson wrote: > Laurent Pointal wrote: >> And I'll maintain a fixed URL at >> >> http://laurent.pointal.org/python/pqrc/ > > Broken at the moment. Its back. Its at my home ADSL, normally online, but my provider reset the connexion each 24h and its home maintained... the page contains onl

re beginner

2006-06-04 Thread SuperHik
hi all, I'm trying to understand regex for the first time, and it would be very helpful to get an example. I have an old(er) script with the following task - takes a string I copy-pasted and wich always has the same format: >>> print stuff Yellow hat 2 Blue shirt 1 White socks

how not to run out of memory in cursor.execute

2006-06-04 Thread [EMAIL PROTECTED]
I am using cx_Oracle and MySQLdb to pull a lot of data from some tables and I find that the cursor.execute method uses a lot of memory that never gets garbage collected. Using fetchmany instead of fetchall does not seem to make any difference, since it's the execute that uses memory. Breaking the q

Re: Proposed new PEP: print to expand generators

2006-06-04 Thread Terry Reedy
"Mel Wilson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I guess the motivation is the case of people who would set > up an iterator specifically to print from it. for i in gen: print i, print is rather trivial and gives one the option to control formatting however. tjr --

Re: Python less error-prone than Java

2006-06-04 Thread nikie
Christoph Zwerschke wrote: > nikie wrote: > > Let's look at two different examples: Consider the following C# code: > > > > static decimal test() { > >decimal x = 10001; > >x /= 100; > >x -= 100; > >return x; > > > > It returns "0.01", as you would expect it. > > Yes, I wo

Re: re beginner

2006-06-04 Thread bearophileHUGS
SuperHik wrote: > I was wondering is there a better way to do it using re module? > perheps even avoiding this for loop? This is a way to do the same thing without REs: data = 'Yellow hat\t2\tBlue shirt\t1\nWhite socks\t4\tGreen pants\t1\nBlue bag\t4\tNice perfume\t3\nWrist watch\t7\tMobile phone

Re: re beginner

2006-06-04 Thread faulkner
you could write a function which takes a match object and modifies d, pass the function to re.sub, and ignore what re.sub returns. # untested code d = {} def record(match): s = match.string[match.start() : match.end()] i = s.index('\t') print s, i# debugging d[s[:i]] = int(s[i+

Re: re beginner

2006-06-04 Thread bearophileHUGS
> strings = islice(data2, 0, len(data), 2) > numbers = islice(data2, 1, len(data), 2) This probably has to be: strings = islice(data2, 0, len(data2), 2) numbers = islice(data2, 1, len(data2), 2) Sorry, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Python less error-prone than Java

2006-06-04 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: >>> Simon Percivall wrote: First: It's perfectly simple in Java to create a binary sort that sorts all arrays that contain objects; so wrong there. >>> My point was that the *same* Java source example, directl

Re: Python less error-prone than Java

2006-06-04 Thread Christoph Zwerschke
nikie wrote: > Hm, then I probably didn't get your original point: I thought your > argument was that a dynamically typed language was "safer" because it > would choose the "right" type (in your example, an arbitrary-pecision > integer) automatically. No, my point was not to make a general sta

Re: re beginner

2006-06-04 Thread Bruno Desthuilliers
SuperHik a écrit : > hi all, > > I'm trying to understand regex for the first time, and it would be very > helpful to get an example. I have an old(er) script with the following > task - takes a string I copy-pasted and wich always has the same format: > > >>> print stuff > Yellow hat2

Re: re beginner

2006-06-04 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : >>strings = islice(data2, 0, len(data), 2) >>numbers = islice(data2, 1, len(data), 2) > > > This probably has to be: > > strings = islice(data2, 0, len(data2), 2) > numbers = islice(data2, 1, len(data2), 2) try with islice(data2, 0, None, 2) -- http://mail.python.or

Max function question: How do I return the index of the maximum value of a list?

2006-06-04 Thread jj_frap
I'm new to programming in Python and am currently writing a three-card poker simulator. I have completed the entire simulator other than determining who has the best hand (which will be far more difficult than the aspects I've codes thus far)...I store each player's hand in a list of hand objects a

Re: ideas for programs?

2006-06-04 Thread Daniel Nogradi
> I've been learning python for the past couple of months and writing > misc scripts here and there, along with some web apps. > I'm wondering if anyone has ideas of programs I might try my hand at > making? You could put together a handy CSS generator library that could be used from a python weba

Where is the ucs-32 codec?

2006-06-04 Thread beni . cherniavsky
Python seems to be missing a UCS-32 codec, even in wide builds (not that it the build should matter). Is there some deep reason or should I just contribute a patch? If it's just a bug, should I call the codec 'ucs-32' or 'utf-32'? Or both (aliased)? There should be '-le' and '-be' variats, I sup

Re: Max function question: How do I return the index of the maximum value of a list?

2006-06-04 Thread Sybren Stuvel
jj_frap enlightened us with: > When I try to print the "winner" (I've not coded for kicker strength > and ties yet) via the max function, it returns the maximum value in > the list rather than the index associated with that value. > > How do I return the index? You can't even be sure it exists - t

Re: Max function question: How do I return the index of the maximum value of a list?

2006-06-04 Thread gene tani
jj_frap wrote: > I'm new to programming in Python and am currently writing a three-card > poker simulator. I have completed the entire simulator other than > determining who has the best hand (which will be far more difficult > than the aspects I've codes thus far)...I store each player's hand in

RE: C# equivalent to range()

2006-06-04 Thread Delaney, Timothy (Tim)
Luis M. González wrote: > There are thousands of threads to choose from in this forum. > If they didn't like this question, they could have picked any other > one to discuss. > There's no need to be disagreeable :-) Well, there are reasons to reply to a message stating that it's not on-topic for

RE: Which exceptions are recommended to me handled?

2006-06-04 Thread Delaney, Timothy (Tim)
Florencio Cano wrote: > Hello, > Is it recommended as a good programming practice to catch all > exceptions and raise our own exceptions or let Python itself raise > these kinds of exceptions? > For example imagine a function that needs an integer and '34' is > passed, this is ok because inside

Re: Max function question: How do I return the index of the maximum value of a list?

2006-06-04 Thread Erik Max Francis
gene tani wrote: > http://www.rubyquiz.com/quiz24.html His question was for three-card poker, not normal poker. The ranking of hands in three-card poker isn't the same as in normal best five-card poker rankings; for instance, in three-card poker, a straight beats a flush. -- Erik Max Francis

[ANN] ConfigObj 4.3.2 Released

2006-06-04 Thread Fuzzyman
`ConfigObj 4.3.2 `_ has just been released. You can download it from `configobj-4.3.2.zip `_. This is a bugfix and minor feature enhancement release. There is a bu

Re: Where is the ucs-32 codec?

2006-06-04 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > Python seems to be missing a UCS-32 codec, even in wide builds (not > that it the build should matter). > Is there some deep reason or should I just contribute a patch? > > If it's just a bug, should I call the codec 'ucs-32' or 'utf-32'? Or > both (aliased)? > There s

[ANN] ConfigObj 4.3.2 Released

2006-06-04 Thread Fuzzyman
`ConfigObj 4.3.2 `_ has just been released. You can download it from `configobj-4.3.2.zip `_. ConfigObj is a config file reader and writer. It has *many* features,

Re: mutable member, bug or ...

2006-06-04 Thread Bruno Desthuilliers
Sambo a écrit : > By accident I assigned int to a class member 'count' which was > initialized to (empty) string and had no error till I tried to use it as > string, obviously. Why was there no error on assignment( near the end ). Python is dynamically typed - which means that it's not the name

Re: Where is the ucs-32 codec?

2006-06-04 Thread M�ta-MCI
Hi! Look at: http://cjkpython.berlios.de (iconvcodec) (Serge Orlov has built a version for Python 2.4 "special for me"; thanks to him). @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] in python , could I accomplish the purpose that "a=Console.read()" used in C?

2006-06-04 Thread Bruno Desthuilliers
python a écrit : > in python , could I accomplish the purpose that "a=Console.read()" used > in C? There's nothing like "Console.read()" in ansi-C. (see Dennis's post for the answer to your question) -- http://mail.python.org/mailman/listinfo/python-list

Re: re beginner

2006-06-04 Thread John Machin
On 5/06/2006 10:38 AM, Bruno Desthuilliers wrote: > SuperHik a écrit : >> hi all, >> >> I'm trying to understand regex for the first time, and it would be >> very helpful to get an example. I have an old(er) script with the >> following task - takes a string I copy-pasted and wich always has the

Re: Proposed new PEP: print to expand generators

2006-06-04 Thread Bruno Desthuilliers
James J. Besemer a écrit : > (snip) > > PEP -- EXTEND PRINT TO EXPAND GENERATORS > > NUTSHELL > > I propose that we extend the semantics of "print" such that if the > object to be printed is a generator then print would iterate over the > resulting sequence of sub-objects and recursively prin

Re: Using print instead of file.write(str)

2006-06-04 Thread Bruno Desthuilliers
Tim Roberts a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > >>Sion Arrowsmith a écrit : >> (snip) >>>"more flexible"? More convenient, yes. More powerful, maybe. But I >>>don't see more flexible. Everything print can to stdout.write() can >>>do. The reverse isn't true. eg (this app

Re: Using print instead of file.write(str)

2006-06-04 Thread Bruno Desthuilliers
John Machin a écrit : (snip) > ... or was that a rhetorical question? It was. -- http://mail.python.org/mailman/listinfo/python-list

Re: deleting texts between patterns

2006-06-04 Thread John Machin
On 5/06/2006 2:51 AM, Baoqiu Cui wrote: > John Machin <[EMAIL PROTECTED]> writes: > >> Uh-oh. >> >> Try this: >> > pat = re.compile('(?<=abc\n).*?(?=xyz\n)', re.DOTALL) > re.sub(pat, '', linestr) >> 'blahfubarabc\nxyz\nxyzzy' > > This regexp still has a problem. It may remove the lines b

Re: Installation Problem

2006-06-04 Thread Marshall Dudley
Warren Block wrote: > Marshall Dudley <[EMAIL PROTECTED]> wrote: > > Sorry, this is a FreeBSD system 4.8-RELEASE > > > > I found another set of documents that say to use the following to > > install:: > > > > python setup.py install > > > > but after running it, I still have the same problem. > >

Adding attribute to objetcs

2006-06-04 Thread Miguel Galves
Hello,I`m starting to learn python, and I hava a very good background in Javaand C/C++ programming. I was reading Dive into python chapter aboutOO and I saw that in python we can do the following:class Person:     passjoe = new Person()joe.name = "Joe"joe.age = 13It seems that it is possible to add

Re: integer to binary...

2006-06-04 Thread Bruno Desthuilliers
Grant Edwards a écrit : > On 2006-06-02, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >>Grant Edwards a écrit : >> >>>On 2006-06-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>> does anyone know a module or something to convert numbers like integer to binary format ? >>> >>>They _a

Re: reordering elements of a list

2006-06-04 Thread Roberto Bonvallet
greenflame <[EMAIL PROTECTED]>: > Roberto: I do not understand the first half of the last line of your > code. [mainlist[i - 1] for i in orderinglist] is a list made with the elements of orderinglist, but instead of taking the actual value i from the list, the value that is taken is mainlist[i - 1

Re: re beginner

2006-06-04 Thread Paul McGuire
"John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Fantastic -- at least for the OP's carefully copied-and-pasted input. > Meanwhile back in the real world, there might be problems with multiple > tabs used for 'prettiness' instead of 1 tab, non-integer values, etc etc. > I

Re: C# equivalent to range()

2006-06-04 Thread Neuruss
Delaney, Timothy (Tim) wrote: > Well, there are reasons to reply to a message stating that it's not on-topic > for the group. The most common reaction to receiving no replies is to start a > new thread petulantly asking why there were no answers to the original > thread. If that one gets no repl

Re: Max function question: How do I return the index of the maximum value of a list?

2006-06-04 Thread Steven Bethard
jj_frap wrote: > I'm new to programming in Python and am currently writing a three-card > poker simulator. I have completed the entire simulator other than > determining who has the best hand (which will be far more difficult > than the aspects I've codes thus far)...I store each player's hand in a

Re: Max function question: How do I return the index of the maximum value of a list?

2006-06-04 Thread Robert Kern
Steven Bethard wrote: > Can you do something like:: > > max_val, max_index = max((x, i) for i, x in enumerate(my_list)) > > ? If any two "x" values are equal, this will return the one with the > lower index. Don't know if that matters to you. Wouldn't it return the one with the highest i

Re: re beginner

2006-06-04 Thread John Machin
On 5/06/2006 10:07 AM, Paul McGuire wrote: > "John Machin" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Fantastic -- at least for the OP's carefully copied-and-pasted input. >> Meanwhile back in the real world, there might be problems with multiple >> tabs used for 'prettiness'

Lots of orphaned PyCon wiki pages...

2006-06-04 Thread skip
Over the past couple days I've been trying to reduce the large number of orphaned wiki pages, deleting many, stitching many others back into the fabric. There are a bunch of orphaned PyCon-related pages, mostly subpages of PyCon2005 and PyCon2006. Would someone with PyCon-fu want to check them o

Re: re beginner

2006-06-04 Thread Paul McGuire
"John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 5/06/2006 10:07 AM, Paul McGuire wrote: > > "John Machin" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > >> Fantastic -- at least for the OP's carefully copied-and-pasted input. > >> Meanwhile back in

Freezing a static executable

2006-06-04 Thread Will Ware
I am trying to freeze a static executable. I built a static Python executable this way: ./configure --disable-shared --prefix=/usr/local make make install Even that didn't give me a really static executable, though: $ ldd /usr/local/bin/python linux-gate.so.1 => (0xe000

Re: C# equivalent to range()

2006-06-04 Thread Neuruss
Dennis Lee Bieber wrote: > What most of us saw was a blunt request on how to implement a Python > construct in some other language that may not be familiar to us. I'm curious, who are "us"? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python less error-prone than Java

2006-06-04 Thread Ilpo Nyyssönen
"Kaz Kylheku" <[EMAIL PROTECTED]> writes: > Buggy library code is what prompted that article. Yes, but it is an error type that happens very rarely still. And so it seems that very few programs even notice that bug in that library. > Except when you feed those programs inputs which are converte

Re: Max function question: How do I return the index of the maximum value of a list?

2006-06-04 Thread Steven Bethard
Robert Kern wrote: > Steven Bethard wrote: >> Can you do something like:: >> >> max_val, max_index = max((x, i) for i, x in enumerate(my_list)) >> >> ? If any two "x" values are equal, this will return the one with the >> lower index. Don't know if that matters to you. > > Wouldn't it retu

Re: C# equivalent to range()

2006-06-04 Thread Erik Max Francis
Neuruss wrote: > Dennis Lee Bieber wrote: >> What most of us saw was a blunt request on how to implement a Python >> construct in some other language that may not be familiar to us. > > I'm curious, who are "us"? The regular readers of comp.lang.python. If you don't think we haven't seen

attribute error using fnmatch

2006-06-04 Thread s99999999s2003
hi i have script like this: from fnmatch import fnmatch from glob import glob ... f = ['file1','file2','file3'] r = "d:\\somepath" pat = "*.bat" listof_files = [i for i in f if not fnmatch(os.path.join(r,i),pat) and os.path.isfile(os.path.join(r,i))] ... .. I get this error: File "C:\Pyth

Re: Is device Connected Windows?

2006-06-04 Thread placid
Tim Golden wrote: > [placid] > > | Just wondering is there a way (not brute force) to check if a usb > | storage device is connected? > > Hmmm. How do you identify "a usb storage device" to know that > it is or isn't connected? > > You can certainly do something useful with wmi. eg, > > > import

Re: attribute error using fnmatch

2006-06-04 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > listof_files = [i for i in f if not fnmatch(os.path.join(r,i),pat) and > os.path.isfile(os.path.join(r,i))] > ... > .. > > I get this error: > File "C:\Python24\Lib\fnmatch.py", line 37, in fnmatch > pat = os.path.normcase(pat) > File "C:\Python24\lib\ntpath.py