Re: max(), sum(), next()

2008-09-14 Thread Odalrick
[EMAIL PROTECTED] wrote in news:240454f2-14ee-496a-9078-1abbf80a4e64 @m45g2000hsb.googlegroups.com: > castironpi: >> For max and min, why can't you just add your argument to the set >> itself? > > Sometimes that can be done, but in many other situations it's less > easy, like in the example I hav

Re: Bizarre behavior with mutable default arguments

2007-12-31 Thread Odalrick
On 31 Dec, 18:22, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Dec 31, 10:58 am, Odalrick <[EMAIL PROTECTED]> wrote: > > > On 30 Dec, 17:26, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > On Dec 29, 9:14 pm, bukzor <[EMAIL PROTECTE

Re: Bizarre behavior with mutable default arguments

2007-12-31 Thread Odalrick
On 30 Dec, 17:26, George Sakkis <[EMAIL PROTECTED]> wrote: > On Dec 29, 9:14 pm, bukzor <[EMAIL PROTECTED]> wrote: > > > Here's the answer to the > > question:http://www.python.org/doc/faq/general/#why-are-default-values-shared-... > > > It looks like Guido disagrees with me, so the discussion is

Re: Python Design Patterns - composition vs. inheritance

2007-11-18 Thread Odalrick
On 17 Nov, 19:58, Carl Banks <[EMAIL PROTECTED]> wrote: > Google for Liskov Substitutability if you are interested. I didn't pull > this idea out of my hat. In fact I learned the term from reading a post > by GvR himself, though the idea was intuitive to me long before that. > > Carl Banks Inte

Re: Python Design Patterns - composition vs. inheritance

2007-11-17 Thread Odalrick
On 16 Nov, 16:35, Carl Banks <[EMAIL PROTECTED]> wrote: > On Thu, 15 Nov 2007 21:25:16 -0800, Dennis Lee Bieber wrote: > > On Thu, 15 Nov 2007 16:57:57 -0800 (PST), Carl Banks > > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > >> A source of confusion with "is a" is that it do

Re: weakref pitfall

2007-10-20 Thread Odalrick
On 20 Okt, 16:21, Paul Hankin <[EMAIL PROTECTED]> wrote: > The next stage in debugging is to think of a test that will prove your > guess right or wrong. I'd remove weakrefs from your event manager and > see if your code starts working. > > I'd suggest you're a bit confused about your event manage

weakref pitfall

2007-10-20 Thread Odalrick
I'm trying to write a simple game and decided I need an eventmanager. import weakref from collections import defaultdict class _EventManager( object ): def __init__( self ): self._handled_events = defaultdict( weakref.WeakKeyDictionary ) def register( self, handler, event_type,

Image creation

2006-11-02 Thread Odalrick
way to give alpha values with wxPython's image objects and premature optimization etcetera... Well, now the program works, but is a bit sluggish so I'm asking if anyone can give me some pointers to speeding this up. /Odalrick -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular Expression help for parsing html tables

2006-10-29 Thread Odalrick
e. It would have been easier if you'd said what the text you are looking for is, but I think: regex = re.compile( r'(.*?text you are looking for.*?)', re.DOTALL ) match = regex.search( html_string ) found_table = match.group( 1 ) would work. /Odalrick -- http://mail.python.org/mailman/listinfo/python-list

Visibility against an unknown background

2006-10-24 Thread Odalrick
will use a partially transparent bitmap with a hole in the appropriate place and move the hole as needed. I realized the last solution as I was writing this and I think it will work fairly well, but I'm still wondering if there is another, better solution i might have missed. /Oda

Re: Trouble with property

2006-10-23 Thread Odalrick
Gabriel Genellina skrev: > You must use a new-style class for properties to work. That is: class > ConstrainedBox(object): > > -- > Gabriel Genellina > Softlab SRL > Thank you, I've seen it mentioned, but never knew what it meant. /Odalrick -- http://mail.python.o

Trouble with property

2006-10-23 Thread Odalrick
I'm having some trouble with using property. This class is supposed to represent a rectangle that can never be outside an area. I'll snip the parts I don't think are relevant. Or should I? I dunno. class ConstrainedBox: def __init__( self, size, ratio ): # Various instance va

Selecting sub-images with wxPython

2006-10-20 Thread Odalrick
ith custom paintjobs? Currently I'm using wx.lib.statbmp.GenStaticBitmap to display the image, but that has me a little worried because I can't find any documentation on it. The only reference was in an example that helped me with another problem I had. Grateful for any help.

Re: wxPython and PIL

2006-10-20 Thread Odalrick
Thanks for the answer. -- http://mail.python.org/mailman/listinfo/python-list

wxPython and PIL

2006-10-19 Thread Odalrick
I'm making a simple program to crop and scale images, essentially make thumbnails from a user defined subset of the image. I'm planning to use Python Image Library to crop and resize the images, mostly to make the resized smaller images look good. How do I display a PIL image with wxPython? --