Re: why any( ) instead of firsttrue( ) ?

2010-06-08 Thread Raymond Hettinger
On Jun 8, 2:16 pm, danieldelay wrote: >    def firsttrue(iterable): >      for element in iterable: >          if element: >              return element >      return None > > This function "firsttrue( )" could probably be used anywhere "any( )" is > used, but with the ability to retrieve the firs

Re: GUIs - A Modest Proposal

2010-06-08 Thread Gregory Ewing
Kevin Walzer wrote: PyGUI ... certainly is *not* a lightweight GUI toolkit that could easily be incorporated into the Python core library--it instead has rather complex dependencies on both other GUI toolkits and Python wrappers of those toolkits. I don't see how the dependencies could be reg

Re: GUIs - A Modest Proposal

2010-06-08 Thread geremy condra
On Wed, Jun 9, 2010 at 2:12 AM, Robert Kern wrote: > On 6/9/10 1:12 AM, rantingrick wrote: >> But you know i think it boils down to fear really. He is comfortable >> in his life and wishes to keep it as cookie cutter as he can. Any >> outside influence must be quashed before these meddling forc

Re: GUIs - A Modest Proposal

2010-06-08 Thread Robert Kern
On 6/9/10 1:12 AM, rantingrick wrote: On Jun 8, 10:09 pm, Robert Kern wrote: It means that he, very charitably, gives new irritants the benefit of the doubt. By changing identities, you are abusing this good behavior. By connecting your identity to the previous one, his doubt is removed. And

Re: GUIs - A Modest Proposal

2010-06-08 Thread Steven D'Aprano
On Tue, 08 Jun 2010 16:58:26 -0700, rantingrick wrote: > We have a problem You keep saying that, but you've given no good reasons for why we should believe you, or what the nature of this problem supposedly is. The current situation has broad community support: there's a relatively lightweigh

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread Steven D'Aprano
On Wed, 09 Jun 2010 02:45:36 +, Deadly Dirk wrote: > On Tue, 08 Jun 2010 18:52:44 -0700, alex23 wrote: > > >> Unless you have a clear need for 3rd party libraries that currently >> don't have 3.x versions, starting with Python 3 isn't a bad idea. > > From what I see, most of the people are

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread MRAB
Deadly Dirk wrote: On Tue, 08 Jun 2010 18:52:44 -0700, alex23 wrote: Unless you have a clear need for 3rd party libraries that currently don't have 3.x versions, starting with Python 3 isn't a bad idea. From what I see, most of the people are still using Python 2.x. My reason for learning P

Re: Non Sequitur: Re: Python Forum

2010-06-08 Thread MRAB
Mark Young wrote: According to the Oxford Dictionary: *fish** noun **, **verb *noun *(**pl.**fish** or **fishes**)*Fish is the usual plural form. The older form, fishes, can be used to refer to different kinds of

Re: how to get a reference to the "__main__" module

2010-06-08 Thread Steven D'Aprano
On Tue, 08 Jun 2010 22:29:04 -0700, WH wrote: > Hi, > > I want to use one of two functions in a script: > > def func_one(): pass > def func_two(): pass > > func = getattr(x, 'func_'+number) > func() > > 'x' in getattr() should be a reference to the "__main__" module, right? > How to get it?

Re: how to get a reference to the "__main__" module

2010-06-08 Thread Chris Rebert
On Tue, Jun 8, 2010 at 10:29 PM, WH wrote: > Hi, > > I want to use one of two functions in a script: > > def func_one(): pass > def func_two(): pass > > func = getattr(x, 'func_'+number) > func() > > 'x' in getattr() should be a reference to the "__main__" module, right? >  How to get it? from sy

how to get a reference to the "__main__" module

2010-06-08 Thread WH
Hi, I want to use one of two functions in a script: def func_one(): pass def func_two(): pass func = getattr(x, 'func_'+number) func() 'x' in getattr() should be a reference to the "__main__" module, right? How to get it? The 'if' clause should work here. I am just curious if we can use the

Re: GUIs - A Modest Proposal

2010-06-08 Thread rantingrick
On Jun 8, 10:09 pm, Robert Kern wrote: > It means that he, very charitably, gives new irritants the benefit of the > doubt. > By changing identities, you are abusing this good behavior. By connecting your > identity to the previous one, his doubt is removed. And again you miss the very meat and

Re: GUIs - A Modest Proposal

2010-06-08 Thread geremy condra
On Tue, Jun 8, 2010 at 9:29 PM, Steven D'Aprano wrote: > On Tue, 08 Jun 2010 18:12:05 -0700, geremy condra wrote: > >> I didn't argue that Tcl is bad. I argued that a dependency on it is bad >> for python. Would you argue that Python should ship with Perl and Java >> because there are best-of-bree

