DRY and class variables

2011-09-08 Thread egbert
. Any ideas ? e -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python-list

Re: DRY and class variables

2011-09-08 Thread egbert
@with_metadata class TableOne: # foo pass Overnight I have become a decorator fan. I can postpone the study of metaclasses. Thanks. e -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http

Re: Python IDE/text-editor

2011-04-17 Thread egbert
nobody mention Geany ? e -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python-list

When the first line of a file tells something about the other lines

2010-08-16 Thread Egbert Bouwman
() # now do something with stripped_line f.close() egbert -- Egbert Bouwman Keizersgracht 197-II 1016 DS Amsterdam Tel 0(031)20 6257991 -- http://mail.python.org/mailman/listinfo/python-list

Re: When the first line of a file tells something about the other lines

2010-08-16 Thread egbert
suggestion to read the itertools docs. egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python-list

List-type attributes and name strings

2010-07-01 Thread egbert
) and for a dictionary: self.__dict__[namestring][keystring]=value But I have the impression that I am cheating, because users should not operate on __dict__ directly. Is that true ? And are there better solutions ? egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991

Re: List-type attributes and name strings

2010-07-01 Thread egbert
On Thu, Jul 01, 2010 at 04:02:49AM -0700, Chris Rebert wrote: switch to getattr() as demonstrated above. Thanks for opening my eyes, Chris. egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991

Re: List-type attributes and name strings

2010-07-01 Thread egbert
the hard coding of attr1 and attr2 like you did. And because of a blind spot for getattr() I modified __dict__. Thanks to you, Chris and Lie it will not happen again, I promise. egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991

Re: Is there a standard name for this tree structure?

2010-04-06 Thread egbert
On Sun, Apr 04, 2010 at 12:10:02PM +, Steven D'Aprano wrote: I can implement this tree using a flat dict: root = object() data = {root: ['Mammal', 'Reptile'], What is the advantage, or thougth behind, using an instance of object as the root of your flat tree ? egbert -- Egbert

from import and __init__.py

2010-03-25 Thread egbert
When I do 'from some_package import some_module' the __init__.py of some_package will be run. However, there will not be anything like a package-module, and the effects of __init__.py seem all to be lost. Is that true ? Or can I still do something useful with __init__.py ? e -- Egbert Bouwman

Re: from import and __init__.py

2010-03-25 Thread egbert
On Thu, Mar 25, 2010 at 12:43:13PM -0400, Terry Reedy wrote: On 3/25/2010 6:16 AM, egbert wrote: When I do 'from some_package import some_module' the __init__.py of some_package will be run. However, there will not be anything like a package-module, and the effects of __init__.py seem all

SQLite's default ON CONFLICT algorithm

2008-08-18 Thread egbert
the ROLLBACK conflict algorithm in my sql. Instead I have to catch the IntegrityError and call the rollback method. Does that mean that I have to wrap all multi-command transactions in a try-except if I don't like the default ABORT choice ? e -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS

Re: current week / weeks in year - best practice

2008-08-03 Thread egbert
On Sat, Aug 02, 2008 at 07:46:49PM -0700, Dennis Lee Bieber wrote: heh What is the meaning of heh ? e. -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman

Re: formatting list - comma separated (slightly different)

2008-07-09 Thread egbert
= , .join(row) pos = txt.rfind(, ) new = %s and %s % (txt[0:pos], txt[pos+2:]) egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python-list

Re: Java or C++?

2008-04-15 Thread egbert
What is the role or position of C# in this context ? If I remember well, some people have said that C# is an improved C++ or Java. e -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http

Re: for-else

2008-03-09 Thread egbert
condition, whatever logical explanation you may offer. . for each_item in item_list: .do_something() . else: .do_else() My temporary solution will be to accompany this else with an appropriate comment: # exhausted e -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020

Re: for-else

2008-03-08 Thread egbert
) . exhausted - the loop ran to completion. The last two as suggested by Laurence Tratt in his Convergence. e -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python

Re: Python 3.0 migration plans?

2007-09-28 Thread egbert
On Thu, Sep 27, 2007 at 09:17:30PM -0400, Steve Holden wrote: So what we need is a poll on what the questions should be. I *love* c.l.py. I will switch as soon as Debian has all the tools for an easy conversion available, and Python 3000 has reached the default release status. e -- Egbert

Re: is it possible to give an instance a value?

2007-03-08 Thread egbert
On Thu, Mar 08, 2007 at 01:22:25PM +1100, Steven D'Aprano wrote: On Wed, 07 Mar 2007 16:02:05 +0100, egbert wrote: My impression is that you can do everything you want to by making your instance callable, and not using a but a(). You can't do this: a() = some value I didn't say

