Re: Difference in Python and Ruby interactive shells

2006-04-05 Thread Sybren Stuvel
Lou Pecora enlightened us with: > Impressive, but YIKES, there ought to be a simpler way to do this. > I think during the development phase editing and reloading would be > very common and you'd want everything updated. I hardly ever reload stuff manually during development. I write a script, and

Re: CD Burning

2006-04-05 Thread Tim Golden
Albert Leibbrandt wrote: > Hi > > Can anybody tell me which windows API or python module they are using > for writing cd's / dvd's with python? Other people have offered sound suggestions about using cdrecord etc. under Cygwin. Just to make the point, though, XP (and above, presumably) does have a

save file as utf-8 format

2006-04-05 Thread erchamion . beren
hi, what should i do to save file as utf-8 encoding. thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: "The World's Most Maintainable Programming Language"

2006-04-05 Thread Mirco Wahab
John Salerno wrote: > There is an article on oreilly.net's OnLamp site called "The World's > Most Maintainable Programming Language" > (http://www.oreillynet.com/onlamp/blog/2006/03/the_worlds_most_maintainable_p.html). There is one really interessting (imho) point in the last part that struck me

Re: save file as utf-8 format

2006-04-05 Thread erchamion . beren
On Wednesday 05 April 2006 10:53, [EMAIL PROTECTED] wrote: > hi, what should i do to save file as utf-8 encoding. thanks. from http://evanjones.ca/python-utf8.html The Byte-Order Marker (BOM) section did the trick. -- http://mail.python.org/mailman/listinfo/python-list

Re: Convertion of Unicode to ASCII NIGHTMARE

2006-04-05 Thread Roger Binns
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Roger Binns wrote: > >> SQLite only accepts Unicode so a Unicode string has to be supplied. > > fact or FUD? let's see: Note I said SQLite. For APIs that take/give strings, you can either supply/get a UTF-8 encoded se

Re: using range() in for loops

2006-04-05 Thread Ben Sizer
John Salerno wrote: > The reason for this distinction comes from the fact that I read a lot > how using range and for is somewhat discouraged, because it doesn't > really use a for loop for it's true purpose. So my question is, is this > just a Python-oriented opinion about for loops, or is it a ge

Re: Doc suggestions

2006-04-05 Thread Ed Singleton
On 4 Apr 2006 15:18:27 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote in message > > Here is a 3' view. I posted about a clear > > (admittedly very minor) doc problem 8 days ago. > > Since then there have been 30+ postings in this > > thread. Insults and bad f

Re: "The World's Most Maintainable Programming Language"

2006-04-05 Thread Tim Parkin
John Salerno wrote: > There is an article on oreilly.net's OnLamp site called "The World's > Most Maintainable Programming Language" > (http://www.oreillynet.com/onlamp/blog/2006/03/the_worlds_most_maintainable_p.html). > > > > It's not about a specific language, but about the qualities that

Problem connecting Python with PostgreSQL

2006-04-05 Thread Jose Carlos Balderas Alberico
Hello. I have a problem connecting to a PostgreSQL database and I don't know where the problem lays.   A bit of background:   I installed the psycopg module yesterday (it was a bit of a pain to do it since I installed the wrong version and it didn't work). I got to install it in the end anyway.  

Re: using range() in for loops

2006-04-05 Thread Ant
It's not just a Python thing, Java for example generally uses the idiom: for (Iterator it = list.iterator(); it.hasNext(); ) { Object next = it.next(); //Do stuff to next } Horrible compared to the python idiom of course (though the latest version supports for (x : list){}) Ruby has some

Re: Standalone Python functions in UML?

2006-04-05 Thread bruno at modulix
Ravi Teja wrote: (snip) > >> And probably Python is too dynamic for UML. That is another reason > rountrip tools aren't there. > > > As you probably already know, UML diagrams are structural and > behavioural (plus interactional with 2.0). Round trip tools only model > structural diagrams. Pytho

Re: Standalone Python functions in UML?

