Re: Solve a Debate

2008-03-09 Thread castironpi
days_in_month 12: 31 30 28 31 ... 30 31 assign $days days_in_month[$month] This program consists of 2 operations (table jump and assignment) and 12 values. This makes a memory consumption of 12+2 = 14 Along the same lines, you could populate the table somewhat sparsely, and goto a

Re: Intelligent Date Time parsing

2008-03-09 Thread castironpi
On Mar 8, 12:57 pm, Tim Chase [EMAIL PROTECTED] wrote: I am a GNU newbie.  (I know C o.)  Can you point me to a place to find the source for 'date'? It's part of the GNU Coreutils: http://ftp.gnu.org/gnu/coreutils/ Within the file, you're likely interested in lib/getdate.* It helps if

Re: Want - but cannot get - a nested class to inherit from outer class

2008-03-08 Thread castironpi
On Mar 7, 7:46 pm, DBak [EMAIL PROTECTED] wrote:  However I can't do this, because, of course, the name Tree isn't  available at the time that the classes _MT and _Node are defined, so  _MT and _Node can't inherit from Tree. Not only is the name not defined, the class doesn't

Re: Timed execution in eval

2008-03-08 Thread castironpi
On Mar 7, 9:43 pm, George Sakkis [EMAIL PROTECTED] wrote: On Mar 7, 11:12 am, [EMAIL PROTECTED] wrote: I have various bits of code I want to interpret and run at runtime in eval ... Check out these two recipes: - Using

Re: Intelligent Date Time parsing

2008-03-08 Thread castironpi
On Mar 7, 9:23 pm, [EMAIL PROTECTED] wrote: I figured I might as well share the code I ended up using, in case anyone else wants an easy way to get strings to, for instance, SQL- storable datetimes. [EMAIL PROTECTED]:~$ cat test.py #!/usr/bin/python from datetime import datetime import

Re: Regarding coding style

2008-03-08 Thread castironpi
On Mar 8, 9:31 am, Grant Edwards [EMAIL PROTECTED] wrote: On 2008-03-08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: The function name also doesn't explain anything. How was the stuff got? Was it paid for, or stolen, or picked up on consignment, or what? Compare the above line with: x =

Re: What is a class?

2008-03-08 Thread castironpi
On Mar 7, 6:16 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Thu, 06 Mar 2008 08:40:47 -0800, castironpi wrote: you could say exec( open( 'modA.py' ).read() ) == import modA Yes, you could say that, but you'd be wrong. Please test your code before making such claims

Re: Difference between 'function' and 'method'

2008-03-08 Thread castironpi
On Mar 7, 1:34 pm, [EMAIL PROTECTED] wrote: On Mar 7, 6:44 am, Sion Arrowsmith [EMAIL PROTECTED] wrote: Gabriel Genellina [EMAIL PROTECTED] wrote: En Thu, 06 Mar 2008 23:46:43 -0200, [EMAIL PROTECTED] escribi�: [ ... ] You may look at the SimpleXMLRPCServer class and see how it

Re: multiplication of lists of strings

2008-03-08 Thread castironpi
On Mar 5, 2:16 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] a écrit : (snip) That reminds me:  Is there a generic 'relation' pattern/recipie, such as finding a computer that's paired with multiple users, each of who are paired with multiple computers, without

Re: multiplication of lists of strings

2008-03-08 Thread castironpi
On Mar 8, 12:04 pm, [EMAIL PROTECTED] wrote: On Mar 5, 2:16 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] a écrit : (snip) That reminds me:  Is there a generic 'relation' pattern/recipie, such as finding a computer that's paired with multiple users, each

Re: Converting a string to the most probable type

2008-03-08 Thread castironpi
On Mar 8, 12:05 pm, Pierre Quentel [EMAIL PROTECTED] wrote: def convert(x):         if '.' in x:                 try: return float(x)                 except ValueError: return x         else:                 try: return int(x)                 except: return x convert('123')

Re: Regarding coding style