Re: GUIs - A Modest Proposal

2010-06-08 Thread Steven D'Aprano
On Tue, 08 Jun 2010 18:12:05 -0700, geremy condra wrote: > I didn't argue that Tcl is bad. I argued that a dependency on it is bad > for python. Would you argue that Python should ship with Perl and Java > because there are best-of-breed tools in those languages and python > could leverage that? O

Re: introducing Lettuce, BDD tool for python with Django integration

2010-06-08 Thread alex23
Tycho Andersen wrote: > I think his point may have been that there could be more than one > meaning. My first guess would have been binary decision diagram. Ah, good point. My apologies for the dig, Terry :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread alex23
Deadly Dirk wrote: > From what I see, most of the people are still using Python 2.x. My reason > for learning Python is the fact that my CTO decided that the new company > standard for scripting languages will be Python. I've been using Perl for > 15 years and it was completely adequate but, appar

Re: introducing Lettuce, BDD tool for python with Django integration

2010-06-08 Thread Tycho Andersen
On Tue, Jun 8, 2010 at 9:18 PM, alex23 wrote: > On Jun 9, 3:29 am, Terry Reedy wrote: >> On 6/8/2010 2:26 AM, Gabriel Falcão wrote: >> > There is not much to say, >> except to explain 'BDD'. > > If only there was some kind of way to quickly look up the meaning of > definitions, preferably one kno

Re: updating NumPy in EPD

2010-06-08 Thread Nick Matzke
Hi again, I got the solution on the NumPy list, I thought I would share for posterity... Jeff Hsu wrote: > Check which version of numpy python is importing with "import numpy; > printnumpy.__file__". I had a similar question and this worked after I > removed that installation of numpy. I

Re: updating NumPy in EPD

2010-06-08 Thread Robert Kern
On 6/8/10 8:05 PM, Nick Matzke wrote: Hi all, I have a slightly weird question. I would like to install the PyCogent library. However, this requires NumPy 1.3 or higher. I only have NumPy 1.1.1, because I got it as part of the Enthought Python Distribution (4.1) back in 2008. Now, when I downlo

Re: GUIs - A Modest Proposal

2010-06-08 Thread Robert Kern
On 6/8/10 10:20 PM, rantingrick wrote: On Jun 8, 8:35 pm, Ben Finney wrote: Yes, thank you, Steven, for identifying this irritant. I'll add identity-hopping to the list of offenses, and add this new identity to my kill-file. So you put up with my antics fine up until you learned of my past i

Re: why any( ) instead of firsttrue( ) ?

2010-06-08 Thread Carl Banks
On Jun 8, 4:08 pm, danieldelay wrote: > Le 09/06/2010 00:24, Ian Kelly a crit : > > > Because it was designed as a replacement for "reduce(lambda x, y: x or > > y, iterable)".  The problem arises when the iterable is empty.  What > > false value should be returned?  If the iterable is a sequence o

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread Deadly Dirk
On Tue, 08 Jun 2010 18:52:44 -0700, alex23 wrote: > Unless you have a clear need for 3rd party libraries that currently > don't have 3.x versions, starting with Python 3 isn't a bad idea. >From what I see, most of the people are still using Python 2.x. My reason for learning Python is the fact

Re: Non Sequitur: Re: Python Forum

2010-06-08 Thread rantingrick
On Jun 8, 9:00 pm, Jack Diederich wrote: > On Tue, Jun 8, 2010 at 6:47 PM, Mark Young wrote: > > According to the Oxford Dictionary: > > > fish noun, verb noun (pl.fish or fishes)Fish is the usual plural form. The > > older form, fishes, can be used to refer to different kinds of fish... > > > Ho

Re: GUIs - A Modest Proposal

2010-06-08 Thread rantingrick
On Jun 8, 8:35 pm, Ben Finney wrote: > Yes, thank you, Steven, for identifying this irritant. I'll add > identity-hopping to the list of offenses, and add this new identity to > my kill-file. So you put up with my antics fine up until you learned of my past identity. So now i am somehow so annoy

Re: introducing Lettuce, BDD tool for python with Django integration

2010-06-08 Thread alex23
On Jun 9, 3:29 am, Terry Reedy wrote: > On 6/8/2010 2:26 AM, Gabriel Falcão wrote: > > There is not much to say, > except to explain 'BDD'. If only there was some kind of way to quickly look up the meaning of definitions, preferably one known to people of the programming persuasion... -- http:/

Re: capitalize() NOT the same as var[0].upper _ var[1:]

2010-06-08 Thread alex23
James Mills wrote: > The behavior you've demonstrated is "exactly" what the documentation > says the .capitalize() method does. Look on the plus side, at least it's not yet another question on SQL parameters & Python string substitutions. I'm amazed at the endless willingness of this group to he

