Re: Indentation and optional delimiters

2008-02-28 Thread castironpi
On Feb 28, 12:46 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > By the way bearophile... the readability of your posts will increase a > LOT if you break it up into paragraphs, rather than use one or two giant > run-on paragraphs. > > My comments follow. > > On Tue, 26 Feb 2008

Re: Indentation and optional delimiters

2008-02-28 Thread castironpi
On Feb 28, 8:40 am, [EMAIL PROTECTED] wrote: > But the default behavior may become the "true" copy, that seems > simpler for a newbie to grasp. The language then may give a tool to > use references too (like passing arrays to functions in Pascal, you > can use "var" for pass-by-reference reference)

feedback requested

2008-02-28 Thread castironpi
I have a data structure I think would be very useful. It passes a few test cases, but one attempt to optimize it failed, so that may indicate a bug. Will anyone help me debug it, verify it, or clean it? It pertains to multi-threading and is a synchro. structure. If it is not an interest of your

Re: Decorators and buffer flushing

2008-02-28 Thread castironpi
On Feb 28, 11:49 am, "Ethan Metsger" <[EMAIL PROTECTED]> wrote: > Hi, all. > > I apologize for what is perhaps a newb question.  I'm in the process of   > transitioning our testing framework from Perl to Python.  While that alone   > probably sets off some red flags, I'm afraid it's what I'm stuck

Re: call by reference howto????

2008-02-28 Thread castironpi
On Feb 27, 6:02 pm, Tamer Higazi <[EMAIL PROTECTED]> wrote: > Hi! > Can somebody of you make me a sample how to define a function based on > "call by reference" ??? > > I am a python newbie and I am not getting smart how to define functions, > that should modify the variable I passed by reference.

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-28 Thread castironpi
On Feb 28, 10:07 am, Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Feb 28, 5:02 am, Michael Robertson <[EMAIL PROTECTED]> wrote: > > > Thanks again for your efforts here.  This particular problem didn't > > appear in any course I took...certainly similar problems did. > > And here's the obligatory

Re: Pythons & Ladders

2008-02-28 Thread castironpi
that basically everything is a number in the end, then C is a > > good choice.  More portable than assembler but nearly as close to the > > metal. > > And a better choice than C++ would be. > > > To the OP: If you try C++, don't hold that crappy language against C#, D,

Re: feedback requested

2008-02-29 Thread castironpi
On Feb 29, 12:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 28 Feb 2008 08:09:01 -0800 (PST), [EMAIL PROTECTED] declaimed > the following in comp.lang.python: > > > My goal is to return Deadlock from acquire() if its blocking would > > directly create deadlock.  Basic example: > [

Re: is there enough information?

2008-02-29 Thread castironpi
On Feb 29, 12:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 28 Feb 2008 00:54:44 -0800 (PST), [EMAIL PROTECTED] declaimed > the following in comp.lang.python: > > > On Feb 28, 2:30 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > > "It is time to show your cards or fold" > > > H

Re: call by reference howto????

2008-02-29 Thread castironpi
On Feb 29, 5:56 am, Steve Holden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 27, 6:02 pm, Tamer Higazi <[EMAIL PROTECTED]> wrote: > >> Hi! > >> Can somebody of you make me a sample how to define a function based on > >> "call by reference" ??? > > >> I am a python newbie and I

Re: Indentation and optional delimiters

2008-02-29 Thread castironpi
On Feb 28, 3:18 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | But the default behavior may become the "true" copy, that seems > | simpler for a newbie to grasp. > > To me, it is the opposite.  If I say > gvr = Guido_van_Russum # o

Re: call by reference howto????

2008-02-29 Thread castironpi
On Feb 29, 8:12 am, Steve Holden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 29, 5:56 am, Steve Holden <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >>> On Feb 27, 6:02 pm, Tamer Higazi <[EMAIL PROTECTED]> wrote: > Hi! > Can somebody of you make me a samp

Re: Indentation and optional delimiters

2008-02-29 Thread castironpi
On Feb 29, 8:59 am, Steve Holden <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: > > [EMAIL PROTECTED] wrote: > > [...] > >  > If you want a computer language to model human thought, then is there > >> even such thing as subclassing? > > > Kindly try to limit your ramblings to answerable questions

Re: feedback requested

2008-02-29 Thread castironpi
On Feb 29, 5:52 am, [EMAIL PROTECTED] wrote: > On Feb 29, 12:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > > On Thu, 28 Feb 2008 08:09:01 -0800 (PST), [EMAIL PROTECTED] declaimed > > the following in comp.lang.python: > > > > My goal is to return Deadlock from acquire() if its blocking wo

at-exit-thread

2008-02-29 Thread castironpi
The Python main interpreter has an at-exit list of callables, which are called when the interpreter exits. Can threads have one? What's involved, or is the best way merely to subclass Thread? -- http://mail.python.org/mailman/listinfo/python-list

Re: at-exit-thread

2008-02-29 Thread castironpi
On Feb 29, 1:55 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > The Python main interpreter has an at-exit list of callables, which > > are called when the interpreter exits.  Can threads have one?  What's > > involved, or is the best way merely to subclass Thre

Re: at-exit-thread

2008-02-29 Thread castironpi
On Feb 29, 2:12 pm, [EMAIL PROTECTED] wrote: > On Feb 29, 1:55 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > > > [EMAIL PROTECTED] schrieb: > > > > The Python main interpreter has an at-exit list of callables, which > > > are called when the interpreter exits.  Can threads have one?  

Re: why not bisect options?

2008-02-29 Thread castironpi
On Feb 29, 1:15 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Robert Bossy] > > > I thought it would be useful if insort and consorts* could accept the > > same options than list.sort, especially key and cmp. > > If you're going to do many insertions or searches, wouldn't it be > *much* more