Re: Python does not play well with others

2007-01-24 Thread egbert
. Solid, trusted, tunable ... C++ - objects tacked onto C; but that didn't work so invent ... Python - it just works. Same scripts run on every platform ... What about C# ? e -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991

Re: SPE refuses.

2006-11-30 Thread egbert
. -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python-list

SPE refuses.

2006-11-29 Thread egbert
According to apt-show-versions I have installed: python-wxgtk2.6 2.6.3.2.1.5 spe 0.8.2a+repack-1 However when I start SPE I get the message You need to install at least wxPython v2.5.4.1 to run SPE How do I tell SPE that I have the right wxPython ? e. -- Egbert Bouwman

Re: SPE refuses.

2006-11-29 Thread egbert
. Get it from http://www.python.org Well, I got it from the debian repositories. e. -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python-list

Python as default Lexer in SciTE

2006-11-12 Thread egbert
Is it possible to set Python as the default language in SciTE? Not all my python scripts have the .py extension, only the to_be_imported ones. And I use SciTE only for Python. e. -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991

Dispatcher experiment

2006-11-08 Thread egbert
or improvements on my design. In a python shell you may test it with: import dip zoo = dip.Zoo() zoo.animals[fish].send_food_wish() egbert #!/usr/bin/env python # dip.py := experiment with Patrick O'Brien's dispatcher import wx.py.dispatcher as disp class Animal(object): def __init__

Re: invert or reverse a string... warning this is a rant

2006-10-20 Thread egbert
. -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python-list

set_focus_chain in pygtk and wxPython

2006-08-13 Thread egbert
In pygtk is available: set_focus_chain Does wxPython have something similar ? -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python-list

Questions about the event loop

2006-05-16 Thread egbert
): callback_helper() ... klas = Klas() func() gtk.main() egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo

Re: can anyone advise me

2006-04-27 Thread egbert
by zero or more z's, but only after each x, including the first one, you switch to a new line. So the last digit on each line is an x, except for the last line, which are z's printed after the 9 (an x) ending the line above it. Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991

Re: An isalpha() that accepts underscores as well

2006-03-01 Thread egbert
= Timer(token.isalpha(), from __main__ import token) print t.timeit() # 0.28 #egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python-list

An isalpha() that accepts underscores as well

2006-02-26 Thread egbert
slower than isalpha() sec. Any suggestions ? Thanks. -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python-list

Pythonpath and gnome panel

2006-02-20 Thread egbert
My pygtk gui can not be started from a gnome panel, because, apparently, the panel doesn't know about my modified PYTHONPATH. So how can I instruct the panel ? -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991

Re: checking if a string contains a number

2005-12-20 Thread egbert
On Tue, Dec 20, 2005 at 07:16:46PM +0530, Suresh Jeevanandam wrote: s1 = '12e3' s2 = 'junk' Is there any other function which would return True for s1 and False for s2. isinstance(12e3, (int, float)) -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020

Re: PyFLTK - an underrated gem for GUI projects

2005-11-07 Thread egbert
PyFLTK is not a debian package - yet. Is nobody interested, or is there a more specific reason ? -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python

Opaque documentation

2005-10-28 Thread egbert
that the window is displayed on. The screen on the second line, before the period, is in italics, if that helps. I like these texts. Prose should not disclose its secrets at once. If you have other examples, please let us know. -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991

PyGTK color blackout

2005-10-23 Thread egbert
Without success I try to understand the color mechanism in PyGTK. It's about the classes Color an Colormap, and their methods and related functions and other paraphernalia. If anyone knows about a tutorial-like systematic description, I will be very grateful. -- Egbert Bouwman - Keizersgracht

Hello gnome-terminal

2005-09-30 Thread egbert
gnome-terminal window is opened for output only, and PYTHONPATH is an unknown entity. How can I open a terminal over whose environment and configuration I have more control ? -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991

Re: python certification

2005-07-20 Thread egbert
about the same language. However I must apologize. It didn't cover Pyhton. This is an improved version: pc=re.compile(r'\bph?(ph)*[iye]+h?(th?)+o?n+e?\b',re.I) As you see it covers pitn, and also spellings like pythonne, to accomodate the francophones. -- Egbert Bouwman - Keizersgracht 197 II

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-03 Thread egbert
for limbo, but the same question goes for: zip(sequence1,sequence2) -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python-list

Re: Controlling assignation

2005-06-13 Thread egbert
): self.var=0 def __call__(self,val=None): self.var=val a = A() a(5) print a.var # gives 5 egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo

[OT] SQL-records and OOP

2005-05-30 Thread egbert
to offer, but I must be looking in the wrong direction. egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python-list