2006-04-05 Thread bruno at modulix
Philippe Martin wrote: please don't top-post - corrected > bruno at modulix wrote: > > >>Philippe Martin wrote: >> >>>Roman Susi wrote: >>> >> >>(snip) >> >> More theoretical question is if I create classes on the fly, how UML can reflect that? >>> >>> >>>You mean objects I think: >> >>

Re: Dice probability problem

2006-04-05 Thread Antoon Pardon
Op 2006-04-04, Tomi Lindberg schreef <[EMAIL PROTECTED]>: > First, thanks to Antoon and Alexander for replying. > > Antoon Pardon wrote: > >> It would be better to construct distributions for one >> die and make a function that can 'add' two distributions >> together. > > As both replies pointed to

socket.socket.settimeout implementation

2006-04-05 Thread jnair
When using socket.socket.settimeout we normally only guard against "socket.timeout" exception.Now the implementation of "settimeout" in "Python-2.4.3/Modules/socketmodule.c" sets the socket fd to nonblocking and uses "select()" to timeout as seen below in line 1487 and 1386 : static PyObject * 1

Re: "The World's Most Maintainable Programming Language"

2006-04-05 Thread Paul McGuire
"Mirco Wahab" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > John Salerno wrote: > > There is an article on oreilly.net's OnLamp site called "The World's > > Most Maintainable Programming Language" > > (http://www.oreillynet.com/onlamp/blog/2006/03/the_worlds_most_maintainable_ p.htm

Re: "The World's Most Maintainable Programming Language"

2006-04-05 Thread Azolex
John Salerno wrote: > There is an article on oreilly.net's OnLamp site called "The World's > Most Maintainable Programming Language" > (http://www.oreillynet.com/onlamp/blog/2006/03/the_worlds_most_maintainable_p.html). > > > > It's not about a specific language, but about the qualities that

Re: Standalone Python functions in UML?

2006-04-05 Thread Ravi Teja
> Well, you can have a lot of things happening during the import stage. Is this 'runtime' or not ?-) Runtime. > And you can actually *create* (not 'change') classes at runtime too. Yes sir! By now I am quite well aware what 'dynamic typing' means. Once again, round trip tools today model program

Re: Python Decompilers?

2006-04-05 Thread Azolex
Peter Hansen wrote: > flamesrock wrote: >> Hi, >> >> Are there any good decompilers for python? > > Decompyle can manage any version from 1.5 up to 2.3.3. I was disappointed when I started to play with decompyle for python 2.3 to observe that it failed on non-trivial list comprehensions. -- htt

Re: Python Decompilers?

2006-04-05 Thread Paul Boddie
flamesrock wrote: > > Are there any good decompilers for python? I've had some success with decompyle, which seems to be principally available as a Debian package, for which the sources can be obtained here: http://packages.debian.org/stable/source/decompyle Paul -- http://mail.python.org/mail

FREE WEBSITE plus 10EMAIL ADDRESSES

2006-04-05 Thread big-cash
FREE WEBSITE plus 10EMAIL ADDRESSES Please visit: http://website.ws/daisypool/show -- http://mail.python.org/mailman/listinfo/python-list

Dr. Dobb's Python-URL! - weekly Python news and links (Apr 4)

2006-04-05 Thread Peter Otten
QOTW: "Don't be too sure that it's compatible for the indefinite future. XML is just as future-proof as any other format." - Sybren Stuvel "Submitting a proposed change or fix [of the Python docs] is easier and quicker than arguing about it on c.l.py and it seems to get pretty quickly to the actua

Re: tuple syntax ',' (ending in comma?)

2006-04-05 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Michael Yanowitz" <[EMAIL PROTECTED]> wrote: >I am confused by the syntax for tuples. ... > The way I fixed this error was I added an extra , (comma) to the tuple: > thread.start_new_thread(read_data_thread, (strDataFilename,)) > > I am just confused by the sy

HTMLParser fragility

2006-04-05 Thread Lawrence D'Oliveiro
I've been using HTMLParser to scrape Web sites. The trouble with this is, there's a lot of malformed HTML out there. Real browsers have to be written to cope gracefully with this, but HTMLParser does not. Not only does it raise an exception, but the parser object then gets into a confused state

A Lambda Logo Tour

