Re: Blank Line at Program Exit

2009-08-23 Thread Hendrik van Rooyen
On Thursday 20 August 2009 07:31:14 Steven Woody wrote: > Hi, > Any python program, even that does absolutely nothing in the code, will > cause a blank line printed out when the program exit. What's the reason? not for me: h...@linuxbox:~/Sasol/lib> cat blank.py h...@linuxbox:~/Sasol/lib> pytho

Re: your favorite debugging tool?

2009-08-23 Thread Hendrik van Rooyen
On Saturday 22 August 2009 16:49:22 Aahz wrote: > In article , > > Esmail wrote: > >What is your favorite tool to help you debug your code? I've been > >getting along with 'print' statements but that is getting old and > >somewhat cumbersome. > > Despite the fact that I've been using Python for m

Re: your favorite debugging tool?

2009-08-23 Thread Robert Kern
On 2009-08-22 07:25 AM, Esmail wrote: Hi all, What is your favorite tool to help you debug your code? I've been getting along with 'print' statements but that is getting old and somewhat cumbersome. I'm primarily interested in utilities for Linux (but if you have recommendations for Windows, I'

conditional for-statement

2009-08-23 Thread seb
Hi, i was wondering if there is a syntax alike: for i in range(10) if i > 5: print i equivalent to for i in (for i in range(10) if i>5): print i sebastien -- http://mail.python.org/mailman/listinfo/python-list

Re: conditional for-statement

2009-08-23 Thread Benjamin Peterson
seb gmail.com> writes: > > Hi, > > i was wondering if there is a syntax alike: > > for i in range(10) if i > 5: > print i for i in range(10): if i > 5: print i -- http://mail.python.org/mailman/listinfo/python-list

Re: your favorite debugging tool?

2009-08-23 Thread Francesco Bochicchio
On Aug 22, 4:25 pm, Esmail wrote: > Hi all, > > What is your favorite tool to help you debug your > code? I've been getting along with 'print' statements > but that is getting old and somewhat cumbersome. > > I'm primarily interested in utilities for Linux (but > if you have recommendations for Wi

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread Dmitry A. Kazakov
On Sat, 22 Aug 2009 14:54:41 -0700 (PDT), James Harris wrote: > They look good - which is important. The trouble (for me) is that I > want the notation for a new programming language and already use these > characters. I have underscore as an optional separator for groups of > digits - 123000 and

Re: conditional for-statement

2009-08-23 Thread Francesco Bochicchio
On Aug 23, 10:09 am, seb wrote: > Hi, > > i was wondering if there is a syntax alike: > > for i in range(10) if i > 5: >     print i > > equivalent to > > for i in (for i in range(10) if i>5): >     print i > > sebastien AFAIK, no syntax fo that. But the standard syntax is not too different: for

Re: Annoying octal notation

2009-08-23 Thread Bearophile
MRAB: >'_': what if in the future we want to allow them in numbers for clarity? Hettinger says it's hard (= requires too many changes) to do that and Python programs don't have big integer constants often enough, so probably that improvement will not see the light. In the meantime in a Python pr

Re: IDLE file saving problem

2009-08-23 Thread Harald Luessen
On Fri, 21 Aug 2009 14:48:56 -0700 (PDT), r wrote: >On Aug 21, 4:10 pm, MRAB wrote: > >Yes, and much more needs improvement! I have made many changes already >and i am polishing an "IDLE 3000" for the good people of Pythonia, >stay tuned more to come There is a small little detail that nags

Re: conditional for-statement

2009-08-23 Thread David
Il Sun, 23 Aug 2009 01:09:04 -0700 (PDT), seb ha scritto: > Hi, > > i was wondering if there is a syntax alike: > > for i in range(10) if i > 5: > print i You can write for i in filter(lambda i: i > 5, range(10)): print i but for i in range(10): if i > 5: print i it' be

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread garabik-news-2005-05
In comp.lang.python James Harris wrote: > On 22 Aug, 10:27, David <71da...@libero.it> wrote: ... >> >> What about 2_1011, 8_7621, 16_c26h or 2;1011, 8;7621, 16;c26h ? > > They look good - which is important. The trouble (for me) is that I > want the notation for a new programming language and a

Re: logging SMTPhandler Error

2009-08-23 Thread Bev in TX
On Aug 23, 12:48 am, a...@pythoncraft.com (Aahz) wrote: > It's also not too difficult to do the moral equivalent with dnspython and > find the MX host for the domain you're trying to send e-mail to; that > usually does not require an encrypted connection. > -- > Aahz (a...@pythoncraft.com)        

Is Python what I need?

2009-08-23 Thread newbie
Hi all I'm interested in developing computer based, interactive programs for students in a special school who have an aversion to pen and paper. I've searched the net to find ready made software that will meet my needs but it is either written to a level much higher than these students can cope wit

Re: Is Python what I need?

2009-08-23 Thread Xavier Ho
On Sun, Aug 23, 2009 at 9:26 PM, newbie wrote: > Hi all > I'm interested in developing computer based, interactive programs for > students in a special school who have an aversion to pen and paper. What sort of interactive program? Would it be educational, for example? > I've searched the net

Re: your favorite debugging tool?

2009-08-23 Thread David
Il Sat, 22 Aug 2009 10:25:37 -0400, Esmail ha scritto: > > I use emacs as my primary development environment, FWIW. > Someone mentioned winpdb .. anyone have experience/comments > on this? Others? I use Winpdb on Windows and I feel quite comfortable. The interface is not so clever as more advanc

Combining python and perl

2009-08-23 Thread Peng Yu
Hi, According to http://www.python.org/doc/essays/comparisons.html, it says "Python and Perl come from a similar background (Unix scripting, which both have long outgrown), and sport many similar features, but have a different philosophy. Perl emphasizes support for common application- oriented t

Re: Combining python and perl

2009-08-23 Thread Albert Hopkins
On Sun, 2009-08-23 at 05:37 -0700, Peng Yu wrote: > Hi, > > According to http://www.python.org/doc/essays/comparisons.html, it > says > > "Python and Perl come from a similar background (Unix scripting, which > both have long outgrown), and sport many similar features, but have a > different phil

Re: Blank Line at Program Exit

2009-08-23 Thread Steven Woody
On Sat, Aug 22, 2009 at 11:25 PM, Nitebirdz wrote: > On Thu, Aug 20, 2009 at 01:31:14PM +0800, Steven Woody wrote: > > Hi, > > Any python program, even that does absolutely nothing in the code, will > > cause a blank line printed out when the program exit. What's the reason? > > Thanks. > > > >

How to distribute an application

2009-08-23 Thread Steven Woody
Hi, My application contains a main python source file as well as a set of modules (also .py files). Now, I am considering distribute my application to others. But the distutils seems made for distributing packages not for main applications. Am I right? Thanks. -- Life is the only flaw in an o

Re: Python/Fortran interoperability

2009-08-23 Thread viper-2
On Aug 23, 6:35 am, n...@cam.ac.uk wrote: > I am interested in surveying people who want to interoperate between > Fortran and Python to find out what they would like to be able to do > more conveniently, especially with regard to types not supported for C > interoperability by the current Fortran

Re: Dictionary from a list

2009-08-23 Thread Aahz
In article , EK wrote: >On Aug 20, 2:10=A0pm, Peter Otten <__pete...@web.de> wrote: >> >> >>> from itertools import izip >> >>> it =3D iter([1,2,3,4,5,6]) >> >>> dict(izip(it, it)) >> >> {1: 2, 3: 4, 5: 6} > >dict(zip(*[iter(l)]*2)) No, that's not a good solution. For starters, it's less reada

Re: Annoying octal notation

2009-08-23 Thread Matthew Woodcraft
Dennis Lee Bieber writes: > About the only place one commonly sees leading zeros on decimal > numbers, in my experience, is zero-filled COBOL data decks (and since > classic COBOL stores in BCD anyway... binary (usage is > computational/comp-1) was a later add-on to the data specification mo

Re: logging SMTPhandler Error

2009-08-23 Thread Aahz
In article <60de8d40-61f4-4ffd-bcef-749bf0667...@k19g2000yqn.googlegroups.com>, Bev in TX wrote: >On Aug 23, 12:48=A0am, a...@pythoncraft.com (Aahz) wrote: >> >> It's also not too difficult to do the moral equivalent with dnspython and >> find the MX host for the domain you're trying to send e-ma

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread Ben Finney
garabik-news-2005...@kassiopeia.juls.savba.sk writes: > Why not just use the space? 123 000 looks better than 123_000, and is > not syntactically ambiguous (at least in python). And as it already > works for string literals, it could be applied to numbers, too… +1 to all this. I think this discus

Re: Python/Fortran interoperability

2009-08-23 Thread Stefan Behnel
n...@cam.ac.uk wrote: > I am interested in surveying people who want to interoperate between > Fortran and Python to find out what they would like to be able to do > more conveniently, especially with regard to types not supported for C > interoperability by the current Fortran standard. Any sugge

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread J. Cliff Dyer
I had an objection to using spaces in numeric literals last time around and it still stands, and it still stands in the new one. What happens if you use a literal like 0x10f 304? Is 304 treated as decimal or hexadecimal? It's not clear how you would begin to combine it The way string concatena

IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile

2009-08-23 Thread Ryniek90
Hi I've got my backup script which opens tarfile for add chosen file to it. But while setting it up, i've got Traceback: here's the url: -->http://paste.ubuntu.com/258081/<-- I have searched among google's result but didn't found anything useful. Only found info that it may be the backslashes

Trying To Catch Invalid User Input

2009-08-23 Thread Victor Subervi
Hi; I have the following: style = raw_input('What style is this? (1 = short, 2 = long): ') flag = 0 while flag == 0: if (style != 1) or (style != 2): style = raw_input('There was a mistake. What style is this? (1 = short, 2 = long): ') else: flag = 1 I would think this would catch err

Most "active" coroutine library project?

2009-08-23 Thread Phillip B Oldham
I've been taking a look at the multitude of coroutine libraries available for Python, but from the looks of the projects they all seem to be rather "quiet". I'd like to pick one up to use on a current project but can't deduce which is the most popular/has the largest community. Libraries I looked

can python make web applications?

2009-08-23 Thread Deep_Feelings
can python make powerfull database web applications that can replace desktop database applications? e.g: entrprise accounting programs,enterprise human resource management programs ...etc -- http://mail.python.org/mailman/listinfo/python-list

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
On 23 Aug, 12:35, n...@cam.ac.uk wrote: > I am interested in surveying people who want to interoperate between > Fortran and Python to find out what they would like to be able to do > more conveniently, especially with regard to types not supported for C > interoperability by the current Fortran s

Re: Is Python what I need?

2009-08-23 Thread Peter Otten
newbie wrote: > I'm interested in developing computer based, interactive programs for > students in a special school who have an aversion to pen and paper. > I've searched the net to find ready made software that will meet my > needs but it is either written to a level much higher than these > stu

Re: Trying To Catch Invalid User Input

2009-08-23 Thread MRAB
Victor Subervi wrote: Hi; I have the following: style = raw_input('What style is this? (1 = short, 2 = long): ') flag = 0 while flag == 0: if (style != 1) or (style != 2): style = raw_input('There was a mistake. What style is this? (1 = short, 2 = long): ') else: flag = 1 I would

Re: Trying To Catch Invalid User Input

2009-08-23 Thread Gary Herron
Victor Subervi wrote: Hi; I have the following: style = raw_input('What style is this? (1 = short, 2 = long): ') flag = 0 while flag == 0: if (style != 1) or (style != 2): style = raw_input('There was a mistake. What style is this? (1 = short, 2 = long): ') else: flag = 1 I would

Re: Is Python what I need?

2009-08-23 Thread Tomasz Rola
On Sun, 23 Aug 2009, newbie wrote: > Hi all > I'm interested in developing computer based, interactive programs for > students in a special school who have an aversion to pen and paper. > I've searched the net to find ready made software that will meet my > needs but it is either written to a leve

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread bartc
wrote in message news:h6r4fb$18...@aioe.org... In comp.lang.python James Harris wrote: On 22 Aug, 10:27, David <71da...@libero.it> wrote: ... What about 2_1011, 8_7621, 16_c26h or 2;1011, 8;7621, 16;c26h ? They look good - which is important. The trouble (for me) is that I want the not

Re: generate keyboard/mouse event under windows

2009-08-23 Thread Scott David Daniels
Ray wrote: On Aug 19, 2:07 pm, yaka wrote: Read this and see if it helps: http://kvance.livejournal.com/985732.html is there a way to generate a 'true' keyboard event? (works like user pressed a key on keyboard) not send the 'send keyboard event to application' ? If there is such a spot, i

Re: Trying To Catch Invalid User Input

2009-08-23 Thread Albert Hopkins
On Sun, 2009-08-23 at 16:36 +0100, MRAB wrote: > Victor Subervi wrote: > > Hi; > > I have the following: > > > > style = raw_input('What style is this? (1 = short, 2 = long): ') > > flag = 0 > > while flag == 0: > > if (style != 1) or (style != 2): > > style = raw_input('There was a mistake.

Python-URL! - weekly Python news and links (Aug 23)

2009-08-23 Thread Gabriel Genellina
QOTW: "... [O]nce you accept that text is best handled in Unicode, there's little sense in making an exception for the limited subset that happens to be representable in ASCII." - Ben Finney http://groups.google.com/group/comp.lang.python/msg/accc8c2ae9d7ed15 Python 3.1.1 released:

Re: [Diversity] Language note

2009-08-23 Thread Cameron Laird
In article , Rami Chowdhury wrote: > >> Most indian languages have a different >> grammer (compared to English). So i'm curious to see how that would be >> implemented in a parser > >+1 -- I'd be interested in seeing this too, although we have drifted >OT here and perhaps this conversation woul

Re: conditional for-statement

2009-08-23 Thread John Posner
Hi, i was wondering if there is a syntax alike: for i in range(10) if i > 5: print i You can write for i in filter(lambda i: i > 5, range(10)): print i but for i in range(10): if i > 5: print i it' better readable, and for i in range(6,10): print i it's e

Re: Trying To Catch Invalid User Input

2009-08-23 Thread Victor Subervi
Really slick! Thanks! V On Sun, Aug 23, 2009 at 11:08 AM, Albert Hopkins wrote: > On Sun, 2009-08-23 at 16:36 +0100, MRAB wrote: > > Victor Subervi wrote: > > > Hi; > > > I have the following: > > > > > > style = raw_input('What style is this? (1 = short, 2 = long): ') > > > flag = 0 > > > while

Re: can python make web applications?

2009-08-23 Thread koranthala
On Aug 23, 8:12 pm, Deep_Feelings wrote: > can python make powerfull database web applications that can replace > desktop database applications? e.g: entrprise accounting > programs,enterprise human resource management programs ...etc Very much so. The web frameworks, Django & TurboGears are quit

[ANN] pyxser-1.2r --- Python-Object to XML serialization module

2009-08-23 Thread Daniel Molina Wegener
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello, I'm pleased to announce pyxser-1.2r, a Python-Object to XML serializer and deserializer. This module package it's completely written in C and licensed under LGPLv3. The tested Python versions are 2.5.X and 2.7.X. * home page:   http://coder

Re: Python/Fortran interoperability

2009-08-23 Thread JB
["Followup-To:" header set to comp.lang.fortran.] On 2009-08-23, n...@cam.ac.uk wrote: > > I am interested in surveying people who want to interoperate between > Fortran and Python to find out what they would like to be able to do > more conveniently, especially with regard to types not supported

Re: Most "active" coroutine library project?

2009-08-23 Thread Matthew Woodcraft
Phillip B Oldham writes: > I've been taking a look at the multitude of coroutine libraries > available for Python, but from the looks of the projects they all seem > to be rather "quiet". I'd like to pick one up to use on a current > project but can't deduce which is the most popular/has the larg

Re: Annoying octal notation

2009-08-23 Thread James Harris
On 21 Aug, 00:59, James Harris wrote: ... > > Is there some magic to make the 2.x CPython interpreter to ignore the > > annoying octal notation? > > I'd really like 012 to be "12" and not "10". > > This is (IMHO) a sad hangover from C (which took it from B ... This seemed worth writing up so I'

Re: Polling a net address

2009-08-23 Thread Aahz
In article <99ddf4e1-d327-4fb1-aee4-aa881de3b...@d23g2000vbm.googlegroups.com>, Iain wrote: > >I'm writing a system tray application for windows, and the app needs >to poll a remote site at a pre-defined interval, and then process any >data returned. > >The GUI needs to remain responsive as this

Re: can python make web applications?

2009-08-23 Thread Stefaan Himpe
Deep_Feelings wrote: can python make powerfull database web applications that can replace desktop database applications? e.g: entrprise accounting programs,enterprise human resource management programs ...etc In addition to the recommendations by other people, I'd like to recommend the very eas

Re: Python/Fortran interoperability

2009-08-23 Thread nmm1
In article , JB wrote: >["Followup-To:" header set to comp.lang.fortran.] Sorry - set back again, because you don't provide an Email address, and there's a significant issue. Thanks for the response. >> 1) Do you want to use character strings of arbitrary length? > >As in, a signed C int (

Re: Questions on XML

2009-08-23 Thread Rami Chowdhury
My problem is with IDLE on Windows. When I try to type Bangla directly into the IDLE window I only get '?' characters, and repr() fails with a UnicodeDecodeError. I expect, though, that that's because of my specific installation / Windows issues, as it works fine on Fedora 10... > I do not get

Re: Need cleanup advice for multiline string

2009-08-23 Thread Stefan Behnel
Simon Brunning wrote: > 2009/8/11 Robert Dailey: >> On Aug 11, 3:40 pm, Bearophile wrote: >>> There are gals too here. >> It's a figure of speech. And besides, why would I want programming >> advice from a woman? lol. Thanks for the help. > > Give the attitudes still prevalent in our industry (cf

Re: Need cleanup advice for multiline string

2009-08-23 Thread Stefan Behnel
Jean-Michel Pichavant wrote: > Grant Edwards wrote: >> On 2009-08-18, Simon Forman wrote: >>> Sexism, racism, homophobia, religious intolerance, etc., all >>> stem from a fundamental forgetfulness of our Unity in God (as >>> I would put it) and this is perhaps the single greatest cause >>> of huma

Re: Need cleanup advice for multiline string

2009-08-23 Thread Stefan Behnel
Mensanator wrote: > asking how many Jews you can fit into a Volswagen. None, because it's already full. (or "voll" as those who design Volkswagens would put it...) Stefan -- http://mail.python.org/mailman/listinfo/python-list

Is python faster than java?

2009-08-23 Thread Raimond Garcia
I'm building a large application, kind of fancy python but I'm concerned about speed. Cheers Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Combining python and perl

2009-08-23 Thread Peng Yu
On Aug 23, 8:00 am, Albert Hopkins wrote: > On Sun, 2009-08-23 at 05:37 -0700, Peng Yu wrote: > > Hi, > > > According tohttp://www.python.org/doc/essays/comparisons.html, it > > says > > > "Python and Perl come from a similar background (Unix scripting, which > > both have long outgrown), and spor

Re: Is python faster than java?

2009-08-23 Thread Emile van Sebille
On 8/23/2009 12:47 PM Raimond Garcia said... I'm building a large application, What kind of application? kind of fancy python but I'm concerned about speed. Speed of what? Development? User interaction? Responsiveness to queries? Mostly, you should worry about speed later. Writing it in p

web frameworks that support Python 3

2009-08-23 Thread David Prager Branner
I use Chinese and therefore Unicode very heavily, and so Python 3 is an unavoidable choice for me. But I'm frustrated by the fact that Django, Pylons, and TurboGears do not support Python 3 yet and (according to their development websites) will not for a very long time to come. So I am asking for

Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile

2009-08-23 Thread Erik Max Francis
Ryniek90 wrote: I've got my backup script which opens tarfile for add chosen file to it. But while setting it up, i've got Traceback: here's the url: -->http://paste.ubuntu.com/258081/<-- I have searched among google's result but didn't found anything useful. Only found info that it may be the

Re: web frameworks that support Python 3

2009-08-23 Thread Albert Hopkins
On Sun, 2009-08-23 at 13:13 -0700, David Prager Branner wrote: > I use Chinese and therefore Unicode very heavily, and so Python 3 is > an unavoidable choice for me. But I'm frustrated by the fact that > Django, Pylons, and TurboGears do not support Python 3 yet and > (according to their developmen

Re: web frameworks that support Python 3

2009-08-23 Thread Sebastian Wiesner
At Sunday 23 August 2009 22:13:16 you wrote: > I use Chinese and therefore Unicode very heavily, and so Python 3 is > an unavoidable choice for me. Python 2.x supports Unicode just as well as Python 3. Every common web framework works perfectly with unicode. In any case, there is bottle [1], whi

Re: Combining python and perl

2009-08-23 Thread Albert Hopkins
On Sun, 2009-08-23 at 12:54 -0700, Peng Yu wrote: > I understand that the sames things can be done with both language. > > But I do think that certain applications can be done faster (in term > of the coding & debugging time, I don't care runtime here) with one > language than with another. Yes

Re: conditional for-statement

2009-08-23 Thread seb
On Aug 23, 6:18 pm, John Posner wrote: > >> Hi, > > >> i was wondering if there is a syntax alike: > > >> for i in range(10) if i > 5: > >>     print i > > > You can write > > > for i in filter(lambda i: i > 5, range(10)): > >     print i > > > but > > > for i in range(10): > >     if i > 5: > >  

Re: web frameworks that support Python 3

2009-08-23 Thread Stefan Behnel
David Prager Branner wrote: > I use Chinese and therefore Unicode very heavily, and so Python 3 is > an unavoidable choice for me. As others noted before, this statement is not true by itself. > But I'm frustrated by the fact that > Django, Pylons, and TurboGears do not support Python 3 yet and

Re: can python make web applications?

2009-08-23 Thread Goke Aruna
A lot check this fantastic open source application, http://www.openerp.com, all done is python. On 8/23/09, Stefaan Himpe wrote: > Deep_Feelings wrote: >> can python make powerfull database web applications that can replace >> desktop database applications? e.g: entrprise accounting >> programs,e

Re: Is python faster than java?

2009-08-23 Thread Raimond Garcia
Makes sense. +1 Cheers Peter On Sun, Aug 23, 2009 at 9:59 PM, Emile van Sebille wrote: > On 8/23/2009 12:47 PM Raimond Garcia said... > >> I'm building a large application, >> > > What kind of application? > > kind of fancy python but I'm concerned about speed. >> > > Speed of what? Develop

Re: conditional for-statement

2009-08-23 Thread seb
On Aug 23, 10:36 pm, seb wrote: > On Aug 23, 6:18 pm, John Posner wrote: > > > > > > > >> Hi, > > > >> i was wondering if there is a syntax alike: > > > >> for i in range(10) if i > 5: > > >>     print i > > > > You can write > > > > for i in filter(lambda i: i > 5, range(10)): > > >     print i

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread James Harris
On 23 Aug, 04:38, c...@tiac.net (Richard Harter) wrote: > On Sat, 22 Aug 2009 14:54:41 -0700 (PDT), James Harris > > > > > > wrote: > >On 22 Aug, 10:27, David <71da...@libero.it> wrote: > > >... (snipped a discussion on languages and other systems interpreting > >numbers with a leading zero as oct

Re: conditional for-statement

2009-08-23 Thread Chris Rebert
On Sun, Aug 23, 2009 at 1:36 PM, seb wrote: > On Aug 23, 6:18 pm, John Posner wrote: >> >> Hi, >> >> >> i was wondering if there is a syntax alike: >> >> >> for i in range(10) if i > 5: >> >>     print i >> >> > You can write >> >> > for i in filter(lambda i: i > 5, range(10)): >> >     print i >>

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread James Harris
On 23 Aug, 00:16, Mel wrote: > James Harris wrote: > > I have no idea why Ada which uses the # also apparently uses it to end > > a number > > >   2#1011#, 8#7621#, 16#c26b# > > Interesting.  They do it because of this example from >

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread James Harris
On 23 Aug, 21:55, James Harris wrote: ... > >  However for floating point you > > need at least three letters because a floating point number has > > three parts: the fixed point point, the exponent base, and the > > exponent.  Now we can represent the radices of the individual > > parts with th

__import__(x) VS __import__(x, {}, {}, [''])

2009-08-23 Thread Phil
I am trying to understand the difference between __import__(x) and __import__(x, {}, {}, ['']). The documentations wording was a bit weird for me to understand: "The standard implementation does not use its locals argument at all, and uses its globals only to determine the package context of the i

What is the recommended library for xml parsing?

2009-08-23 Thread Raimond Garcia
Is there a good build in library or should I use a third party one? Cheers, Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: conditional for-statement

2009-08-23 Thread Mel
seb wrote: > On Aug 23, 6:18 pm, John Posner wrote: [ ... ] >> How about using a generator expression instead of a list? >> >> for i in (x for x in range(10) if x > 5): >> print i >> >> -John > > Indeed, but we could have the same syntax than for generators but > directly in the for statement as

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread MRAB
James Harris wrote: On 23 Aug, 00:16, Mel wrote: James Harris wrote: I have no idea why Ada which uses the # also apparently uses it to end a number 2#1011#, 8#7621#, 16#c26b# Interesting. They do it because of this example from

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread Scott David Daniels
James Harris wrote:... Another option: 0.(2:1011), 0.(8:7621), 0.(16:c26b) where the three characters "0.(" begin the sequence. Comments? Improvements? I did a little interpreter where non-base 10 numbers (up to base 36) were: .7.100 == 64 (octal) .9.100 == 100 (decimal)

Re: logging SMTPhandler Error

2009-08-23 Thread Aahz
In article , Dennis Lee Bieber wrote: >On 23 Aug 2009 06:14:00 -0700, a...@pythoncraft.com (Aahz) declaimed the >following in gmane.comp.python.general: >> >> Slightly expanded: most mail servers accept connections from any other >> mail server for addresses that are hosted by them. The MX addre

Re: What is the recommended library for xml parsing?

2009-08-23 Thread Chris Rebert
On Sun, Aug 23, 2009 at 3:07 PM, Raimond Garcia wrote: > Is there a good build in library or should I use a third party one? xml.etree.ElementTree: http://docs.python.org/library/xml.etree.elementtree.html Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/pytho

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread bartc
"Scott David Daniels" wrote in message news:kn2dnszr5b0bwazxnz2dnuvz_s-dn...@pdx.net... James Harris wrote:... Another option: 0.(2:1011), 0.(8:7621), 0.(16:c26b) where the three characters "0.(" begin the sequence. Comments? Improvements? I did a little interpreter where non-base 10 n

Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile

2009-08-23 Thread John Machin
Erik Max Francis alcyone.com> writes: > > Ryniek90 wrote: > > Is its the '|\U' literal fault in path '|C:\\Users\\Ryniek's > > WinSe7en\\MyNewGGBackup(2009-08-23 14:59:02).tar.bz2|' ? What is "the '|\U' literal fault" ??? > > It's probably a misleading error from the OS; I would guess the p

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
On 23 Aug, 20:42, n...@cam.ac.uk wrote: > That is precisely what I am investigating.  TR 29113 falls a LONG > way before it gets to any of the OOP data - indeed, you can't even > pass OOP derived types as pure data (without even the functionality) > in its model.  Nor most of what else Python woul

Newbie: list comprehension troubles..

2009-08-23 Thread mm
Hi, I'm trying to replace this... # this works but there must be a more pythonic way, right? tlist = [] for obj in self.objs: t = obj.intersect(ray) if (t != None): tlist.append((obj,t)) with a list comprehension- can it be done? Wh

Re: Newbie: list comprehension troubles..

2009-08-23 Thread Chris Rebert
On Sun, Aug 23, 2009 at 4:27 PM, mm wrote: > Hi, I'm trying to replace this... > >        # this works but there must be a more pythonic way, right? >        tlist = [] >        for obj in self.objs: >            t = obj.intersect(ray) >            if (t != None): >                tlist.append((obj

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
On 24 Aug, 00:02, Dennis Lee Bieber wrote: >         That's a C language problem -- since a string in C is just an array > of character. The last FORTRAN dialect (and implementation) I used > passed strings On 24 Aug, 00:02, Dennis Lee Bieber wrote: > values -- FORTRAN strings were typically s

Re: Newbie: list comprehension troubles..

2009-08-23 Thread Terry Reedy
Chris Rebert wrote: On Sun, Aug 23, 2009 at 4:27 PM, mm wrote: Hi, I'm trying to replace this... # this works but there must be a more pythonic way, right? 'Pythonic' is readable, if nothing else tlist = [] for obj in self.objs: t = obj.intersect(ray)

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
On 24 Aug, 01:59, sturlamolden wrote: > subroutine foobar(cstr) bind(c, name='foobar') >     use, intrinsic :: iso_c_binding >     type(c_ptr) :: cstr >     character(*), pointer :: fstr >     call c_f_pointer(cptr, fptr) > Which means that you can write a wrapper in Fortran callable from C, tha

Re: Newbie: list comprehension troubles..

2009-08-23 Thread Ben Finney
Chris Rebert writes: > tlist = [pair for pair in ((obj, obj.intersect(ray)) for obj in > self.objs) if pair[1] is not None] > > Should it be done? Probably not. [Compared to a ‘for’ suite with an > ‘if’ suite, it's] less readable and less efficient. I disagree on the “less efficient”, unless you

Protecting against callbacks queuing up?

2009-08-23 Thread Esben von Buchwald
Hello I'm using Python for S60 1.9.7 on my Nokia phone. I've made a program that gets input from an accelerometer sensor, and then calculates some stuff and displays the result. The sensor framework API does a callback to a function defined by me, every time new data is available. The prob

Re: Need cleanup advice for multiline string

2009-08-23 Thread Steven D'Aprano
On Sun, 23 Aug 2009 20:52:16 +0200, Stefan Behnel wrote: > Simon Brunning wrote: >> 2009/8/11 Robert Dailey: >>> On Aug 11, 3:40 pm, Bearophile wrote: There are gals too here. >>> It's a figure of speech. And besides, why would I want programming >>> advice from a woman? lol. Thanks for the h

Re: Protecting against callbacks queuing up?

2009-08-23 Thread MRAB
Esben von Buchwald wrote: Hello I'm using Python for S60 1.9.7 on my Nokia phone. I've made a program that gets input from an accelerometer sensor, and then calculates some stuff and displays the result. The sensor framework API does a callback to a function defined by me, every time new da

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
On 24 Aug, 02:26, nos...@see.signature (Richard Maine) wrote: > You missed the word "OOP", which seemed like the whole point. Not that > the particular word is used in the Fortran standard, but it isn't hard > to guess that he means a derived type that uses some of the OOP > features. Inheritance,

Re: install package in a particular python version

2009-08-23 Thread David Lyon
On Thu, 20 Aug 2009 20:53:18 -0700 (PDT), Steve1234 wrote: > Benjamin suggested: > sudo python2.5 setup.py install > and it works. This makes sense, thanks. > > I downloaded pythonpkgmgr from source and installed it. I got the > error that reguired wx package was missing. I couldn't find this

Re: Newbie: list comprehension troubles..

2009-08-23 Thread Chris Rebert
On Sun, Aug 23, 2009 at 5:09 PM, Ben Finney wrote: > Chris Rebert writes: > >> tlist = [pair for pair in ((obj, obj.intersect(ray)) for obj in >> self.objs) if pair[1] is not None] >> >> Should it be done? Probably not. [Compared to a ‘for’ suite with an >> ‘if’ suite, it's] less readable and less

Re: Python/Fortran interoperability

2009-08-23 Thread Richard Maine
sturlamolden wrote: > On 24 Aug, 02:26, nos...@see.signature (Richard Maine) wrote: > > > You missed the word "OOP", which seemed like the whole point. Not that > > the particular word is used in the Fortran standard, but it isn't hard > > to guess that he means a derived type that uses some of

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread Max Erickson
"bartc" wrote: > > "Scott David Daniels" wrote in message > news:kn2dnszr5b0bwazxnz2dnuvz_s-dn...@pdx.net... >> James Harris wrote:... >>> Another option: > > It can be assumed however that .9. isn't in binary? > > That's a neat idea. But an even simpler scheme might be: > > .octal.100 > .d

Re: What is the recommended library for xml parsing?

2009-08-23 Thread Raimond Garcia
+1 ::results:: Cheers, Peter Petrelli On Mon, Aug 24, 2009 at 12:59 AM, Chris Rebert wrote: > On Sun, Aug 23, 2009 at 3:07 PM, Raimond Garcia > wrote: > > Is there a good build in library or should I use a third party one? > > xml.etree.ElementTree: > http://docs.python.org/library/xml.etre

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
On 24 Aug, 01:59, sturlamolden wrote: > subroutine foobar(cstr) bind(c, name='foobar') >     use, intrinsic :: iso_c_binding >     type(c_ptr) :: cstr >     character(*), pointer :: fstr >     call c_f_pointer(cptr, fptr) Actually, this does not work, as it is illegal to create a pointer to a ch

Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile

2009-08-23 Thread Dave Angel
John Machin wrote: Erik Max Francis alcyone.com> writes: Ryniek90 wrote: Is its the '|\U' literal fault in path '|C:\\Users\\Ryniek's WinSe7en\\MyNewGGBackup(2009-08-23 14:59:02).tar.bz2|' ? What is "the '|\U' literal fault" ??? It's probably a misleading error from

Re: Python/Fortran interoperability

2009-08-23 Thread sturlamolden
On 24 Aug, 02:57, nos...@see.signature (Richard Maine) wrote: > Yes, it is no surprise that the C interop stuff fails to address this, > since it isn't in C. Something different/extra would be needed, which is > exactly what Nick said. I'm going to jump out of the middle of this now. > The only re

  1   2   >