Re: GUIs - A Modest Proposal

2010-06-08 Thread rantingrick
On Jun 8, 1:39 am, "Martin P. Hellwig" wrote: > On 06/06/10 03:22, 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 differ

UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread ch1zra
I have following code : 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.ttfonts import TTF

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Richard Thomas
On Jun 8, 9:03 am, ch1zra wrote: > I have following code : > > 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 pdf

optparse: best way

2010-06-08 Thread hiral
Hi, I am using optparser to do following... Command syntax: myscript -o[exension] other_arguments where; extension can be 'exe', 'txt', 'pdf', 'ppt' etc. Now to parse this, I am doing following... parser.add_option("-oexe', dest=exe_file...) parser.add_option("-otxt', dest=txt_file...) par

Re: GUIs - A Modest Proposal

2010-06-08 Thread Arndt Roger Schneider
Terry Reedy schrieb: On 6/7/2010 5:25 PM, Arndt Roger Schneider wrote: Terry Reedy schrieb: ... Hah, You are ill-informed. How about 'under-informed'? That I readily admit ;-) tkpath 0.3 contains a surface element, which renders vector graphics elements in an off-screen tk image. A

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Bryan
ch1zra wrote: > I have following code : > > 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 repor

Re: optparse: best way

2010-06-08 Thread Thomas Jollans
On 2010-06-08 10:38, hiral wrote: > Hi, > > I am using optparser to do following... > > Command syntax: > myscript -o[exension] other_arguments > where; extension can be 'exe', 'txt', 'pdf', 'ppt' etc. > > > Now to parse this, I am doing following... > > parser.add_option("-oexe', dest=exe_file

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread ch1zra
On Jun 8, 10:29 am, Richard Thomas wrote: > On Jun 8, 9:03 am, ch1zra wrote: > > > > > > > I have following code : > > > 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

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

2010-06-08 Thread Kresimir Kumericki
Peter Otten <__pete...@web.de> wrote: > kkumer wrote: > >> >> I have to merge two dictionaries into one, and in >> a "shallow" way: changing items should be possible >> by operating either on two parents or on a >> new dictionary. I am open to suggestions how >> to do this (values are always numb

Re: Python + vim + spaces vs tab

2010-06-08 Thread Robin Becker
On 07/06/2010 22:18, Hans Mulder wrote: Jean-Michel Pichavant wrote: Hello, Does anyone knows a way to configure vim so it automatically select to correct expandtab value depending on the current buffer 'way of doing' ? I need to edit different files, some are using spaces, others tabs. Those b

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Chris Rebert
On Tue, Jun 8, 2010 at 2:00 AM, ch1zra wrote: > On Jun 8, 10:29 am, Richard Thomas wrote: >> On Jun 8, 9:03 am, ch1zra wrote: >> > I have following code : >> >> > import os, time, re, pyodbc, Image, sys >> > from datetime import datetime, date, time >> > from reportlab.lib.pagesizes import A4 >>

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

2010-06-08 Thread Bryan
Terry Reedy wrote: > Peter Otten wrote: > > > kkumer wrote: > > >> I have to merge two dictionaries into one, and in > >> a "shallow" way: changing items should be possible > >> by operating either on two parents or on a > >> new dictionary. I am open to suggestions how > >> to do this (values are

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

2010-06-08 Thread kkumer
(sorry for posting empty post by accident) Peter Otten <__pete...@web.de> wrote: > it stops working -- probably a side-effect of some optimization. > So if you change your hubDict's base class from dict to object you should > get the desired behaviour. Yes, as already noted, this would require p

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread ch1zra
On Jun 8, 10:59 am, Bryan wrote: > ch1zra wrote: > > I have following code : > > > 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 > > fro

Re: Plotting in batch with no display

2010-06-08 Thread Giacomo Boffi
Hans Georg Schaathun writes: > : import matplotlib > : matplotlib.use('agg') > : import pylab > : pylab.plot([1, 3, 5]) > : fig = file('foo.png', 'wb') > : pylab.savefig(fig, format='png') > : fig.close() > > Raster graphics is not good enough #ig = file('foo.p

Re: Plotting in batch with no display

2010-06-08 Thread Giacomo Boffi
Giacomo Boffi writes: > Hans Georg Schaathun writes: > >> : import matplotlib >> : matplotlib.use('agg') >> : import pylab >> : pylab.plot([1, 3, 5]) >> : fig = file('foo.png', 'wb') >> : pylab.savefig(fig, format='png') >> : fig.close() >> >> Raster graphics i

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

2010-06-08 Thread kkumer
Bryan wrote: > I get the same bug-like behavior in 3.1. I think Peter is right that > it's probably a side-effect of an optimization. kkumer seems to have > completely over-ridden the methods of dict, but if we insert into his > hubDict with the parent class's method: > > dict.__setitem__(dh, 'c

Re: Reading file bit by bit

2010-06-08 Thread Martin
On Jun 7, 9:57 am, "Alfred Bovin" wrote: > Hi all. > > I'm working on something where I need to read a (binary) file bit by bit and > do something depending on whether the bit is 0 or 1. > > Any help on doing the actual file reading is appreciated. > > Thanks in advance Hi, Have you looked at th

Re: optparse: best way

2010-06-08 Thread Jean-Michel Pichavant
hiral wrote: Hi, I am using optparser to do following... Command syntax: myscript -o[exension] other_arguments where; extension can be 'exe', 'txt', 'pdf', 'ppt' etc. Now to parse this, I am doing following... parser.add_option("-oexe', dest=exe_file...) parser.add_option("-otxt', dest=t

Re: optparse: best way

2010-06-08 Thread Ben Finney
hiral writes: > Command syntax: > myscript -o[exension] other_arguments > where; extension can be 'exe', 'txt', 'pdf', 'ppt' etc. It's more generally applicable to refer to that as a “suffix” for the filename, and specify the full suffix including the full-stop (‘.’) character. What your ex

Re: optparse: best way

2010-06-08 Thread Michele Simionato
On Jun 8, 10:38 am, hiral wrote: > Hi, > > I am using optparser to do following... > > Command syntax: > myscript -o[exension] other_arguments >     where; extension can be 'exe', 'txt', 'pdf', 'ppt' etc. > > Now to parse this, I am doing following... > > parser.add_option("-oexe', dest=exe_file..

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

2010-06-08 Thread Steven D'Aprano
On Mon, 07 Jun 2010 15:04:35 -0600, Ian Kelly wrote: > I don't think that what you want to do here is possible. It appears to > be hard-coded and not affected by subclassing, as evidenced by the > following snippet: > > class NonDict(dict): > for attr in dict.__dict__: > if attr not

Re: optparse: best way

2010-06-08 Thread Peter Otten
hiral wrote: > Hi, > > I am using optparser to do following... > > Command syntax: > myscript -o[exension] other_arguments > where; extension can be 'exe', 'txt', 'pdf', 'ppt' etc. > > > Now to parse this, I am doing following... > > parser.add_option("-oexe', dest=exe_file...) > parser.a

Re: GUIs - A Modest Proposal

2010-06-08 Thread Steven D'Aprano
On Mon, 07 Jun 2010 20:07:29 -0700, rantingrick wrote: > However as i have mentioned before there will NEVER be a crowd of us > marching in the streets behind one GUI. People are just too busy to get > involved. This has to be an executive decision. The powers that be must > make the change themse

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Peter Otten
Chris Rebert wrote: > On Tue, Jun 8, 2010 at 2:00 AM, ch1zra wrote: >> On Jun 8, 10:29 am, Richard Thomas wrote: >>> On Jun 8, 9:03 am, ch1zra wrote: >>> > I have following code : >>> >>> > import os, time, re, pyodbc, Image, sys >>> > from datetime import datetime, date, time >>> > from report

Re: os.path.normpath question

2010-06-08 Thread Duncan Booth
Bart wrote: > I'm using this and ran across backslash issues in one of my paths. > > archpath = os.path.normpath('E:\foo\FTP\HLS\archive') > > was translating to: > > E:\lsfprod\law\uch_interfaces\FTP\HLSrchive > > which caused me to start using the 'raw' declaration before the path

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

2010-06-08 Thread Francisco Souza
There's another BDD tool, also based on Cucumber, but it's more "mature": http://github.com/rlisagor/freshen We don't have a website yet, and if you wish to collaborate, then join us :) Best regards, Francisco Souza Software developer at Giran and also full time Open source evangelist at full tim

Re: optparse: best way

2010-06-08 Thread Hrvoje Niksic
Thomas Jollans writes: > UNIX and GNU recommendations. I've never actually heard of optparser, > but I'd expect it to have the usual limitations: Hiral probably meant to write "optparse", which supports GNU-style options in a fairly standard and straightforward way. Which includes that defining

Re: GUIs - A Modest Proposal

2010-06-08 Thread Martin P. Hellwig
On 06/08/10 07:59, rantingrick wrote: On Jun 8, 1:39 am, "Martin P. Hellwig" wrote: On 06/06/10 03:22, 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, bu

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

2010-06-08 Thread Bryan
kkumer wrote: > Bryan wrote: > > I get the same bug-like behavior in 3.1. I think Peter is right that > > it's probably a side-effect of an optimization. kkumer seems to have > > completely over-ridden the methods of dict, but if we insert into his > > hubDict with the parent class's method: > > >

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

2010-06-08 Thread Bill Davy
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). -- http://mail.python.org/mailman/listinfo/python-list

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Bryan
Peter Otten wrote: > Chris Rebert wrote: [...] > > The only global variable defined in mkTable.py is the "mkTable" > > function (partly since you don't import anything). So the reference to > > the global variable "canvas" on the right-hand side of this expression > > is completely undefined, resul

Re: GUIs - A Modest Proposal

2010-06-08 Thread Kevin Walzer
On 6/8/10 1:16 AM, rantingrick wrote: On Jun 7, 11:51 pm, alex23 wrote: Of course i was just being theatrical alex, i hope your last post was in the same manner. However your right about everything you said except your accusations that i am not willing to help bring this into reality -- i jus

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Bruno Desthuilliers
ch1zra a écrit : On Jun 8, 10:59 am, Bryan wrote: Python doesn't have one global namespace. Each module (file) has its own namespace, which is a Python dict, and 'global' means defined in the containing module's dict. Put the import: from reportlab.pdfgen import canvas in the mkTable.py fil

Re: GUIs - A Modest Proposal

2010-06-08 Thread Stephen Hansen
On Tue, Jun 8, 2010 at 6:55 AM, Kevin Walzer wrote: > I have no opinion on the merits of PyGUI itself, but after taking a quick > look at the site and the docs, it seems to be an abstraction API over three > different, platform-specific GUI toolkits--PyObjC (Mac), PyGtk (X11) and > Windows (pywin

Re: GUIs - A Modest Proposal

2010-06-08 Thread Adam Tauno Williams
On Tue, 2010-06-08 at 09:55 -0400, 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), "Python can interface with it more directly" This statement is devoid of m

Re: python2.5 x python2.6 in interactive mode

2010-06-08 Thread Thomas Jollans
in future please try to reply on-list, not to the person you're replying to directly. On 06/08/2010 03:00 PM, Alan wrote: > Well, using code.interact() didn't help much. > > The problem is that one of the reasons (if not the main reason) of > using 'python -i' is to be able to follow the simulatio

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

2010-06-08 Thread Ian Kelly
On Tue, Jun 8, 2010 at 4:21 AM, Steven D'Aprano wrote: > On Mon, 07 Jun 2010 15:04:35 -0600, Ian Kelly wrote: > >> I don't think that what you want to do here is possible.  It appears to >> be hard-coded and not affected by subclassing, as evidenced by the >> following snippet: >> >> class NonDict

Re: GUIs - A Modest Proposal

2010-06-08 Thread Grant Edwards
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: TkInter -> Tcl -> Tk -> Xlib > it's not clear to me what is gained by s

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:

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: 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

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: 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 _

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: "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: 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: 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: 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: 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 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: 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: 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: 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: 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: 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: 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 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 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

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: 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

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 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 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 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: 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: 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: 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: 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: 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: 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

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: 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

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: 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.

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: 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 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: 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 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 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 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: 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 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: 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: 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: 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 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: 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

[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: 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

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: 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 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: 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: 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 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 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 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

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

  1   2   >