2006-04-05 Thread Xah Lee
A Lambda Logo Tour (and why LISP languages using λ as logo should not be looked upon kindly) Xah Lee, 2002-02 Dear lispers, The lambda character λ, always struck a awe in me, as with other mathematical symbols. In my mind, i imagine that those obscure math symbolism are etched in stone by god. A

Re: HTMLParser fragility

2006-04-05 Thread Rene Pijlman
Lawrence D'Oliveiro: >I've been using HTMLParser to scrape Web sites. The trouble with this >is, there's a lot of malformed HTML out there. Real browsers have to be >written to cope gracefully with this, but HTMLParser does not. There are two solutions to this: 1. Tidy the source before parsin

Re: problems with looping, i suppose

2006-04-05 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, John Salerno <[EMAIL PROTECTED]> wrote: >... and now when I run >it, the DOS prompt flashes real quick and disappears. Does your DOS OS not have the equivalent of xterm, or KDE Konsole, or such? Something that lets you execute more than just one command, so you

Re: String pattern matching

2006-04-05 Thread jimlewis
Thanks to all for the various good approaches. Kent's plain RE approach seems the most straightforward - did not know that RE can handle this situation - good to know! -- http://mail.python.org/mailman/listinfo/python-list

Re: HTMLParser fragility

2006-04-05 Thread Daniel Dittmar
Lawrence D'Oliveiro wrote: > I've been using HTMLParser to scrape Web sites. The trouble with this > is, there's a lot of malformed HTML out there. Real browsers have to be > written to cope gracefully with this, but HTMLParser does not. Not only > does it raise an exception, but the parser obje

Re: HIRING: PHP Developer

2006-04-05 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: >We are hiring a PHP developer! -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: unix newbie questions

2006-04-05 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Gerard Flanagan" <[EMAIL PROTECTED]> wrote: >* To create an empty __init__.py file I do 'vim __init__.py' then >immediately exit vim, is there a shell or vim command which will create >an empty file without opening the editor? man touch >* If I want to do : >

Distribution of Python apps

2006-04-05 Thread Sebastjan Trepca
Hi,I was wondering if there is anything similar to py2exe for OS X and Linux distributions so that I wouldn't have to pre-install Python and required modules for my application.Thanks.-- Sebastjanhttp://www.trepca.si/blog -- http://mail.python.org/mailman/listinfo/python-list

Re: Standalone Python functions in UML?

2006-04-05 Thread Ben Sizer
Ravi Teja wrote: > What I mean is <> is the formal notation for a class in which > global functions are aggregated. It's not a hack. > Python is not alone here. Most OO languages aside Java and Smalltalk > have functions outside classes and UML accomodates though not > encourages free functions. I

Re: HIRING: PHP Developer

2006-04-05 Thread Simon
-- http://urlkick.com/ Free URL redirection service. Turns a long URL into a much shorter one. "Lawrence D'Oliveiro" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] wrote: > >>We are hiring a PHP developer! > >

Filters like old skool Jive, Fudd, Valspeak... Text transformation in Python

2006-04-05 Thread dananrg
I would like to learn how to roll my own filter ala early 90's filters like Jive, Fudd, Kraut, Moron, etc, that take text as an input, and re-writes the text adding general hilarity of various linguistic flavor (depending on the filter). I always loved running my philosophy papers, or anything tha

[pyqt] How to copy the content of a QPopupMenu ?

2006-04-05 Thread kobayashi
Dear all, For a particuliar case, I need to copy all the items of an existing menu (including the separators and sub-menus) in a new empty one ... Does someone knows how to do that ? I've tried : item = menu_orig.findItem(item_id) menu_new.insertItem(item, item_id) but it fails with : TypeError: a

Re: A Lambda Logo Tour

2006-04-05 Thread Henning Makholm
Scripsit "Xah Lee" <[EMAIL PROTECTED]> > Subroutines in lisps easily have side-effects, and sometimes > non-functional programing methodologies such as OOP are actually > encouraged in lisp. As most of you know, the lambda symbol chosen by > functional languages is to signify no side-effects. Wha

wxPython and SuSE 10.0