2008-03-08 Thread castironpi
On Mar 8, 1:31 pm, Grant Edwards [EMAIL PROTECTED] wrote: On 2008-03-08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Does one side of this hold that there are no -good- comments? I wouldn't say there are _no_ good comments, but I would say that 90+% of the comments I've seen in my lifetime

Re: Regarding coding style

2008-03-08 Thread castironpi
On Mar 8, 1:31 pm, Grant Edwards [EMAIL PROTECTED] wrote: On 2008-03-08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Does one side of this hold that there are no -good- comments? I wouldn't say there are _no_ good comments, but I would say that 90+% of the comments I've seen in my lifetime

Re: for-else

2008-03-08 Thread castironpi
The idea of the if-else is: .  depending on some condition either do this or do something else, .  don't do them both. yes = the loop completed. 'else' isn't rechecking a piece of the loop, it's checking the loop. Does it test successfully--- not the loop condition, the loop? What is 'if a

Re: Can't get items out of a set?

2008-03-08 Thread castironpi
something something equivalence class. The intern() builtin uses this approach:    interned = {}    def intern(s):         if s in interned:             return interned[s]         interned[s] = s         return s If you've seen it before, and have the old one, return the old one. Do I

Re: List as FIFO in for loop

2008-03-08 Thread castironpi
Notice that the language specification *deliberately* does not distinguish between deletion of earlier and later items, but makes modification of the sequence undefined behavior to allow alternative implementations. E.g. an implementation that would crash, erase your hard disk, or set your

Re: While executing the class definition which object is referenced by the first argument of the class method, Y r Object attributes not allowed as default arguments

2008-03-07 Thread castironpi
On Mar 7, 11:49 am, Krishna [EMAIL PROTECTED] wrote: On Mar 6, 5:04 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Thu, 06 Mar 2008 22:48:42 -0200, Krishna [EMAIL PROTECTED] escribi�: class Test(object): ...     def __init__(self): ...             self.a= 2 ...     def

Re: islice == [::]