Re: Non Sequitur: Re: Python Forum

2010-06-08 Thread Jack Diederich
On Tue, Jun 8, 2010 at 6:47 PM, Mark Young wrote: > According to the Oxford Dictionary: > > fish noun, verb noun (pl.fish or fishes)Fish is the usual plural form. The > older form, fishes, can be used to refer to different kinds of fish... > > However, I would correct anyone that ever used "fishes

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread alex23
Deadly Dirk wrote: > The book covers Python3 but my understanding was that it should also > cover Python 2.5 and 2.6. The "SECOND EDITION Covers Python 3" banner across the top of the cover would seem to indicate otherwise. The first line of the About section confirms it: "This book is intended

Re: GUIs - A Modest Proposal

2010-06-08 Thread geremy condra
On Tue, Jun 8, 2010 at 6:20 PM, Adam Tauno Williams wrote: > On Tue, 2010-06-08 at 18:12 -0700, geremy condra wrote: >> > * IronPython relies on the .Net environment for everything >> Since .Net (effectively) depends on Windows, > > 100% False;  not "effectively" true at all.  I run [and develop]

Re: GUIs - A Modest Proposal

2010-06-08 Thread rantingrick
On Jun 8, 7:15 pm, Kevin Walzer wrote: > On 6/8/10 7:58 PM, rantingrick wrote: > > > The same people who would fight > > to the death to protect Tkinter's existence in the stdlib never use > > the library anyway and personally hate it! > > I want to keep it in the stdlib because I use it for all m

Re: GUIs - A Modest Proposal

2010-06-08 Thread Ben Finney
rantingrick writes: > On Jun 8, 5:38 am, Steven D'Aprano cybersource.com.au> wrote: > > > Hmmm... there's something terribly familiar about this style of > > speech... rantingrick, did you used to post under the name "r" using > > an gmail account starting with "rt8"? > > Steven, i've always tho

Re: GUIs - A Modest Proposal