2006-04-05 Thread Steve
Hello, I was wondering if there is a wxPython RPM for SuSE 10.0 available. I Googled for it with no luck, but I'm hopeful that there is one out there. Thanks-in-Advance Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: A Lambda Logo Tour

2006-04-05 Thread Lars Rune Nøstdal
I bet the ∑-book also has some λ-stuff in it. If it doesn't, it probably uses some other greek letters that aren't mentioned on the cover. It's such a shame, really ... :( -- Lars Rune Nøstdal http://lars.nostdal.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Filters like old skool Jive, Fudd, Valspeak... Text transformation in Python

2006-04-05 Thread bruno at modulix
[EMAIL PROTECTED] wrote: (snip part about filters) > Any good "generators" written in Python? I'd like to roll me one of > these as well; e.g. execute the program and it will create a few > paragraphs of text in the jargon of a discipline, subdiscipline, > subculture, etc. Anyone know what I'm ta

Re: String pattern matching

2006-04-05 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Thanks to all for the various good approaches. Kent's plain RE approach > seems the most straightforward - did not know that RE can handle this > situation - good to know! Thanks to Eddie Corns also who showed how to express the problem as a parsing problem. I am also

Re: Convertion of Unicode to ASCII NIGHTMARE

2006-04-05 Thread Fredrik Lundh
Roger Binns wrote: > > fact or FUD? let's see: > > Note I said SQLite. For APIs that take/give strings, you can either > supply/get a UTF-8 encoded sequence of bytes, or two bytes per character > host byte order sequence. Any wrapper of SQLite that doesn't do > Unicode in/out is seriously break

Re: Strange problem when running python code

2006-04-05 Thread Fredrik Lundh
"ishtar2020" wrote: > It's quite puzzling. And if I change some lousy thing, like inserting a > newline between the sentences, the interpreter will find another error > somewhere else, even when that part of the code was working flaw- > lessly in previous runs what Python version are you using ?

Re: using range() in for loops

2006-04-05 Thread Roel Schroeven
John Salerno schreef: > I'm reading Text Processing in Python right now and I came across a > comment that is helping me to see for loops in a new light. I think > because I'm used to the C-style for loop where you create a counter > within the loop declaration, for loops have always seemed to m

Re: Dice probability problem

2006-04-05 Thread Tomi Lindberg
Antoon Pardon wrote: > IMO you are making things too complicated and not general > enough. I believe that the above is very likely more than just your opinion :) Programming is just an occasional hobby to me, and I lack both experience and deeper (possibly a good chunk of shallow as well) know

Re: [pyqt] How to copy the content of a QPopupMenu ?

2006-04-05 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Dear all, > > For a particuliar case, I need to copy all the items of > an existing menu (including the separators and sub-menus) > in a new empty one ... Does someone knows how to do that ? > I've tried : > item = menu_orig.findItem(item_id) > menu_new.insertItem(item,

Re: Standalone Python functions in UML?

2006-04-05 Thread Nicola Musatti
Roman Susi wrote: [...] > Also, my argument that Python is quite good at communicating design > ideas is supported by the fact that Python developers do not use UML (or > other modelling tools/languages) as often as say Java programmers, nor > feel the need to. And probably Python is too dynamic f

Re: How to copy the content of a QPopupMenu ?

2006-04-05 Thread kobayashi
Dear Diez, Thanks ... I've already read the doc :) In my case, I would like to copy an item from a popup menu to another popup menu ... Of course, I can create a new item with same name, same pixmap and so on but I don't know how to execute the same code when my new item is activated ... And I do

Re: Standalone Python functions in UML?

2006-04-05 Thread Nicola Musatti
bruno at modulix wrote: [...] > Yes, there's in UML a fundamental distinction between classes and > objects - distinction that does not exist in a lot of OO languages. This > greatly limits UML's usability for some common idioms in dynamic OOPL's. > Seems like UML has been designed to express only

Re: Dice probability problem

2006-04-05 Thread Alexander Schmolck
Tomi Lindberg <[EMAIL PROTECTED]> writes: > # Adds another die to results. > def add_dice(sums, die): > # If first die, all values appear once I'd add something like sums = sums or {} because otherwise your function will sometimes mutate sums and sometimes return a fresh object, whi