Re: How to subclass a built-in int type and prevent comparisons

2008-02-29 Thread castironpi
On Feb 29, 3:09 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Bronner, Gregory" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | The native implementation of int goes to great lengths to allow > | illogical comparisons such as the one below. > | >>> import xml as x > | >>> x >

Re: at-exit-thread

2008-02-29 Thread castironpi
On Feb 29, 4:34 pm, Preston Landers <[EMAIL PROTECTED]> wrote: > On Feb 29, 2:12 pm, [EMAIL PROTECTED] wrote: > > > If a thread adds an object it creates to a nonlocal > > collection, such as a class-static set, does it have to maintain a > > list of all such objects, just to get the right ones de

UponAcquiring synchro. class

2008-03-01 Thread castironpi
from __future__ import with_statement ''' 3) upon_acquiring( lockA, lockB )( function, *ar, **kwar ) upon_acquiring spawns new thread upon acquiring locks A and B. Locks may be specified in any order, as none is acquired until all are free. The options to spawn a new thread upon call, lock, and

Re: SQLLITE

2008-03-01 Thread castironpi
On Mar 1, 11:54 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > nexes schrieb: > > > Hello All, > >    I am having a minor problem when I try and do this: > >       c.execute("insert into [tblTranscripts] (MovieID,Transcript) > > Values(" + movieID + ",'" + formatText + "');")   (don't even bot

Re: Beginner's assignment question

2008-03-01 Thread castironpi
On Mar 1, 10:07 am, Lorenzo Gatti <[EMAIL PROTECTED]> wrote: > On Mar 1, 3:39 pm, Schizoid Man <[EMAIL PROTECTED]> wrote: > > > As in variable assignment, not homework assignment! :) > > > I understand the first line but not the second of the following code: > > > a, b = 0, 1 > > a, b = b, a + b >

Re: Surprised by the command "del"

2008-03-01 Thread castironpi
On Mar 1, 2:05 pm, "K Viltersten" <[EMAIL PROTECTED]> wrote: > I'm reading the docs and at 5.2 the del > statement is discussed. At first, i thought > i've found a typo but as i tried that > myself, it turns it actually does work so. > >   a = ["alpha", "beta", "gamma"] >   del a[2:2] >   a > > Now

rpc shortcut

2008-03-01 Thread castironpi
RPC might be -really- easy. Mixin class: getattribute returns a remoting callable if ('name') is callable, or in a special list. On call, pack the parameters, execute locally, and broadcast. You'd need two mixins, BroadcasterMixin and ReceiverMixin, but the same code can still run-- how can beh

Re: Where's GUI for Python?

2008-03-01 Thread castironpi
On Mar 1, 6:49 pm, "K Viltersten" <[EMAIL PROTECTED]> wrote: > >> When that fails, try without the stutter > > >> import tkinter > > > I must be doing something wrong because > > neither tkinter nor tkininter works. > > I tried both with and without stuttering. > > I even asked my wife to stutter

Re: How to subclass a built-in int type and prevent comparisons

2008-03-01 Thread castironpi
On Mar 1, 2:58 pm, Michael Torrie <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Tell Wall. But why not [ 2, 3 ]>= 2? Back to your question, another > > option is to not subclass. > > Umm, no. You need to actually read the posts before you respond to > them. His question was whether

Re: Question about lambda and variable bindings

2008-03-01 Thread castironpi
On Mar 1, 8:50 pm, Michael Torrie <[EMAIL PROTECTED]> wrote: > I need to use a lambda expression to bind some extra contextual data > (should be constant after it's computed) to a call to a function.  I had > originally thought I could use something like this demo (but useless) code: > > funcs=[] >

Re: Beginner's assignment question

2008-03-02 Thread castironpi
On Mar 2, 4:49 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sun, 02 Mar 2008 08:25:49 -0200, Schizoid Man <[EMAIL PROTECTED]> escribi�: > > > > > > > Lorenzo Gatti wrote: > >> On Mar 1, 3:39 pm, Schizoid Man <[EMAIL PROTECTED]> wrote: > >>> As in variable assignment, not homework assignm

Network server- / client-side messaging

2008-03-02 Thread castironpi
''' a website wants to show you different arrangements of framed pictures on a wall. you can click, drag, scale, and rotate pictures in place. you can also drag new pictures in to it. spacing is uniform and settable-- if you rotate one, the readout of the total square area changes along with the

