PyCon Australia 2010 registration deadline reminder

2010-06-08 Thread Richard Jones
Hi everyone, PyCon Australia 2010, to be held at the Sydney Masonic Center over the weekend of June 26 and 27, is drawing ever closer. REGISTRATION WILL CLOSE JUNE 22! We will NOT be accepting registrations at the door. Register here: http://pycon-au.org/reg We offer two levels of

ANN: unittest 0.4.2 released

2010-06-08 Thread Michael Foord
unittest2 0.4.2 is now released: http://pypi.python.org/pypi/unittest2/ unittest2 is a backport of the new features in the Python 2.7 version of the standard library testing framework unittest. The major improvements over unittest in Python 2.6 include: * A standard test runner with

ANN: selenium 2 dev

2010-06-08 Thread Miki
Hello All, This is the first release of Selenium 2 Python bindings. It contains the Selenium 1 Python bindings and a working Selenium 2 remote client. The plan in the future is to add Firefox, IE and Chrome direct bindings as well. Please note this is ALPHA quality code, so expect bugs (and

Re: GUIs - A Modest Proposal

2010-06-08 Thread Stephen Hansen
On Mon, Jun 7, 2010 at 10:34 PM, Rick Johnson rantingr...@gmail.com wrote: Hi Stephen, Great to hear from you. You're right about the powers that be, and i agree! I was just being a bit theatrical (i've been known to do that from time to time...Sorry. ;-). I know one of at least is

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

2010-06-08 Thread Terry Reedy
On 6/7/2010 6:03 PM, 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 always numbers, BTW), but I

introducing Lettuce, BDD tool for python with Django integration

2010-06-08 Thread Gabriel Falcão
There is not much to say, the documentation is at http://lettuce.it, and the code is GNU/GPL3+ located at http://github.com/gabrielfalcao/lettuce There is a blog post introducing it at http://gabrielfalcao.com/2010/06/08/lettuce-0-1-official-release/

Re: GUIs - A Modest Proposal

2010-06-08 Thread Martin P. Hellwig
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 different ways. PyQt is tied to one platform. And there are dozens more.

Re: GUIs - A Modest Proposal

2010-06-08 Thread rantingrick
On Jun 8, 1:39 am, Martin P. Hellwig martin.hell...@dcuktec.org 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

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

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Richard Thomas
On Jun 8, 9:03 am, ch1zra ch1...@gmail.com 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

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

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.

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

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 chards...@gmail.com wrote: On Jun 8, 9:03 am, ch1zra ch1...@gmail.com 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

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 numbers, BTW), but I

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

Re: UnboundLocalError: local variable referenced before assignment

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

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 always numbers, BTW),

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

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread ch1zra
On Jun 8, 10:59 am, Bryan bryanjugglercryptograp...@yahoo.com 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

Re: Plotting in batch with no display

2010-06-08 Thread Giacomo Boffi
Hans Georg Schaathun h.schaat...@surrey.ac.uk 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

Re: Plotting in batch with no display

2010-06-08 Thread Giacomo Boffi
Giacomo Boffi giacomo.bo...@polimi.it writes: Hans Georg Schaathun h.schaat...@surrey.ac.uk writes: : import matplotlib : matplotlib.use('agg') : import pylab : pylab.plot([1, 3, 5]) : fig = file('foo.png', 'wb') : pylab.savefig(fig, format='png') :

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

2010-06-08 Thread kkumer
Bryan bryanjugglercryptograp...@yahoo.com 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

Re: Reading file bit by bit

2010-06-08 Thread Martin
On Jun 7, 9:57 am, Alfred Bovin alf...@bovin.invalid 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

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',

Re: optparse: best way

2010-06-08 Thread Ben Finney
hiral hiralsmaill...@gmail.com 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 (‘.’)

Re: optparse: best way

2010-06-08 Thread Michele Simionato
On Jun 8, 10:38 am, hiral hiralsmaill...@gmail.com 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',

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 in

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

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

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 ch1...@gmail.com wrote: On Jun 8, 10:29 am, Richard Thomas chards...@gmail.com wrote: On Jun 8, 9:03 am, ch1zra ch1...@gmail.com wrote: I have following code : import os, time, re, pyodbc, Image, sys from datetime import

Re: os.path.normpath question

2010-06-08 Thread Duncan Booth
Bart xc68...@gmail.com 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

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 time

Re: optparse: best way