Re: HTMLParser fragility

2006-04-05 Thread Richie Hindle
[Daniel] > You could try HTMLTidy (http://www.egenix.com/files/python/mxTidy.html) > as a first step to get well formed HTML. But Tidy fails on huge numbers of real-world HTML pages. Simple things like misspelled tags make it fail: >>> from mx.Tidy import tidy >>> results = tidy("Hello world!"

RELEASED Python 2.5 (alpha 1)

2006-04-05 Thread Anthony Baxter
On behalf of the Python development team and the Python community, I'm happy to announce the first alpha release of Python 2.5. This is an *alpha* release of Python 2.5, and is the *first* alpha release. As such, it is not suitable for a production environment. It is being released to solicit feed

Re: How to copy the content of a QPopupMenu ?

2006-04-05 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Dear Diez, > > Thanks ... I've already read the doc :) > > In my case, I would like to copy an item from > a popup menu to another popup menu ... Of course, > I can create a new item with same name, same pixmap > and so on but I don't know how to execute the same code

Re: RELEASED Python 2.5 (alpha 1)

2006-04-05 Thread Michael Ekstrand
After reading AMK's survey of what's new in Python 2.5, I am suitably impressed. As usual, I can't wait to start using the cool new features... extended generators? (mind is currently swimming with the question of "can I implement Scheme's call-with-current-continuation using extended generato

Re: RELEASED Python 2.5 (alpha 1)

2006-04-05 Thread Gerhard Häring
Michael Ekstrand wrote: > [...] > Anyway, the more important question that came to mind: I see that 2.5 > will include the excellent ElementTree. Will cElementTree be included > where available? or is it only the pure-Python version that will be in > the standard library? Both elementtree as (

Re: RELEASED Python 2.5 (alpha 1)

2006-04-05 Thread Michele Simionato
Michael Ekstrand wrote: > After reading AMK's survey of what's new in Python 2.5, I am suitably > impressed. As usual, I can't wait to start using the cool new > features... extended generators? (mind is currently swimming with the > question of "can I implement Scheme's call-with-current-continua

Re: How to copy the content of a QPopupMenu ?

2006-04-05 Thread David Boddie
[EMAIL PROTECTED] wrote: > In my case, I would like to copy an item from > a popup menu to another popup menu ... Of course, > I can create a new item with same name, same pixmap > and so on but I don't know how to execute the same code > when my new item is activated ... And I don't know how > to

Re: How to copy the content of a QPopupMenu ?

2006-04-05 Thread David Boddie
Well, the Google web interface didn't quite work as expected there. Here's a version of the previous message containing just my advice. You might want to use QAction to define individual items that can be activated. That way you can just reuse the same actions in both menus or move them from one

small challenge : limit((x+1)**0.5 for x in itially(2))

2006-04-05 Thread Azolex
generators challenge define "limit" and "itially" so that limit(foo(x) for x in itially(bar)) works out the same as limit2(foo,bar) with def limit2(foo,bar) : bar1 = foo(bar) while bar != bar1 : bar1,bar = foo(bar),bar1

Re: Dice probability problem

2006-04-05 Thread Tomi Lindberg
Antoon Pardon wrote: > def __rmul__(self, num): > tp = num * [self] > return reduce(operator.add, tp) > > sum3d6 = 3 * D(6) One basic question: is there any particular reason not to use __mul__ instead (that would allow me to use both 3 * D(6) and D(6) * 3, while __rmul__ raises an A

Re: Strange problem when running python code

2006-04-05 Thread Steven D'Aprano
On Tue, 04 Apr 2006 12:01:12 -0700, ishtar2020 wrote: > I must add, when the python interpreter displays the traceback, with > the line that is producing the error, it doesn't look like the one I > got in the code. I sometimes get that problem when I'm running code, I make a change in the source

Re: using range() in for loops

2006-04-05 Thread John Salerno
Roel Schroeven wrote: > In many cases loops really are for iterating over sequences; more so > than I realized when using for loops in C or C++. In these cases, > Python's for statement works better than C-style loops. And if you > really need to do something a certain number of times, there's

Re: using range() in for loops

2006-04-05 Thread AndyL
Paul Rubin wrote: > Normally you'd use range or xrange. range builds a complete list in > memory so can be expensive if the number is large. xrange just counts > up to that number. so when range would be used instead of xrange. if xrange is more efficient, why range was not reimplemented? --

Re: small challenge : limit((x+1)**0.5 for x in itially(2))

2006-04-05 Thread Azolex
Azolex wrote: > generators challenge > > > define "limit" and "itially" > > so that > > limit(foo(x) for x in itially(bar)) > > works out the same as > > limit2(foo,bar) > > with > > def limit2(foo,bar) : > bar1 = foo(bar) > while bar != bar1

Re: using range() in for loops

2006-04-05 Thread Georg Brandl
[EMAIL PROTECTED] wrote: > hi John, > Python doesn't provide for loop like C / C++ but using Range() or > Xrange() you can achive all the functionalities of the C for loop. Not quite. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: using range() in for loops

2006-04-05 Thread Georg Brandl
AndyL wrote: > Paul Rubin wrote: >> Normally you'd use range or xrange. range builds a complete list in >> memory so can be expensive if the number is large. xrange just counts >> up to that number. > > so when range would be used instead of xrange. if xrange is more > efficient, why range was

Re: using range() in for loops

2006-04-05 Thread Adam DePrince
On Tue, 2006-04-04 at 21:54 -0400, John Salerno wrote: > I'm reading Text Processing in Python right now and I came across a > comment that is helping me to see for loops in a new light. I think > because I'm used to the C-style for loop where you create a counter > within the loop declaration,

Re: using range() in for loops

2006-04-05 Thread Sion Arrowsmith
AndyL <[EMAIL PROTECTED]> wrote: >Paul Rubin wrote: >> Normally you'd use range or xrange. range builds a complete list in >> memory so can be expensive if the number is large. xrange just counts >> up to that number. >so when range would be used instead of xrange. if xrange is more >efficient,

Re: Strange problem when running python code

2006-04-05 Thread Steve Juranich
Dennis Lee Bieber wrote: > As an occassional dabbler in the Tarot, I can assure you that cards > are NOT used for "mind-reading"; they merely offer up a possible future > which must be interpreted in light of the querant's situation... (or, > since I typically read for myself -- the allow my subco

Re: Registration Code

2006-04-05 Thread Steven D'Aprano
On Tue, 04 Apr 2006 12:02:24 -0700, Ross Ridge wrote: > Steven D'Aprano wrote: >> Look at Microsoft. Their first version of Word (for Macintosh, as it >> turned out) was copy-protected. Their second version of Word, and every >> version since, as well as Excel and Powerpoint, have not included cop

Re: RELEASED Python 2.5 (alpha 1)

2006-04-05 Thread Fredrik Lundh
Michael Ekstrand wrote: > Anyway, the more important question that came to mind: I see that 2.5 > will include the excellent ElementTree. Will cElementTree be included > where available? or is it only the pure-Python version that will be in > the standard library? they're both available, via the

Re: tuple syntax ',' (ending in comma?)

2006-04-05 Thread Steven D'Aprano
On Wed, 05 Apr 2006 08:17:07 +1000, Ben Finney wrote: > "Michael Yanowitz" <[EMAIL PROTECTED]> writes: > >>I am still relatively new to Python. I am confused by the syntax >> for tuples. > > Well, it's reassuring to know that this is still as confusing for > newcomers now as it was when I st

Re: using range() in for loops

2006-04-05 Thread Steven D'Aprano
On Wed, 05 Apr 2006 09:16:37 -0400, AndyL wrote: > Paul Rubin wrote: >> Normally you'd use range or xrange. range builds a complete list in >> memory so can be expensive if the number is large. xrange just counts >> up to that number. > > so when range would be used instead of xrange. if xrange

Re: using range() in for loops

2006-04-05 Thread Steven D'Aprano
On Wed, 05 Apr 2006 16:15:12 +0200, Georg Brandl wrote: > [EMAIL PROTECTED] wrote: >> hi John, >> Python doesn't provide for loop like C / C++ but using Range() or >> Xrange() you can achive all the functionalities of the C for loop. > > Not quite. Care to explain what the differences are,

Re: using range() in for loops

2006-04-05 Thread Steven D'Aprano
On Wed, 05 Apr 2006 16:21:02 +0200, Georg Brandl wrote: > Because of backwards compatibility. range() returns a list, xrange() an > iterator: list(xrange(...)) will give the same results as range(...). Georg is pretty much correct in his explanation, but just to dot all the I's and cross all the

Re: using range() in for loops

2006-04-05 Thread Georg Brandl
Steven D'Aprano wrote: > On Wed, 05 Apr 2006 16:21:02 +0200, Georg Brandl wrote: > >> Because of backwards compatibility. range() returns a list, xrange() an >> iterator: list(xrange(...)) will give the same results as range(...). > > Georg is pretty much correct in his explanation, but just to d

ceval.c no such file or dir and SIGSEGV

2006-04-05 Thread Nancy
Hi, I'm running 2.4 Python. I have an extension program that calls C funcs. Actually I have a C prog that calls python that calls C. In a python to C function call I get a SIGSEGV and this stack trace. I have print statements that show it made it into the C extension function, and within there its

Re: wxPython and SuSE 10.0

2006-04-05 Thread Ben C
On 2006-04-05, Steve <[EMAIL PROTECTED]> wrote: > Hello, > > I was wondering if there is a wxPython RPM for SuSE 10.0 available. I > Googled for it with no luck, but I'm hopeful that there is one out > there. http://www.novell.com/products/linuxpackages/professional/python-wxgtk.html is th

Re: small challenge : limit((x+1)**0.5 for x in itially(2))

2006-04-05 Thread Paul McGuire
"Azolex" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > generators challenge > > > define "limit" and "itially" > > so that > > limit(foo(x) for x in itially(bar)) > > works out the same as > > limit2(foo,bar) > > with > > def limit2(foo,bar) : >

is there any bug in this multi-thread script?

2006-04-05 Thread Ju Hui
I wrote a script to do work with multi-thread in a queue reference others code. Is there any bug in this script? another question is : when we call start to run one thread extends from threading, it will call a join() by itself? I want to monitor the qsize() to ensure all work are finished. but whe

Re: using range() in for loops

2006-04-05 Thread Georg Brandl
Steven D'Aprano wrote: > On Wed, 05 Apr 2006 16:15:12 +0200, Georg Brandl wrote: > >> [EMAIL PROTECTED] wrote: >>> hi John, >>> Python doesn't provide for loop like C / C++ but using Range() or >>> Xrange() you can achive all the functionalities of the C for loop. >> >> Not quite. > > Care

Re: Mouse event - binding

2006-04-05 Thread beta
Dear John, Thanks for your help. I don't know how to bind the ball only into a program. Would you mind help me on this? I added the changeColour function, here is a complete program. --- from Tkinter import * import string class Pong(Frame): def createWidgets(self):

Re: RELEASED Python 2.5 (alpha 1)

2006-04-05 Thread Robert Hicks
That is cool and that will be a great addition to the libraries. Robert -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to have a for-loop index?

2006-04-05 Thread andrewfelch
Sometimes C++ is the right tool/style for the job, but I don't need the speed or efficiency of C++. -- http://mail.python.org/mailman/listinfo/python-list

Re: Convertion of Unicode to ASCII NIGHTMARE

2006-04-05 Thread Roger Binns
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > sounds like your understanding of Unicode and Python's Unicode system > is a bit unclear. Err, no. Relaying unicode data between two disparate C APIs requires being careful and thorough. That means paying attention to

Re: CD Burning

2006-04-05 Thread Gregory Piñero
Nero has a commandline utility called NeroCMD.exe (not sure if you needed a free solution or not) Here's some sample code and write-up using NeroCMD.exe with Python: http://www.answermysearches.com/index.php/nerocmdexe-and-python-automating-the-burning-process/10/ -Greg On 5 Apr 2006 00:46:16 -

Re: Python Decompilers?

2006-04-05 Thread flamesrock
Thanks, guys! Sorry if my question confused anyone :/ I was hoping to find something better then decompyle, since I've had limited success with it.. -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: unix newbie questions

2006-04-05 Thread flamesrock
Another option is zsh, which is very much like bash, but better ;) -- http://mail.python.org/mailman/listinfo/python-list

Pydev and Pydev Extensions 1.0.5 release

2006-04-05 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.0.5 have been released Check http://www.fabioz.com/pydev for details on Pydev Extensions and http://pydev.sf.net for details on Pydev Release Highlights in Pydev Extensions: - - The po

how to convert string

2006-04-05 Thread diffuser78
I want to print number 0 to 9 in one line like this 0 1 2 3 4 5 6 7 8 9 if I do like this, it prints in different lines for i in xrange(10): print i so i tried like this str = "" for i in xrange(10): str = i + " " print str but i want to know how convert int i to string. Every help is

Re: Registration Code

2006-04-05 Thread Ross Ridge
Steven D'Aprano wrote: > What are the odds that Vista will have it? Ross Ridge wrote; > About 100%. Steven D'Aprano wrote: > Considering that you can hardly walk into a university, school or > corporation without finding Windows or Office supplied without PA, would > you care to revise that numbe

Re: wxPython and SuSE 10.0

2006-04-05 Thread Steve
Ben C wrote: > On 2006-04-05, Steve <[EMAIL PROTECTED]> wrote: >> Hello, >> >> I was wondering if there is a wxPython RPM for SuSE 10.0 >> available. I >> Googled for it with no luck, but I'm hopeful that there is one out >> there. > > http://www.novell.com/products/linuxpackages/

Re: how to convert string

2006-04-05 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > I want to print number 0 to 9 in one line like this > 0 1 2 3 4 5 6 7 8 9 > > if I do like this, it prints in different lines > > for i in xrange(10): > print i for i in xrange(10): print i, > so i tried like this > > str = "" > for i in xrange(10): > st

Re: how to convert string

2006-04-05 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I want to print number 0 to 9 in one line like this > 0 1 2 3 4 5 6 7 8 9 > > if I do like this, it prints in different lines > > for i in xrange(10): > print i > > so i tried like this > > str = "" > for i in xrange(10): > str = i + " " > print str > > but i wan

PIL question about crop method

2006-04-05 Thread John Salerno
I might be way off target even looking into this method for what I need to do, but I'm still a little confused about the description of it: crop im.crop(box) => image Returns a rectangular region from the current image. The box is a 4-tuple defining the left, upper, right, and lower pixel coord

Re: how to convert string

2006-04-05 Thread Gary Herron
[EMAIL PROTECTED] wrote: >I want to print number 0 to 9 in one line like this >0 1 2 3 4 5 6 7 8 9 > >if I do like this, it prints in different lines > >for i in xrange(10): >print i > > A comma at the end of the print will do what you want: for i in xrange(10): print i, >so i

Re: Standalone Python functions in UML?

2006-04-05 Thread Roman Susi
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Roman Susi > wrote: > > >>Out of curiosity, how do I draw functions outside classes with UML? How >>module could be drawn in this case? > > > I just create a (UML) class for modules. After all a Python module can be > seen as a class d

Re: PIL question about crop method

2006-04-05 Thread Diez B. Roggisch
John Salerno schrieb: > I might be way off target even looking into this method for what I need > to do, but I'm still a little confused about the description of it: > > crop > im.crop(box) => image > > Returns a rectangular region from the current image. The box is a > 4-tuple defining the lef

Re: kinterbas and Python

2006-04-05 Thread Jarek Zgoda
Petr Jakes napisał(a): > Jarek, I am using it always like in the following example to connect to > the remote host and it works for me flawlessly. > Petr Jakes > > import kinterbasdb as k > con = k.connect( > host='router.maren.cz', > database='/data/sysdat01.gdb', > us

Re: PIL question about crop method

2006-04-05 Thread Gary Herron
John Salerno wrote: >I might be way off target even looking into this method for what I need >to do, but I'm still a little confused about the description of it: > >crop >im.crop(box) => image > >Returns a rectangular region from the current image. The box is a >4-tuple defining the left, upper,

  1   2   3   >