Re: Can one get "for x in y" to work for non builtin classes?

2008-03-02 Thread castironpi
On Mar 2, 8:15 am, Giles Brown <[EMAIL PROTECTED]> wrote: > On Mar 2, 2:08 pm, Preben Randhol > [EMAIL PROTECTED]> wrote: > > On Sun, 2 Mar 2008 15:06:17 +0100 > > > Preben Randhol <[EMAIL PROTECTED]> wrote: > > >    class dbase(list): > > > Sorry the definition of the class is: > > >         clas

Re: Keeping the console window

2008-03-02 Thread castironpi
On Mar 2, 9:55 am, Sam <[EMAIL PROTECTED]> wrote: > You may use python in interactive mode: > > $ python -i yourScript.py > > Or use a blocking readline: > > $ cat yourScript.py > import sys > sys.stdin.readline() > > ++ > > Sam FWIW, for what it's worth, you can invoke the interpreter from a batc

Re: Python-based regular expression parser that allows patterns to call functions?

2008-03-02 Thread castironpi
On Mar 2, 8:41 am, Andrew Warkentin <[EMAIL PROTECTED]> wrote: > I am writing a filtering HTTP proxy (the site > ishttp://xuproxy.sourceforge.net/). I want it to be compatible with > Proxomitron (http://proxomitron.info/) filters. I need a regular > expression parser that allows patterns to call f

Re: Question on importing and function defs

2008-03-02 Thread castironpi
On Mar 2, 11:44 am, Steve Holden <[EMAIL PROTECTED]> wrote: > TC wrote: > > On Mar 2, 11:37 am, Gary Herron <[EMAIL PROTECTED]> wrote: > >> TC wrote: > >>> I have a problem.  Here's a simplified version of what I'm doing: > >>> I have functions a() and b() in a module called 'mod'.  b() calls a().

Re: Problem with the strip string method

2008-03-02 Thread castironpi
On Mar 2, 11:45 am, Steve Holden <[EMAIL PROTECTED]> wrote: > I suspect what you need is the .replace() method. The information's there-- the word 'contiguous' might clear it up a bit. > > Return a copy of the string with the > > leading and trailing characters removed. > > The chars argument is

Re: Beautiful Code in Python?

2008-03-02 Thread castironpi
On Mar 2, 12:01 pm, John DeRosa <[EMAIL PROTECTED]> wrote: > On Mon, 3 Mar 2008 01:23:32 +0900, js <[EMAIL PROTECTED]> wrote: > >Hi, > > >Have you ever seen Beautiful Python code? > >Zope? Django? Python standard lib? or else? > > >Please tell me what code you think it's stunning. > > Just about an

Re: tcp

2008-03-02 Thread castironpi
On Mar 2, 11:38 am, Steve Holden <[EMAIL PROTECTED]> wrote: > Nobody thinks you are a fool for wanting help with your problems, it's > simply that you have to provide enough information about what' wring for > us to get a handle on the issues. This worked: import socket from time import time for

Re: Network server- / client-side messaging

2008-03-02 Thread castironpi
''' Last time, we left off at: ''' class InterfaceClientSide( ClientSide ): message= MessageDec() incremental= message.incremental() settings= AYT( .5, 3 ) user_act= message.out() def __init__( self, image ): self._image= image

Re: Function Overloading and Python

2008-03-02 Thread castironpi
On Feb 25, 11:04 am, [EMAIL PROTECTED] wrote: > > B1.fun(A(x), A(y), A(z)) == B.fun(A(x), A(y), A(z)) > > but > > B1.fun(A1(x), A(y), A(z) != B.fun(A1(x), A(y), A(z)) > > > Is there a data-structure solution or third party module that would > > mimic this behavior? > > class B: >    xfun= Overloade

Re: First post from a Python newbiw

2008-03-02 Thread castironpi
> >>> is there a better way of creating d?? > > >> a = [[0] * 3 for dummy in xrange(3)] > > Each element of a refers to a distinct array. > > > Why not simply [[0]*3]*3 ? > > All three elements of the result refer to the same array. ... whereas you reassign all three elements of [0]* 3. >>> ((0,)

Re: along the lines, hash and obj. id.

2008-03-02 Thread castironpi
On Feb 27, 5:38 pm, [EMAIL PROTECTED] wrote: > On Feb 27, 4:16 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > > For a), you use something like obj.a.somemethod(). "obj.a" still refers to > > the same object, even if it changed internally; if obj.a and foo.bar both > > were refering to the same objec

Re: is there enough information?

2008-03-03 Thread castironpi
On Mar 3, 7:11 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Tue, 26 Feb 2008 21:45:24 -0800, Dennis Lee Bieber <[EMAIL PROTECTED]> > wrote: > > > [snip] > > >    Threads, in Python, are good for parallel processing of items that > >tend to be I/O bound -- that is, stuff that blocks on l

Re: Altering imported modules

2008-03-03 Thread castironpi
On Mar 3, 5:09 pm, Tro <[EMAIL PROTECTED]> wrote: > On Sunday 02 March 2008, Paul McGuire wrote: > > > > > > > On Mar 2, 3:48 pm, Tro <[EMAIL PROTECTED]> wrote: > > > On Sunday 02 March 2008, Terry Reedy wrote: > > > > "Tro" <[EMAIL PROTECTED]> wrote in message > > > >news:[EMAIL PROTECTED] > > > >

Re: Beautiful Code in Python?

2008-03-03 Thread castironpi
On Mar 3, 4:30 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Mar 2, 1:18 pm, [EMAIL PROTECTED] wrote: > > > On Mar 2, 12:01 pm, John DeRosa <[EMAIL PROTECTED]> wrote: > > > > On Mon, 3 Mar 2008 01:23:32 +0900, js <[EMAIL PROTECTED]> wrote: > > > >Hi, > > > > >Have you ever seen Beautiful

metaclasses

2008-03-03 Thread castironpi
What are metaclasses? -- http://mail.python.org/mailman/listinfo/python-list

Re: sympy: what's wrong with this picture?

2008-03-03 Thread castironpi
> All software has bugs. > Good software has bugs. Therefore, good software is software. > This makes sympy worse than worthless, as it f***s up other modules. What is it still good for? -- http://mail.python.org/mailman/listinfo/python-list

Re: metaclasses

2008-03-03 Thread castironpi
On Mar 3, 8:22 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > > What are metaclasses? > > http://www.google.com/search?q=python+metaclass > > HTH, > Daniel Not satisfied. http://en.wikipedia.org/wiki/Metaclass#Python_example That's a limitation. The constructor can omit the superclass cal

Re: Polymorphism using constructors

2008-03-03 Thread castironpi
On Mar 3, 4:03 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Mar 3, 4:17 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > > Since Python doesn't support having two methods with the same name, > > the usual solution is to provide alternative constructors using > > classmethod(): > > >   @classm

Re: metaclasses

2008-03-03 Thread castironpi
On Mar 3, 10:01 pm, Benjamin <[EMAIL PROTECTED]> wrote: > On Mar 3, 7:12 pm, [EMAIL PROTECTED] wrote: > > > What are metaclasses? > > Depends on whether you want to be confused or not. If you do, look at > this old but still head bursting > essay:http://www.python.org/doc/essays/metaclasses/. > >

Re: sympy: what's wrong with this picture?

2008-03-04 Thread castironpi
On Mar 4, 10:50 am, Lie <[EMAIL PROTECTED]> wrote: > On Mar 4, 1:12 pm, Mensanator <[EMAIL PROTECTED]> wrote: > > > > > > > On Mar 3, 11:58 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: > > > > Mensanator wrote: > > > > While we're on the subject of English, the word "worthless" > > > > means "ha

Re: metaclasses

2008-03-04 Thread castironpi
On Mar 4, 12:51 am, Gerard Flanagan <[EMAIL PROTECTED]> wrote: > On Mar 4, 6:31 am, [EMAIL PROTECTED] wrote: > > > > > > > On Mar 3, 10:01 pm, Benjamin <[EMAIL PROTECTED]> wrote: > > > > On Mar 3, 7:12 pm, [EMAIL PROTECTED] wrote: > > > > > What are metaclasses? > > > > Depends on whether you want

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
On Mar 4, 5:27 am, Bruno Desthuilliers wrote: > ?? a écrit : > > > Howdy everyone, > > >      This is a big problem puzzles me for a long time. The core question is: > > How to dynamically create methods on a class or an instance? > > class Foo(object): >     pass > > def bar(self, arg): >     pri

Re: is there enough information?

2008-03-04 Thread castironpi
On Mar 3, 10:34 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Mon, 3 Mar 2008 07:00:55 -0800 (PST), [EMAIL PROTECTED] declaimed > the following in comp.lang.python: > > > What's the API call for it? > >         I'd suspect one of the win32event.WaitFor..., when combined with > win32file.Cre

Re: for-else

2008-03-04 Thread castironpi
Would you like it to be removed or its name changed? You can do it with a special iteration: for a in B: if behavior break else: 2behavior > class KeepResult:... kr= KeepResult( B ) for a in kr: if behavior break if kr.diditbreak?: 2behavior (if not: 3behavior) I

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
> > So, to answer your question: what you are decorating are functions, not > > methods. > > Can you overload -type-'s decision of what to 'bind'?... whenever it > is it makes it. >>> from types import FunctionType, MethodType >>> class A( FunctionType ): pass ... Traceback (most recent call last)

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
On Mar 4, 8:11 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 04 Mar 2008 16:45:40 -0200, <[EMAIL PROTECTED]> escribió: > > >> > So, to answer your question: what you are decorating are functions,   > >> not > >> > methods. > > >> Can you overload -type-'s decision of what to 'bind'?.

Re: Polymorphism using constructors

2008-03-04 Thread castironpi
On Mar 4, 7:06 pm, Tommy Grav <[EMAIL PROTECTED]> wrote: > On Mar 4, 2008, at 4:53 PM, Jeff Schwab wrote: > > > What does "SV" in the subject mean? > > SV = "Svar" is the Norwegian word for Reply. > > Cheers >    Tommy It is also the name of my lockermate in grade school. "So, Svar, how 'bout the

Re: for-else

2008-03-04 Thread castironpi
That you could do yourself, CMIIW correct me if I'm wrong. try:     for foo in iterex( bar_sequence ): >         # normal iteration >         spam(foo) >         if funky(foo): >             break     except StopIterationEx, exc: >         # the iterator stopped normally >         eggs(exc) >

Re: multiplication of lists of strings

2008-03-04 Thread castironpi
On Mar 4, 9:46 pm, Jason Galyon <[EMAIL PROTECTED]> wrote: > Gabriel Genellina wrote: > > En Tue, 04 Mar 2008 23:50:49 -0200, Jason <[EMAIL PROTECTED]> escribió: > > >> How could I return a list or tuple of each unique combination of a given > >> set of lists (perhaps from a dict or a list).  This

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
On Mar 4, 9:01 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 05 Mar 2008 00:30:26 -0200, <[EMAIL PROTECTED]> escribió: > > > On Mar 4, 8:11 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > >> En Tue, 04 Mar 2008 16:45:40 -0200, <[EMAIL PROTECTED]> escribió: > > >> >> Can you over

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
On Mar 4, 9:53 pm, [EMAIL PROTECTED] wrote: > > >> >> Can you overload -type-'s decision of what to 'bind'?... whenever it > > >> >> is it makes it. > > > >> from types import FunctionType, MethodType > > >> class A( FunctionType ): pass > > >> > ... > > >> > Traceback (most recent call l

Re: is there enough information?

2008-03-04 Thread castironpi
On Mar 4, 5:59 pm, David Bolen <[EMAIL PROTECTED]> wrote: > Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > > > > > > > On Mon, 3 Mar 2008 08:11:43 -0500, Jean-Paul Calderone > > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > >> I'm not sure, but you seem to be implying that t

Re: is there enough information?

2008-03-04 Thread castironpi
> How does it work?  From reading threading.py, _Condition.wait() > acquires self.lock() too many times-- that is, once to call wait > ("cannot wait on un-aquired lock"), and once after--- are "all > waiters" waiting back at self.acquire, just to make it to > self.notify... and only one at a time a

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
> > > >> >> Can you overload -type-'s decision of what to 'bind'?... whenever it > > > >> >> is it makes it. > > > > >> from types import FunctionType, MethodType > > > >> class A( FunctionType ): pass > > > >> > ... > > > >> > Traceback (most recent call last): > > > >> >   File "", line

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
On Mar 4, 10:57 pm, [EMAIL PROTECTED] wrote: > > > > >> >> Can you overload -type-'s decision of what to 'bind'?... whenever > > > > >> >> it > > > > >> >> is it makes it. > > > > > >> from types import FunctionType, MethodType > > > > >> class A( FunctionType ): pass > > > > >> > ... >

Re: Protocol for thread communication

2008-03-05 Thread castironpi
On Mar 4, 11:12 pm, Michael Torrie <[EMAIL PROTECTED]> wrote: > Does anyone have any recommended ideas/ways of implementing a proper > control and status protocol for communicating with threads?  I have a > program that spawns a few worker threads, and I'd like a good, clean way > of communicating

What is a class?

2008-03-05 Thread castironpi
What is a class that is not a module? -- http://mail.python.org/mailman/listinfo/python-list

Dual look-up on keys?

2008-03-05 Thread castironpi
I want to hash values to keys. How do the alternatives compare? -- http://mail.python.org/mailman/listinfo/python-list

Re: Using re module better

2008-03-05 Thread castironpi
On Mar 5, 6:12 am, Tim Chase <[EMAIL PROTECTED]> wrote: > > if (match = re.search('(\w+)\s*(\w+)', foo)): > > Caveat #1:  use a raw string here > Caveat #2:  inline assignment is verboten > >    match = re.search(r'(\w+)\s*(\w*+)', foo) >    if match: > > >     field1 = match.group(1) > >     field

Re: What is a class?

2008-03-05 Thread castironpi
On Mar 5, 1:29 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Mar 5, 12:50 pm, [EMAIL PROTECTED] wrote: > > > What is a class that is not a module? > > Please stop posting these one-liner beginner questions.  If you can > type it in one line, you can enter it on the Google.com or Ask.com > query

Re: Dual look-up on keys?

2008-03-05 Thread castironpi
On Mar 5, 1:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > I want to hash values to keys.  How do the alternatives compare? > > http://catb.org/~esr/faqs/smart-questions.html ... without extending the whole way to a full relational database? -- http://mail

Re: What is a class?

2008-03-05 Thread castironpi
> > > > What is a class that is not a module? > > > I'm willing to address convention, in serial or parallel--- (change > > subject to 'what goes on newsgroups'?), but it's not clear from fact > > what assumption who has made. > > Since you did not elaborate on what your efforts were and the extent

Re: Dual look-up on keys?

2008-03-05 Thread castironpi
On Mar 5, 3:38 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 05 Mar 2008 12:06:11 -0800, castironpi wrote: > > On Mar 5, 1:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > &

Re: Dual look-up on keys?

2008-03-05 Thread castironpi
On Mar 5, 3:38 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 05 Mar 2008 12:06:11 -0800, castironpi wrote: > > On Mar 5, 1:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > &

Re: What is a class?

2008-03-05 Thread castironpi
On Mar 5, 3:58 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 05 Mar 2008 10:50:12 -0800, castironpi wrote: > > What is a class that is not a module? > > Er, all of them? > > I'm curious what classes you think are modules. > &

Re: Dual look-up on keys?

2008-03-05 Thread castironpi
On Mar 5, 4:00 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-03-05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I want to hash values to keys.  How do the alternatives compare? > > http://catb.org/~esr/faqs/smart-questions.html > > >>> ... without extending the whole way to

Re: Dual look-up on keys?

2008-03-05 Thread castironpi
On Mar 5, 5:31 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-03-05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Anyway, if (a,b) is a key in dictionary d, can it guarantee > > that (b,a) is also in it, and maps to the same object? Er... -specialized- dictionary d. > To solve that pr

Re: What is a class?

2008-03-05 Thread castironpi
On Mar 5, 4:25 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 05 Mar 2008 13:49:20 -0800, castironpi wrote: > > Classes and modules are really similar.  In Python they're really > > *really* similar. > > Yes they are. > > Bot

Re: for-else

2008-03-05 Thread castironpi
On Mar 5, 6:40 pm, [EMAIL PROTECTED] wrote: > Troels Thomsen: > > > The discussion of words is silly. My surprise about "else following a for > > loop what the heck " lasted excactly as long as it takes to read > > this sentence. > > Maybe I don't follow what you are saying, but well chosen

Re: access to base class __init__

2008-03-05 Thread castironpi
On Mar 5, 6:09 pm, sambo q <[EMAIL PROTECTED]> wrote: > I got myself in jam trying to be too fancy with  threading.Thread > Docs say / remind to call the base __init__ > but I can't fighure out how. > > --- > def main() > . >     ls.listen(5) >     key = ' ' > #    while

Re: access to base class __init__

2008-03-05 Thread castironpi
On Mar 5, 6:09 pm, sambo q <[EMAIL PROTECTED]> wrote: > I got myself in jam trying to be too fancy with  threading.Thread > Docs say / remind to call the base __init__ > but I can't fighure out how. > > --- > def main() > . >     ls.listen(5) >     key = ' ' > #    while

Re: Classes and modules are singletons?

2008-03-05 Thread castironpi
On Mar 5, 8:31 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 05 Mar 2008 21:05:31 -0500, Terry Reedy wrote: > > If I understand your question, classes are not singletons: > ll=[] > for i in range(2): > >  import string > >  ll[i]=string > > Where's the IndexE

Re: Classes and modules are singletons?

2008-03-05 Thread castironpi
> > > If I understand your question, classes are not singletons: > > ll=[] > > for i in range(2): > > >  import string > > >  ll[i]=string > > > Where's the IndexError? :-) > > > I accept my question about classes being singletons is not well-formed, > > not even in my own mind. I guess o

Re: Dual look-up on keys?

2008-03-05 Thread castironpi
On Mar 5, 8:03 pm, [EMAIL PROTECTED] wrote: > On Mar 5, 5:31 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > > > On 2008-03-05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Anyway, if (a,b) is a key in dictionary d, can it guarantee > > > that (b,a) is also in it, and maps to the same object?

Re: Classes and modules are singletons?

2008-03-05 Thread castironpi
On Mar 5, 9:51 pm, [EMAIL PROTECTED] wrote: > > > > If I understand your question, classes are not singletons: > > > ll=[] > > > for i in range(2): > > > >  import string > > > >  ll[i]=string > > > > Where's the IndexError? :-) > > > > I accept my question about classes being singletons

Re: What is a class?

2008-03-05 Thread castironpi
On Mar 5, 8:06 pm, [EMAIL PROTECTED] wrote: > On Mar 5, 4:25 pm, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > > On Wed, 05 Mar 2008 13:49:20 -0800, castironpi wrote: > > > Classes and modules are really similar.  In Python they're

Re: Dual look-up on keys?

2008-03-05 Thread castironpi
> > *plonk* > > > key is an iterable, just like the constructors to > > other collection. > > Um... "*plonk*" is the (imaginary) sound made by dropping someone into > your plonkfile (killfile, scorefile, whatever): the action of setting > your newsreader to ignore someone you perceive to be a trol

Re: Classes and modules are singletons?

2008-03-05 Thread castironpi
> I accept my question about classes being singletons is not well-formed, > not even in my own mind. I guess one way of asking is, for any two class > objects (not instances) C1 and C2, does "C1 == C2" imply "C1 is C2"? C and D are instances of metaC in that. class metaC( type ): def what( self

Re: Dual look-up on keys?

2008-03-06 Thread castironpi
On Mar 6, 2:37 am, Bryan Olson <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: > > It may be  obvious that he has a question.  It's not the least > > bit obvious what that question is. > > How can we efficiently implement an abstract data type, call it > 'DoubleDict', where the state of a DoubleD

Re: What is a class?

2008-03-06 Thread castironpi
On Mar 6, 12:17 am, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > > > Where to begin? > > > What does exec( open( 'modA.py' ).read() ) do? > > The most appropriate list to ask those questions is: > > http://mail.python.org/mailman/listinfo/tutor Thanks for the reference. I'm basically experien

Re: Dual look-up on keys?

2008-03-06 Thread castironpi
On Mar 6, 5:16 am, Bryan Olson <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Bryan Olson wrote: > >> How can we efficiently implement an abstract data type, call it > >> 'DoubleDict', where the state of a DoubleDict is a binary > >> relation, that is, a set of pairs (x, y); and the oper

Re: Dual look-up on keys?

2008-03-06 Thread castironpi
> Actually, there's another data structure I was working on (a year ago > now) that's tangentially related, so if you guys want me to hold off > on that one til you or I is satisfied on the company-product map, I > will!  Otherwise, I'll just post it here and leave it to you. > (Knowing myself, som

Re: Identifying messages in a thread (was: Please keep the full address)

2008-03-06 Thread castironpi
On Mar 6, 10:47 am, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: > On Thu, 6 Mar 2008 07:58:06 -0800 (PST) > > Carl Banks <[EMAIL PROTECTED]> wrote: > > > I don't want to have to tag every thread.  I just want to *plonk* > > > certain posters. > > > > Anyway, I'll live with Google's failings I gue

Re: Please keep the full address

2008-03-06 Thread castironpi
> > > > I'm talking about castironpi.  I find his posts a waste of my time > > > > "His" posts? > > > Whatever.  I'm too old to worry about searching for politically correct, > > gender neutral pronouns. > > I'm pretty sure ev

Re: Classes and modules are singletons?

2008-03-06 Thread castironpi
On Mar 6, 8:30 am, Carl Banks <[EMAIL PROTECTED]> wrote: > On Mar 5, 8:44 pm, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > > But what about classes? Are they singletons? Obviously classes aren't > > Singleton classes, that is, given an arbitrary class C you can create > > mul

Re: What is a class?

2008-03-06 Thread castironpi
On Mar 6, 1:03 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Mar 5, 7:50 pm, [EMAIL PROTECTED] wrote: > > > What is a class that is not a module? > > A class is a bag of stuff and a namespace :) > > J. A module is a bag of stuff and a namespace. Different stuff. { '__module__', '__weak

Re: Classes and modules are singletons?

2008-03-06 Thread castironpi
On Mar 6, 2:57 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Thu, 06 Mar 2008 11:06:50 -0800, castironpi wrote: > > On Mar 6, 8:30 am, Carl Banks <[EMAIL PROTECTED]> wrote: > >> Anyway, the answer to what you are probably asking is No.  Try

Re: Protocol for thread communication

2008-03-06 Thread castironpi
> > Does anyone have any recommended ideas/ways of implementing a proper > > control and status protocol for communicating with threads?  I have a > > program that spawns a few worker threads, and I'd like a good, clean way > > of communicating the status of these threads back to the main thread. >

Re: Classes and modules are singletons?

2008-03-06 Thread castironpi
On Mar 6, 3:24 pm, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Steven D'Aprano  <[EMAIL PROTECTED]> wrote: > > > > >I accept my question about classes being singletons is not well-formed, > >not even in my own mind. I guess one way of asking is, for any two class > >objects

Re: Difference between 'function' and 'method'

2008-03-06 Thread castironpi
On Mar 6, 5:35 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 05 Mar 2008 02:57:58 -0200, <[EMAIL PROTECTED]> escribi�: > > > > > > >> > > >> >> Can you overload -type-'s decision of what to 'bind'?...   > >> whenever it > >> > > >> >> is it makes it. > > >> > > >> Use delegation inst

<    1   2   3   4   5   6   7   8   9   10   >