2010-06-08 Thread Adam Tauno Williams
On Tue, 2010-06-08 at 16:58 -0700, rantingrick wrote: > We have a problem No, we don't. Or at least, I don't. > """I don't use Tkinter so i don't care! +1 > ... well just keep your negativity to yourself. When you have real > solutions or real ideas that could foster real solutions then

Re: GUIs - A Modest Proposal

2010-06-08 Thread Adam Tauno Williams
On Tue, 2010-06-08 at 18:12 -0700, geremy condra wrote: > > * IronPython relies on the .Net environment for everything > Since .Net (effectively) depends on Windows, 100% False; not "effectively" true at all. I run [and develop] .NET applications on LINUX every day. IL and the CLR are standards

Re: GUIs - A Modest Proposal

2010-06-08 Thread rantingrick
On Jun 8, 5:38 am, Steven D'Aprano wrote: > Hmmm... there's something terribly familiar about this style of speech... > rantingrick, did you used to post under the name "r" using an gmail > account starting with "rt8"? Steven, i've always thought of you as one of the more intelligent readers of

Re: GUIs - A Modest Proposal

2010-06-08 Thread geremy condra
On Tue, Jun 8, 2010 at 4:46 PM, Steven D'Aprano wrote: > On Tue, 08 Jun 2010 15:40:51 -0700, geremy condra wrote: > >> On Tue, Jun 8, 2010 at 3:09 PM, Lie Ryan wrote: > >>> Nobody complains that python included a regular expression engine in >>> its standard distribution; so why complain that pyt

Re: why any( ) instead of firsttrue( ) ?

2010-06-08 Thread Tim Chase
On 06/08/2010 06:18 PM, MRAB wrote: danieldelay wrote: firsttrue(line.strip() for line in '\n\n \n CHEERS \n'.split('\n')) Should 'firsttrue' return None? Surely, if none are true then it should raise an exception. which can fairly elegantly be written with stock-Python as # try: resu

Re: GUIs - A Modest Proposal

2010-06-08 Thread Mark Lawrence
On 09/06/2010 00:58, rantingrick wrote: On Jun 8, 5:40 pm, geremy condra wrote: On Tue, Jun 8, 2010 at 3:09 PM, Lie Ryan wrote: On 06/09/10 01:17, bart.c wrote: "Grant Edwards" wrote in message news:hullf3$hl...@reader1.panix.com... On 2010-06-08, Kevin Walzer wrote: Since Tk already

Re: GUIs - A Modest Proposal

2010-06-08 Thread Kevin Walzer
On 6/8/10 7:58 PM, rantingrick wrote: The same people who would fight to the death to protect Tkinter's existence in the stdlib never use the library anyway and personally hate it! I want to keep it in the stdlib because I use it for all my apps, and personally prefer it to any other GUI toolk

Re: updating NumPy in EPD

2010-06-08 Thread Nick Matzke
Oh yes -- I would just update my version of EPD, which is where my NumPy came from -- however, Enthought only has available for academic download a version of EPD that works on OS X 10.5 or later, and my Mac is a 10.4.11 and I'd rather not completely reinstall the OS just to get one little lib

updating NumPy in EPD

2010-06-08 Thread Nick Matzke
Hi all, I have a slightly weird question. I would like to install the PyCogent library. However, this requires NumPy 1.3 or higher. I only have NumPy 1.1.1, because I got it as part of the Enthought Python Distribution (4.1) back in 2008. Now, when I download & install a new version of Nu

Re: GUIs - A Modest Proposal

2010-06-08 Thread rantingrick
On Jun 8, 5:40 pm, geremy condra wrote: > On Tue, Jun 8, 2010 at 3:09 PM, Lie Ryan wrote: > > On 06/09/10 01:17, bart.c wrote: > > >> "Grant Edwards" wrote in message > >>news:hullf3$hl...@reader1.panix.com... > >>> On 2010-06-08, Kevin Walzer wrote: > > Since Tk already provides a basic G

Re: GUIs - A Modest Proposal

2010-06-08 Thread Kevin Walzer
On 6/8/10 7:16 PM, Kevin Walzer wrote: On 6/8/10 6:09 PM, Lie Ryan wrote: Much like regex a DSL for matching text, Tcl/Tk is pretty much a DSL for creating GUI (anyone knows any real program fully written in non-embedded Tcl?). http://www.amsn-project.net/ http://snackamp.sourceforge.net/ http

Re: GUIs - A Modest Proposal

2010-06-08 Thread Grant Edwards
On 2010-06-08, Martin v. Loewis wrote: > Am 08.06.2010 20:15, schrieb Grant Edwards: >> On 2010-06-08, Martin v. Loewis wrote: TkInter -> Tcl -> Tk -> Xlib Is the Tcl intepreter really need to use this GUI? Why not: (Pyton ->) Tkinter-API -> Xlib ? >>> >>> Even if thi

Re: GUIs - A Modest Proposal

2010-06-08 Thread Steven D'Aprano
On Tue, 08 Jun 2010 15:40:51 -0700, geremy condra wrote: > On Tue, Jun 8, 2010 at 3:09 PM, Lie Ryan wrote: >> Nobody complains that python included a regular expression engine in >> its standard distribution; so why complain that python included a Tcl >> expression engine in its standard distrib

Re: GUIs - A Modest Proposal

2010-06-08 Thread Kevin Walzer
On 6/8/10 6:09 PM, Lie Ryan wrote: Much like regex a DSL for matching text, Tcl/Tk is pretty much a DSL for creating GUI (anyone knows any real program fully written in non-embedded Tcl?). http://www.amsn-project.net/ http://snackamp.sourceforge.net/ http://www.svi.nl/ http://installbuilder.bit

Re: why any( ) instead of firsttrue( ) ?

2010-06-08 Thread MRAB
danieldelay wrote: Le 09/06/2010 00:24, Ian Kelly a écrit : Because it was designed as a replacement for "reduce(lambda x, y: x or y, iterable)". The problem arises when the iterable is empty. What false value should be returned? If the iterable is a sequence of bools, then None doesn't fit.

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread Deadly Dirk
On Wed, 09 Jun 2010 00:25:01 +0200, Thomas Jollans wrote: > Yes, that will work, but you should really install Python 3.1 (it's in > ubuntu, as others have said!) because you will almost certainly hit into > other snags. Not as obvious as this one, but they are there. You can > work around all of

Re: why any( ) instead of firsttrue( ) ?

2010-06-08 Thread danieldelay
Le 09/06/2010 00:24, Ian Kelly a écrit : Because it was designed as a replacement for "reduce(lambda x, y: x or y, iterable)". The problem arises when the iterable is empty. What false value should be returned? If the iterable is a sequence of bools, then None doesn't fit. If the iterable is

Re: GUIs - A Modest Proposal

2010-06-08 Thread Martin v. Loewis
Am 08.06.2010 20:15, schrieb Grant Edwards: On 2010-06-08, Martin v. Loewis wrote: TkInter -> Tcl -> Tk -> Xlib Is the Tcl intepreter really need to use this GUI? Why not: (Pyton ->) Tkinter-API -> Xlib ? Even if this was possible (which it is not) Why is it not possible? It seems to

[ANNC] pynguin-0.8 python turtle graphics application

2010-06-08 Thread Lee Harr
Pynguin is a python-based turtle graphics application.     It combines an editor, interactive interpreter, and     graphics display area. It is meant to be an easy environment for introducing     some programming concepts to beginning programmers. http://pynguin.googlecode.com/ This release c

Re: Non Sequitur: Re: Python Forum

2010-06-08 Thread Mark Young
According to the Oxford Dictionary: *fish** noun **, **verb *noun *(**pl.**fish** or **fishes**) *Fish is the usual plural form. The older form, fishes, can be used to refer to different kinds of fish... However, I wo

Re: GUIs - A Modest Proposal

2010-06-08 Thread geremy condra
On Tue, Jun 8, 2010 at 3:09 PM, Lie Ryan wrote: > On 06/09/10 01:17, bart.c wrote: >> >> "Grant Edwards" wrote in message >> news:hullf3$hl...@reader1.panix.com... >>> On 2010-06-08, Kevin Walzer wrote: >>> Since Tk already provides a basic GUI toolset, and Python can interface with it

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread Thomas Jollans
On 06/09/2010 12:04 AM, Deadly Dirk wrote: > On Tue, 08 Jun 2010 21:44:18 +, Deadly Dirk wrote: > > >> I am a total beginner with Python. I am reading a book ("The Quick >> Python Book", 2nd edition, by Vernon Ceder) which tells me that print >> function takes end="" argument not to print ne

Re: GUIs - A Modest Proposal

2010-06-08 Thread Martin P. Hellwig
On 06/08/10 22:14, Ethan Furman wrote: Grant Edwards wrote: On 2010-06-08, Martin v. Loewis wrote: TkInter -> Tcl -> Tk -> Xlib Is the Tcl intepreter really need to use this GUI? Why not: (Pyton ->) Tkinter-API -> Xlib ? Even if this was possible (which it is not) Why is it not possible?

Re: why any( ) instead of firsttrue( ) ?

2010-06-08 Thread Ian Kelly
On Tue, Jun 8, 2010 at 3:16 PM, danieldelay wrote: > This function "firsttrue( )" could probably be used anywhere "any( )" is > used, but with the ability to retrieve the first element where bool(element) > is True, which may be sometimes usefull. > > I suppose that there is a reason for that, doe

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread Lie Ryan
On 06/09/10 07:44, Deadly Dirk wrote: > I am a total beginner with Python. I am reading a book ("The Quick Python > Book", 2nd edition, by Vernon Ceder) which tells me that print function > takes end="" argument not to print newline character. I tried and here is > what happens: > print(x)

Re: GUIs - A Modest Proposal

2010-06-08 Thread Lie Ryan
On 06/09/10 01:17, bart.c wrote: > > "Grant Edwards" wrote in message > news:hullf3$hl...@reader1.panix.com... >> On 2010-06-08, Kevin Walzer wrote: >> >>> Since Tk already provides a basic GUI toolset, and Python can interface >>> with it more directly than it can with other toolkits >>> (PyGui

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread Ethan Furman
Deadly Dirk wrote: I am a total beginner with Python. I am reading a book ("The Quick Python Book", 2nd edition, by Vernon Ceder) which tells me that print function takes end="" argument not to print newline character. I tried and here is what happens: print(x) abc print(x,end="") File

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread Deadly Dirk
On Tue, 08 Jun 2010 21:44:18 +, Deadly Dirk wrote: > I am a total beginner with Python. I am reading a book ("The Quick > Python Book", 2nd edition, by Vernon Ceder) which tells me that print > function takes end="" argument not to print newline character. I tried > and here is what happens: >

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread fred lore
On 8 juin, 23:44, Deadly Dirk wrote: > I am a total beginner with Python. I am reading a book ("The Quick Python > Book", 2nd edition, by Vernon Ceder) which tells me that print function > takes end="" argument not to print newline character. I tried and here is > what happens: > > >>> print(x) >

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread Peter Otten
Deadly Dirk wrote: > I am a total beginner with Python. I am reading a book ("The Quick Python > Book", 2nd edition, by Vernon Ceder) which tells me that print function > takes end="" argument not to print newline character. I tried and here is > what happens: > print(x) > abc print(x,e

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread Robert Kern
On 6/8/10 5:44 PM, Deadly Dirk wrote: I am a total beginner with Python. I am reading a book ("The Quick Python Book", 2nd edition, by Vernon Ceder) which tells me that print function takes end="" argument not to print newline character. I tried and here is what happens: print(x) abc print(x,

Re: GUIs - A Modest Proposal

2010-06-08 Thread Kevin Walzer
On 6/8/10 11:17 AM, bart.c wrote: Some people aren't interested in the amazing language. Only the graphics API that goes with it. The Perl folks have stripped the Tk API away from Tcl with the Perl-Tk GUI package: the result is no embedded Tcl interpreter, but it's also hard to maintain. In

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread Gabriele Lanaro
The print function you're trying to use is for python 3 version only, If you want to keep reading the book, install python 3, else take a book that covers python 2.x syntax 2010/6/8 Deadly Dirk > I am a total beginner with Python. I am reading a book ("The Quick Python > Book", 2nd edition, by V

Re: Question about NNTPLib

2010-06-08 Thread Thomas Jollans
On 06/08/2010 05:24 PM, Anthony Papillion wrote: > I'm new to NNTPLib (and Python) and I'm experiencing some behavior I > can't understand. I'm writing a program to analyze newsgroup subject > which will then produce statistics on topics discussed. For my > example, I'm using this group (comp.lang.

Syntax problem - cannot solve it by myself

2010-06-08 Thread Deadly Dirk
I am a total beginner with Python. I am reading a book ("The Quick Python Book", 2nd edition, by Vernon Ceder) which tells me that print function takes end="" argument not to print newline character. I tried and here is what happens: >>> print(x) abc >>> print(x,end="") File "", line 1 pr

Re: Non Sequitur: Re: Python Forum

2010-06-08 Thread News123
rantingrick wrote: > On Jun 7, 12:41 am, Steven D'Aprano t...@cybersource.com.au> wrote: > >> "Fish" can be either singular (as in "I fed the fish") or a collective >> noun ("there are many fish that live in salt water"). Plural is "fishes", >> as in "I ate three fishes", although in common use p

why any( ) instead of firsttrue( ) ?

2010-06-08 Thread danieldelay
Hi, I find very useful in python the ability to use a list or number x like a boolean : if x : do something So I don't understand why was introduced the any( ) function defined as : def any(iterable): for element in iterable: if element: return True re

Re: GUIs - A Modest Proposal

2010-06-08 Thread Ethan Furman
Grant Edwards wrote: On 2010-06-08, Martin v. Loewis wrote: TkInter -> Tcl -> Tk -> Xlib Is the Tcl intepreter really need to use this GUI? Why not: (Pyton ->) Tkinter-API -> Xlib ? Even if this was possible (which it is not) Why is it not possible? It seems to have been done for other la

Re: assign class variable in __init__

2010-06-08 Thread James Mills
On Wed, Jun 9, 2010 at 6:36 AM, Mark Lawrence wrote: > Yes alright bloody Aussies  ** n * sodit * *wink*.  Not sure if this is a > syntax error, but too lazy too test at an interactive prompt. I resent that remark :) --James -- http://mail.python.org/mailman/listinfo/python-list

Re: assign class variable in __init__

2010-06-08 Thread Mark Lawrence
On 08/06/2010 17:55, Steven D'Aprano wrote: On Tue, 08 Jun 2010 17:24:55 +0100, Mark Lawrence wrote: On 08/06/2010 17:04, Ross Williamson wrote: Hi Everyone, Just a quick question - Is it possible to assign class variables in the __init__() - i.e. somthing like: They're instance variables,

Re: Which objects are expanded by double-star ** operator?

2010-06-08 Thread Terry Reedy
On 6/8/2010 2:18 AM, Terry Reedy wrote: On 6/7/2010 6:03 PM, Peter Otten wrote: The following experiment shows that you only need to implement a keys() and __getitem__() method. $ cat kw.py class A(object): def keys(self): return list("ab") def __getitem__(self, key): return 42 def f(**kw): p

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread danieldelay
Le 08/06/2010 10:03, ch1zra a écrit : import os, time, re, pyodbc, Image, sys from datetime import datetime, date, time from reportlab.lib.pagesizes import A4 from reportlab.lib.units import cm from reportlab.pdfgen import canvas from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttf

Re: capitalize() NOT the same as var[0].upper _ var[1:]

2010-06-08 Thread James Mills
2010/6/9 Victor Subervi : > Sorry, Dennis: > > var = 'colorsShort' > var[0].upper + var[1:] = 'ColorsShort' > var.capitalize() = 'Colorsshort' """ string.capitalize = capitalize(s) capitalize(s) -> string Return a copy of the string s with only its first character capitalized. """ Th

Re: GUIs - A Modest Proposal

2010-06-08 Thread Dan Stromberg
On Sat, Jun 5, 2010 at 7:22 PM, ant wrote: > I get the strong feeling that nobody is really happy with the state of > Python GUIs. > Tkinter is not widely liked, but is widely distributed. WxPython and > PyGtk are both > powerful, but quirky in different ways. PyQt is tied to one platform. > And

Re: assign class variable in __init__

2010-06-08 Thread danieldelay
you can also use : >>> class A(object): def __init__(self, **args): self.__dict__.update(args) >>> a=A(source='test', length=2) >>> a.source 'test' but this is to be used carefully because mispelling your args somewhere in your program will not raise any error : >>> A(

Re: GUIs - A Modest Proposal

2010-06-08 Thread Grant Edwards
On 2010-06-08, Martin v. Loewis wrote: >> TkInter -> Tcl -> Tk -> Xlib >> >> Is the Tcl intepreter really need to use this GUI? Why not: >> >> (Pyton ->) Tkinter-API -> Xlib ? > > Even if this was possible (which it is not) Why is it not possible? It seems to have been done for other languages.

Re: assign class variable in __init__

2010-06-08 Thread Peter Otten
Jean-Michel Pichavant wrote: > def __init__(self, source="test", length=1): > self.source = source > self.length = length > > is the way to go. OP's original idea is a bad idea :). D'accord. > Could be a problem with hundreds of parameters, but who write > constructors with hundreds of paramete

Re: GUIs - A Modest Proposal

2010-06-08 Thread Martin v. Loewis
TkInter -> Tcl -> Tk -> Xlib Is the Tcl intepreter really need to use this GUI? Why not: (Pyton ->) Tkinter-API -> Xlib ? Even if this was possible (which it is not), then you still would need the Tcl interpreter: significant parts of Tk are written in Tcl, so Tk won't work without the Tcl int

capitalize() NOT the same as var[0].upper _ var[1:]

2010-06-08 Thread Victor Subervi
Sorry, Dennis: var = 'colorsShort' var[0].upper + var[1:] = 'ColorsShort' var.capitalize() = 'Colorsshort' beno -- http://mail.python.org/mailman/listinfo/python-list

Re: assign class variable in __init__

2010-06-08 Thread Jean-Michel Pichavant
Peter Otten wrote: Jason Scheirer wrote: On Jun 8, 9:37 am, Peter Otten <__pete...@web.de> wrote: Ross Williamson wrote: Hi Everyone, Just a quick question - Is it possible to assign class variables in the __init__() - i.e. somthing like: def __init__(self,se

Re: GUIs - A Modest Proposal

2010-06-08 Thread Carl Banks
On Jun 8, 10:22 am, Grant Edwards wrote: > On 2010-06-08, bart.c wrote: > >  Why not: (Pyton ->) Tkinter-API -> Xlib ? > > Because maintain a set of Python bindings for Tk would be a lot more > work. That would be Tk-API. Tkinter-API means write a GUI toolkit that has the same API as Tkinter, w

Re: assign class variable in __init__

2010-06-08 Thread Peter Otten
Jason Scheirer wrote: > On Jun 8, 9:37 am, Peter Otten <__pete...@web.de> wrote: >> Ross Williamson wrote: >> > Hi Everyone, >> >> > Just a quick question - Is it possible to assign class variables in >> > the __init__() - i.e. somthing like: >> >> > def __init__(self,self.source = "test", self.le

Re: GUIs - A Modest Proposal

2010-06-08 Thread David King
> My concern is simple: I think that Python is doomed to remain a minor > language unless we crack this problem. But making *another* "one true GUI library" just fragments it further. Nobody designs a GUI library intending it to suck. -- http://mail.python.org/mailman/listinfo/python-list

Re: weird pickle behavior in Python 3.1.2 + Eclipse 3.5.2

2010-06-08 Thread Peter Otten
Fabio Zadrozny wrote: > On Mon, Jun 7, 2010 at 6:30 AM, Peter Otten <__pete...@web.de> wrote: >> kirby.ur...@gmail.com wrote: >> >>> On Jun 4, 9:47 am, Peter Otten <__pete...@web.de> wrote: >>> I can provoke the error in "naked" Python 3 by changing the Example.__module__ attribute:

Re: introducing Lettuce, BDD tool for python with Django integration

2010-06-08 Thread Terry Reedy
On 6/8/2010 2:26 AM, Gabriel Falcão wrote: There is not much to say, except to explain 'BDD'. the documentation is at http://lettuce.it, and That does not explain it either, but links to http://pt.wikipedia.org/wiki/Behavior_Driven_Development which is the Portuguese version of http://en

Re: GUIs - A Modest Proposal

2010-06-08 Thread Grant Edwards
On 2010-06-08, bart.c wrote: > > "Grant Edwards" wrote in message > news:hullf3$hl...@reader1.panix.com... >> On 2010-06-08, Kevin Walzer wrote: >> >>> Since Tk already provides a basic GUI toolset, and Python can interface >>> with it more directly than it can with other toolkits >>>(PyGui ->

Re: GUIs - A Modest Proposal

2010-06-08 Thread Terry Reedy
On 6/8/2010 4:50 AM, Arndt Roger Schneider wrote: Terry Reedy schrieb: Googling further, I found canvasvg.py at http://wm.ite.pl/proj/canvas2svg/index.html via an answer to a question at http://bytes.com/topic/python/answers/629332-saving-output-turtle-graphics That was it! Be aware only tk

Re: assign class variable in __init__

2010-06-08 Thread Jason Scheirer
On Jun 8, 9:37 am, Peter Otten <__pete...@web.de> wrote: > Ross Williamson wrote: > > Hi Everyone, > > > Just a quick question - Is it possible to assign class variables in > > the __init__() - i.e. somthing like: > > > def __init__(self,self.source = "test", self.length = 1) > > > rather than > >

Re: Which objects are expanded by double-star ** operator?

2010-06-08 Thread Steven D'Aprano
On Tue, 08 Jun 2010 08:36:00 -0600, Ian Kelly wrote: >> I'm afraid your test is invalid. As the documentation states, you >> CANNOT write to locals() -- the change doesn't stick. This is nothing >> to do with dicts. > > Huh, good point. But actually the docs just say that the changes aren't > gu

Re: assign class variable in __init__

2010-06-08 Thread Steven D'Aprano
On Tue, 08 Jun 2010 17:24:55 +0100, Mark Lawrence wrote: > On 08/06/2010 17:04, Ross Williamson wrote: >> Hi Everyone, >> >> Just a quick question - Is it possible to assign class variables in the >> __init__() - i.e. somthing like: > > They're instance variables, not class variables. In the usua

Re: assign class variable in __init__

2010-06-08 Thread Peter Otten
Ross Williamson wrote: > Hi Everyone, > > Just a quick question - Is it possible to assign class variables in > the __init__() - i.e. somthing like: > > def __init__(self,self.source = "test", self.length = 1) > > rather than > > def __init__(self,source = "test", length = 1): No. If you are

Re: weird pickle behavior in Python 3.1.2 + Eclipse 3.5.2

2010-06-08 Thread Fabio Zadrozny
On Mon, Jun 7, 2010 at 6:30 AM, Peter Otten <__pete...@web.de> wrote: > kirby.ur...@gmail.com wrote: > >> On Jun 4, 9:47 am, Peter Otten <__pete...@web.de> wrote: >> >>> I can provoke the error in "naked" Python 3 by changing the >>> Example.__module__ attribute: >>> >>> Python 3.1.1+ (r311:74480,

Re: "Python failed to load the default activation context" - should I worry?

2010-06-08 Thread Terry Reedy
On 6/8/2010 8:43 AM, Bill Davy wrote: Loading Python 2.6.5 (built using VC6) in a VC6 application. This appears in my debug log. Am I worried? Should I be? And I am stuck with VC6 (customers, don't ya know). If you paste the message into Google, you will get a few hits other than your post.

Re: Question about NNTPLib

2010-06-08 Thread Anthony Papillion
Hi Tim, Tried both and neither works. While I really believe it's simply the wrong code, I'm wondering if my news server might be throwing something invalid into the header or not conforming to RFC standards. Thanks for taking a shot at this anyway though. Anyone have any other thoughts on why th

Re: assign class variable in __init__

2010-06-08 Thread Mark Lawrence
On 08/06/2010 17:04, Ross Williamson wrote: Hi Everyone, Just a quick question - Is it possible to assign class variables in the __init__() - i.e. somthing like: They're instance variables, not class variables. def __init__(self,self.source = "test", self.length = 1) No. rather than def _

assign class variable in __init__

2010-06-08 Thread Ross Williamson
Hi Everyone, Just a quick question - Is it possible to assign class variables in the __init__() - i.e. somthing like: def __init__(self,self.source = "test", self.length = 1) rather than def __init__(self,source = "test", length = 1): -- Ross Williamson University of Chicago Department of As

Re: Question about NNTPLib

2010-06-08 Thread Tim Wintle
On Tue, 2010-06-08 at 08:24 -0700, Anthony Papillion wrote: > resp, count, first, last, name = server.group('comp.lang.python') > resp, items = server.xover(first, last) > > for subject in items: > resp, subject = server.xhdr('subject', first, last) > print subject > > Whi

Question about NNTPLib

2010-06-08 Thread Anthony Papillion
I'm new to NNTPLib (and Python) and I'm experiencing some behavior I can't understand. I'm writing a program to analyze newsgroup subject which will then produce statistics on topics discussed. For my example, I'm using this group (comp.lang.python) and trying to simply print out all of the subject

Re: GUIs - A Modest Proposal

2010-06-08 Thread bart.c
"Grant Edwards" wrote in message news:hullf3$hl...@reader1.panix.com... On 2010-06-08, Kevin Walzer wrote: Since Tk already provides a basic GUI toolset, and Python can interface with it more directly than it can with other toolkits (PyGui -> PyGtk -> Gtk -> Xlib), Compare that to this:

  1   2   >