2008-03-07 Thread castironpi
I find itertools.islice() useful, so for Python 3.x I may like to see general iterables.  Third, the analogy breaks down quickly (i.e. chain(it[:2], it[2:]) does not give the same result as iter(it) unless s = 'abcdefg' list(W(s)[2:]) Slice literals are a logical next step, precedented

Re: Difference between 'function' and 'method'

2008-03-07 Thread castironpi
On Mar 7, 6:44 am, Sion Arrowsmith [EMAIL PROTECTED] wrote: Gabriel Genellina [EMAIL PROTECTED] wrote: En Thu, 06 Mar 2008 23:46:43 -0200, [EMAIL PROTECTED] escribi�: [ ... ] You may look at the SimpleXMLRPCServer class and see how it implements   introspection. It's rather easy (and

Re: Converting a string to the most probable type

2008-03-07 Thread castironpi
And so on and so forth.  The tricky bit is how to tell the difference between Day, Month and Year. There isn't one. -- http://mail.python.org/mailman/listinfo/python-list

Re: Timed execution in eval

2008-03-07 Thread castironpi
On Mar 7, 10:12 am, [EMAIL PROTECTED] wrote: I have various bits of code I want to interpret and run at runtime in eval ... I want to be able to detect if they fail with error, I want to be able to time them, and I want to be able to stop them if they run too long.  I cannot add code to the

Re: Timed execution in eval

2008-03-07 Thread castironpi
On Mar 7, 10:12 am, [EMAIL PROTECTED] wrote: I have various bits of code I want to interpret and run at runtime in eval ... import sys from time import clock, sleep from threading import Timer TimeoutError= type('TimeoutError',(Exception,),{}) class Elapse: def __init__( self ):

Re: Want - but cannot get - a nested class to inherit from outer class

2008-03-07 Thread castironpi
On Mar 7, 3:19 pm, Chris Mellon [EMAIL PROTECTED] wrote: On Fri, Mar 7, 2008 at 3:00 PM, DBak [EMAIL PROTECTED] wrote:  I would like to build a class for a data structure such that nodes of  the data structure - of interest only to the data structure  implementation itself and not to the

Re: Regarding coding style

2008-03-07 Thread castironpi
Grant Edwards                   grante             Yow! A shapely CATHOLIC                                   at               SCHOOLGIRL is FIDGETING                                visi.com            inside my costume.. ... Are you wearing it? *plonkblock* So, what gets you plonked around

Re: Want - but cannot get - a nested class to inherit from outer class

2008-03-07 Thread castironpi
On Mar 7, 4:39 pm, DBak [EMAIL PROTECTED] wrote: On Mar 7, 1:19 pm, Chris Mellon [EMAIL PROTECTED] wrote: On Fri, Mar 7, 2008 at 3:00 PM, DBak [EMAIL PROTECTED] wrote:  However I can't do this, because, of course, the name Tree isn't  available at the time that the classes _MT and _Node

Re: Intelligent Date Time parsing

2008-03-07 Thread castironpi
On Mar 7, 5:00 pm, [EMAIL PROTECTED] wrote: On Mar 7, 4:35 pm, Jeffrey Froman [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I need something to parse user input for a django app, and it's awesome to be able to write last monday, a year ago, or 10pm tuesday like PHP's strtotime.

Re: Nested phrases [was Re: Want - but cannot get - a nested class to inherit from outer class]

2008-03-07 Thread castironpi
On Mar 7, 6:39 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Fri, 07 Mar 2008 14:26:25 -0800, castironpi wrote: Humans have enormous mental stacks--- the stacks the contexts the speakers speak in push things they're hearing on to. This is not true. Oh yeah. (See below

Re: Timed execution in eval

2008-03-07 Thread castironpi
On Mar 7, 4:07 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: I want to be able to detect if [certain threads] fail with error, You can't? Why ever not? Try this. ext can be found in 'C Function in a Python Context' on google groops. import ext extA= ext.Ext() extA[

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 DoubleDict is a

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 experienced with

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 operations on a

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,

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 guess. Sounds like

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 even the most PC people wouldn't suggest using a masculine pronoun for an inanimate

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 multiple

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__', '__weakref__'} --

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 this: import module c1 = module.Someclass

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

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 (not

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 instead of inheritance. This class is almost

Re: Difference between 'function' and 'method'

2008-03-06 Thread castironpi
On Mar 6, 7:10 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Thu, 06 Mar 2008 22:56:33 -0200, [EMAIL PROTECTED] escribió: On Mar 6, 5:35 am, Gabriel Genellina [EMAIL PROTECTED] wrote: p = P() print p.bar.func_name # - bar p.bar.im_func.anotherattribute = 1 print

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 the

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)     field2 =

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 page and

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

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 they were

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: I want to hash values to keys.  How do the alternatives compare

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: I want to hash values to keys.  How do the alternatives compare

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. -- Steven Thank you for your time in entertaining

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 a full relational

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

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. Both are namespaces. The very last line of the Zen

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 words are

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 key !=

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 key !=

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 IndexError? :-) ll[0]

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 one way of asking is, for any

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? Er...

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 is not well-formed, not even

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 really *really* similar. Yes they are. Both

Re: Dual look-up on keys?

2008-03-05 Thread castironpi
*plonk* key is an iterable, just like the constructors to bleep bl bbl bleep 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

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: 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 has no value. So, a program

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 to be confused or not.

Re: Difference between 'function' and 'method'

2008-03-04 Thread castironpi
On Mar 4, 5:27 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] 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,

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

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)

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

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'?... whenever it is it

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 them posters? --

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

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 overload -type-'s decision

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 last):   File stdin, line 1, in

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 the only way to use

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 at that!?

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 stdin, line 1, in module TypeError: type 'function'

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 ... Traceback (most recent call last):   File

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 lots of I/O

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] | Hi, list. | | I've

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 Python code? Zope?

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 call, but it

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():   @classmethod   def

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/. Basically,

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 assignment! :) I

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

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 batch file/shell

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

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(). So now, I have

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 a string

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 any Python code I

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 i

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= Overloaded()    def

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,)*3,)*3 ((0, 0,

<    3   4   5   6   7   8   9   10   11   >