2010-06-08 Thread Hrvoje Niksic
Thomas Jollans tho...@jollans.com 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

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. Hellwigmartin.hell...@dcuktec.org 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

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, resulting in the

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, alex23wuwe...@gmail.com wrote: snip 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

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Bruno Desthuilliers
ch1zra a écrit : On Jun 8, 10:59 am, Bryan bryanjugglercryptograp...@yahoo.com 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

Re: GUIs - A Modest Proposal

2010-06-08 Thread Stephen Hansen
On Tue, Jun 8, 2010 at 6:55 AM, Kevin Walzer k...@codebykevin.com 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)

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

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 simulation,

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 st...@remove-this-cybersource.com.au 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

Re: GUIs - A Modest Proposal

2010-06-08 Thread Grant Edwards
On 2010-06-08, Kevin Walzer k...@codebykevin.com 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

Re: GUIs - A Modest Proposal

2010-06-08 Thread bart.c
Grant Edwards inva...@invalid.invalid wrote in message news:hullf3$hl...@reader1.panix.com... On 2010-06-08, Kevin Walzer k...@codebykevin.com 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 -

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

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 While the

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

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

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

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, Nov  2 2009, 15:45:00)

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 just lazy,

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 usual Python

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 guaranteed

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 def

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

Re: GUIs - A Modest Proposal

2010-06-08 Thread Grant Edwards
On 2010-06-08, bart.c ba...@freeuk.com wrote: Grant Edwards inva...@invalid.invalid wrote in message news:hullf3$hl...@reader1.panix.com... On 2010-06-08, Kevin Walzer k...@codebykevin.com wrote: Since Tk already provides a basic GUI toolset, and Python can interface with it more directly

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

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: Python 3.1.1+ (r311:74480,

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.length = 1) rather

Re: GUIs - A Modest Proposal

2010-06-08 Thread Carl Banks
On Jun 8, 10:22 am, Grant Edwards inva...@invalid.invalid wrote: On 2010-06-08, bart.c ba...@freeuk.com 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

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

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

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 parameters ?

Re: GUIs - A Modest Proposal

2010-06-08 Thread Grant Edwards
On 2010-06-08, Martin v. Loewis mar...@v.loewis.de 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

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 :

Re: GUIs - A Modest Proposal

2010-06-08 Thread Dan Stromberg
On Sat, Jun 5, 2010 at 7:22 PM, ant shi...@uklinux.net 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

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

2010-06-08 Thread James Mills
2010/6/9 Victor Subervi victorsube...@gmail.com: 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

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

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

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 breamore...@yahoo.co.uk 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 --

Re: GUIs - A Modest Proposal

2010-06-08 Thread Ethan Furman
Grant Edwards wrote: On 2010-06-08, Martin v. Loewis mar...@v.loewis.de 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

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: Non Sequitur: Re: Python Forum

2010-06-08 Thread News123
rantingrick wrote: On Jun 7, 12:41 am, Steven D'Aprano steve-REMOVE- 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

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 stdin, line 1

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

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 d...@plfn.invalid I am a total beginner with Python. I am reading a book (The Quick Python Book, 2nd

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.

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

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,end=) File

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread fred lore
On 8 juin, 23:44, Deadly Dirk d...@plfn.invalid 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 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 inva...@invalid.invalid wrote in message news:hullf3$hl...@reader1.panix.com... On 2010-06-08, Kevin Walzer k...@codebykevin.com wrote: Since Tk already provides a basic GUI toolset, and Python can interface with it more directly than it can

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) abc

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

2010-06-08 Thread Ian Kelly
On Tue, Jun 8, 2010 at 3:16 PM, danieldelay danielde...@gmail.com 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

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 mar...@v.loewis.de 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

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 newline

Re: GUIs - A Modest Proposal

2010-06-08 Thread geremy condra
On Tue, Jun 8, 2010 at 3:09 PM, Lie Ryan lie.1...@gmail.com wrote: On 06/09/10 01:17, bart.c wrote: Grant Edwards inva...@invalid.invalid wrote in message news:hullf3$hl...@reader1.panix.com... On 2010-06-08, Kevin Walzer k...@codebykevin.com wrote: Since Tk already provides a basic GUI

Re: Non Sequitur: Re: Python Forum

2010-06-08 Thread Mark Young
According to the Oxford Dictionary: *fish** noun http://www.oup.com/oald-bin/#fish_noun**, **verb http://www.oup.com/oald-bin/#fish_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

[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

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. Loewismar...@v.loewis.de 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

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 a

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

  1   2   3   >