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 object, they

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,

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 bother commenting of

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 In the first

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, i expected the

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

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 G 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 some but, sadly,

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 or not to

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=[] def

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: [ The

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 Here.  Run it.  

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 am not getting smart

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 # or any natural

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 sample how to define a

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. Without keen

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 would

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

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?  What's

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 efficient

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 | module 'xml' from

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 destroyed

Re: Pythons Ladders

2008-02-28 Thread castironpi
On Feb 28, 1:10 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 27 Feb 2008 19:18:27 -0800, Jeff Schwab wrote: Benoit wrote: I've been teaching myself the python language over the past few months using Mark Lutz' Learning Python, 3ed.  Python is also the first programming

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-28 Thread castironpi
On Feb 27, 8:47 pm, Michael Robertson [EMAIL PROTECTED] wrote: Michael Robertson wrote the following on 02/27/2008 06:40 PM: Hi, I need a generator which produces all ways to place n indistinguishable items into k distinguishable boxes. My first thought was to generate all integer

Re: is there enough information?

2008-02-28 Thread castironpi
On Feb 28, 2:30 am, Dennis Lee Bieber [EMAIL PROTECTED] wrote: It is time to show your cards or fold Here. Run it. Download Python 3.0a2. from thread import start_new_thread as launch from threading import Lock import time from functools import partial class WithObj: def __init__( self,

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

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

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

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

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
be. To the OP: If you try C++, don't hold that crappy language against C#, D, or Java.  ;-) What's the relevance of C#, D, or Java to the OP's post? public static void synchronized flamewar() {} virtual void flamewar() {} def flamewar(): pass [ castironpi has changed the newsgroup

Re: is there enough information?

2008-02-27 Thread castironpi
On Feb 26, 11:45 pm, Dennis Lee Bieber [EMAIL PROTECTED] wrote: Warning -- long post follows On Tue, 26 Feb 2008 12:17:54 -0800, Dennis Lee Bieber [EMAIL PROTECTED] declaimed the following in comp.lang.python: Which is, it seems, totally backwards... Also... to my knowledge,

Re: object identity and hashing

2008-02-27 Thread castironpi
On Feb 25, 7:44 pm, Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 24, 9:28 pm, George Sakkis [EMAIL PROTECTED] wrote: [1]http://www.martinfowler.com/eaaCatalog/identityMap.html [1] illustrates a case in which 'a is a' returns False, and in the other corner of the

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

2008-02-27 Thread castironpi
On Feb 27, 4:16 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 26 Feb 2008 05:58:52 -0200, [EMAIL PROTECTED] escribió: It works to keep a reference to the object, then access the member again. If your only reference to the object is the member itself, obj.a= {} breaks d, but

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-27 Thread castironpi
On Feb 27, 9:03 pm, Michael Robertson [EMAIL PROTECTED] wrote: Roy Smith wrote the following on 02/27/2008 06:56 PM: What course is this homework problem for? None.  I assume you have an answer to this *trivial* problem... It's actually a very general question relating to a very specific

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-27 Thread castironpi
On Feb 27, 9:31 pm, Michael Robertson [EMAIL PROTECTED] wrote: Michael Robertson wrote the following on 02/27/2008 06:40 PM: I need a generator which produces all ways to place n indistinguishable items into k distinguishable boxes. I found:

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-27 Thread castironpi
On Feb 27, 8:40 pm, Michael Robertson [EMAIL PROTECTED] wrote: Hi, I need a generator which produces all ways to place n indistinguishable items into k distinguishable boxes. For n=4, k=3, there are (4+3-1)!/(3-1)!/4! = 15 ways. (0,0,4) (0,4,0) (4,0,0) (0,2,2) (2,0,2) (2,2,0)

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-27 Thread castironpi
On Feb 27, 10:12 pm, [EMAIL PROTECTED] wrote: On Feb 27, 8:40 pm, Michael Robertson [EMAIL PROTECTED] wrote: Hi, I need a generator which produces all ways to place n indistinguishable items into k distinguishable boxes. For n=4, k=3, there are (4+3-1)!/(3-1)!/4! = 15 ways.

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-27 Thread castironpi
On Feb 27, 10:41 pm, Mark Dickinson [EMAIL PROTECTED] wrote: On Feb 27, 11:38 pm, Mark Dickinson [EMAIL PROTECTED] wrote:             yield map(len, (''.join(s)).split('|')) That line should have been just:             yield map(len, s.split('|')) of course. Mark It's easier: def

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-27 Thread castironpi
On Feb 27, 10:49 pm, Michael Robertson [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote the following on 02/27/2008 08:46 PM: Just sort the list in text-ascending order, and it's pretty clear. Indeed.  After trying Mark's solution, I saw that it sorted in a very nice manner. You could also

Re: Place n indistinguishable items into k distinguishable boxes

2008-02-27 Thread castironpi
On Feb 27, 10:46 pm, [EMAIL PROTECTED] wrote: On Feb 27, 10:41 pm, Mark Dickinson [EMAIL PROTECTED] wrote: On Feb 27, 11:38 pm, Mark Dickinson [EMAIL PROTECTED] wrote:             yield map(len, (''.join(s)).split('|')) That line should have been just:             yield map(len,

Re: call by reference howto????

2008-02-27 Thread castironpi
On Feb 27, 10:38 pm, Dan Bishop [EMAIL PROTECTED] wrote: What exactly are you wanting to do? I'm having a hard time considering your question in the general case. I'm thinking of too many cases, the details of which are relevant to the answer, to even subdivide them. My specialty is specific

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

2008-02-26 Thread castironpi
On Feb 25, 11:30 pm, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Mon, 25 Feb 2008 17:55:18 -0800 (PST), [EMAIL PROTECTED] declaimed the following in comp.lang.python: I'd like to do this: a= list( range( 5 ) ) assert a== [ 0, 1, 2, 3, 4 ] for i in ref( a ):     i.ref*= 2 a=

Re: is there enough information?

2008-02-26 Thread castironpi
 Create a class which will ensure turn-taking of events, using a get method with and integer index, by waiting for the prior index to complete before starting the next. from thread import start_new_thread as launch from threading import Lock import time from functools import partial class

Re: dict.get and str.xsplit

2008-02-26 Thread castironpi
On Feb 26, 8:14 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Tue, 26 Feb 2008 06:02:12 -0800, bearophileHUGS wrote: This is a real difference, that has real impact on the programs I write, so I often use the if/else approach, despite the dict.get() method being semantically

Re: Indentation and optional delimiters

2008-02-26 Thread castironpi
On Feb 26, 7:36 am, [EMAIL PROTECTED] wrote: This is the best praise of semantic indentation I have read so far, by Chris Okasaki:http://okasaki.blogspot.com/2008/02/in-praise-of-mandatory-indentatio... A quotation: Imagine my surprise when I started teaching this language and found the

Re: dict.get and str.xsplit

2008-02-26 Thread castironpi
On Feb 26, 8:40 am, [EMAIL PROTECTED] wrote: Marc 'BlackJack' Rintsch: I guess it's the method lookup that's the slow part.  Factor it out of the loop and measure again:: I did know of that optimization, but sometimes I forget about it... The new timings: Output timings, best of 3,

Re: Indentation and optional delimiters

2008-02-26 Thread castironpi
On Feb 26, 9:45 am, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED]: Why not b = copyonwrite( a )? Subclass the interpreter-- make your own session. Your idea may work, but I am talking about a new language (with some small differences, not a revolution). Making such language efficient enough

Re: How to turn a list of tuples into a dictionary?

2008-02-26 Thread castironpi
On Feb 26, 11:00 am, mrstephengross [EMAIL PROTECTED] wrote: Let's say I've got a list of tuples, like so:   ( ('a', '1'), ('b', '2'), ('c', '3') And I want to turn it into a dictionary in which the first value of each tuple is a key and the second value is a value, like so:   { 'a' - '1',

Re: is there enough information?

2008-02-26 Thread castironpi
On Feb 26, 10:59 am, Preston Landers [EMAIL PROTECTED] wrote: On Feb 26, 1:45 am, [EMAIL PROTECTED] wrote: Two options occurred to me, which the first showed up in the earlier extremely skeletal and cryptic post: Perhaps you would be more likely to get the kind of help you seem to want

Re: is there enough information?

2008-02-26 Thread castironpi
On Feb 26, 11:37 am, Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 26, 10:59 am, Preston  Landers [EMAIL PROTECTED] wrote: On Feb 26, 1:45 am, [EMAIL PROTECTED] wrote: Two options occurred to me, which the first showed up in the earlier extremely skeletal and

Re: is there enough information?

2008-02-26 Thread castironpi
On Feb 26, 12:04 pm, Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 26, 11:37 am, Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 26, 10:59 am, Preston  Landers [EMAIL PROTECTED] wrote: On Feb 26, 1:45 am, [EMAIL PROTECTED] wrote: Two options

Re: Indentation and optional delimiters

2008-02-26 Thread castironpi
On Feb 26, 11:27 am, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED]: It's Unpythonic to compile a machine instruction out of a script.  But maybe in the right situations, with the right constraints on a function, certain chunks could be native, almost like a mini- compilation.  How much

bribery tax-deductible in Netherlands?

2008-02-26 Thread castironpi
Netherlands - 2006 Investment Climate Statement - The Netherlands New anti-bribery legislation, ... The new anti-bribery law reconciles the language of the OECD anti-bribery convention ... bribes are no longer deductible for corporate tax purposes. http://www.state.gov/e/eeb/ifd/2006/62022.htm

Re: is there enough information?

2008-02-26 Thread castironpi
On Feb 26, 12:37 pm, Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 26, 12:04 pm, Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 26, 11:37 am, Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 26, 10:59 am, Preston  Landers

Re: How to turn a list of tuples into a dictionary?

2008-02-26 Thread castironpi
On Feb 26, 11:15 am, mrstephengross [EMAIL PROTECTED] wrote: How about this?   d = dict(tuples) Aha! I hadn't realized it could be so simple. --Steve In terms of a metric for code, 'And runs in a single line!' may be a bit deceptive. [Counterexample snipped.] Absent repeating the line

Re: is there enough information?

2008-02-26 Thread castironpi
On Feb 26, 12:42 pm, Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 26, 12:37 pm, Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 26, 12:04 pm, Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 26, 11:37 am, Jeff Schwab

Re: is there enough information?

2008-02-26 Thread castironpi
On Feb 26, 1:11 pm, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Tue, 26 Feb 2008 09:49:00 -0800 (PST), [EMAIL PROTECTED] declaimed the following in comp.lang.python: I am not a troll.  I want a sustainable, healthy, productive, educational, informative relationship with frequenters

Re: Indentation and optional delimiters

2008-02-26 Thread castironpi
On Feb 26, 5:22 pm, [EMAIL PROTECTED] wrote: Steven D'Aprano: Usability for beginners is a good thing, but not at the expense of teaching them the right way to do things. Insisting on explicit requests before copying data is a *good* thing. If it's a gotcha for newbies, that's just a

Re: is there enough information?

2008-02-26 Thread castironpi
On Feb 26, 8:31 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 26 Feb 2008 15:49:00 -0200, [EMAIL PROTECTED] escribió: I'm not quite sure a semaphore is exactly the synchronization object I'm looking for, but I'm a little new to concurrency myself. The easiest way to implement a

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

2008-02-26 Thread castironpi
On Feb 26, 1:11 pm, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Mon, 25 Feb 2008 23:58:52 -0800 (PST), [EMAIL PROTECTED] declaimed the following in comp.lang.python: The generic solution involves a second level of indirection: tuple* d= obj.a.  I can't land a clean solution to it though.

Re: Fwd: Problem with threads in python????????

2008-02-26 Thread castironpi
On Feb 26, 7:56 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 26 Feb 2008 01:46:48 -0200, Manikandan R [EMAIL PROTECTED]   escribió: Hai,           Is it possible to share a single variable between multiple threads. For eg: Class A:          thread_init()        def

Re: is there enough information?

2008-02-26 Thread castironpi
On Feb 26, 4:15 pm, Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 26, 12:42 pm, Jeff Schwab [EMAIL PROTECTED] wrote: ... th1       th2 set cmd           run cmd get result           acknowledge continue  continue th2 won't -run cmd- until th1 completes -set

Re: is there enough information?

2008-02-26 Thread castironpi
On Feb 26, 2:17 pm, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Tue, 26 Feb 2008 10:39:04 -0800 (PST), [EMAIL PROTECTED] declaimed the following in comp.lang.python: The relevant snippet is: def thloop( thd ):     while thd.cont:         with thd.step[1]:             if not

Re: bribery tax-deductible in Netherlands?

2008-02-26 Thread castironpi
Netherlands - 2006 Investment Climate Statement - The Netherlands         This has NOTHING to do with comp.lang.python, and posts such as this are the signs of spammers and trolls, and will rapidly lead to one being kill-filed. Biography Van Rossum was born and grew up in the Netherlands

Re: object identity and hashing

2008-02-25 Thread castironpi
But this doesn't tell you anything about Python except that it's flexible enough to construct counter-intuitive classes. Everything you have been told is true for the normal cases you will come across in everyday usage. If you want to play in the obscure corners of the language that's fine,

Re: Function Overloading and Python

2008-02-25 Thread castironpi
On Feb 25, 1:33 am, Allen Peloquin [EMAIL PROTECTED] wrote: I have a personal project that has an elegant solution that requires both true multiple inheritance of classes (which pretty much limits my language choices to C++ and Python) and type-based function overloading. Now, while this

Re: Function Overloading and Python

2008-02-25 Thread castironpi
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? ''' An Overloaded instance, B.xfun, is created in the base class of the classes the members

Re: Array of functions, Pythonically

2008-02-25 Thread castironpi
 { '+': operator.add, '-': operator.sub, ... } Then EXPR OPER EXPR - ops[ OPER ]( EXPR, EXPR ), right? -- http://mail.python.org/mailman/listinfo/python-list

along the lines, hash and obj. id.

2008-02-25 Thread castironpi
I'd like to do this: a= list( range( 5 ) ) assert a== [ 0, 1, 2, 3, 4 ] for i in ref( a ): i.ref*= 2 a= deref( a ) assert a== [ 0, 2, 4, 6, 8 ] In the for loop, i objects maintain their identities, while still being reassigned. The first way I think of is this: class Ref: def __init__(

is there enough information?

2008-02-25 Thread castironpi
Specify def thloop( th ): while th.cont: with th.step[2]: th.ret= th.cmd+ 1 def acq( th ): with th.step[1]: th.cmd= 100 with th.step[3]: ret1= th.ret th.step.reset() assert ret1== 101 Is it enough? --

Re: is there enough information?

2008-02-25 Thread castironpi
On Feb 25, 11:52 pm, Paul McGuire [EMAIL PROTECTED] wrote: On Feb 25, 9:30 pm, [EMAIL PROTECTED] wrote: Is it enough? (Reminds me of the movie Marathon Man, in which Dustin Hoffman is repeatedly asked by Laurence Olivier, Is it safe?  Hoffman had no idea what Olivier was talking about.  

Re: is there enough information?

2008-02-25 Thread castironpi
Clarify: def thdloop( thd ):    while thd.cont:       thd.sig1event.wait()       ret= thd.cmd() thd.result= ret       thd.sig2event.set()       thd.seg3event.wait() and def consumer( thd ): thd.cmd= function thd.sig1event.set() thd.sig2event.wait() ret= thd.result

object identity and hashing

2008-02-24 Thread castironpi
Can someone explain this? a= {} a[(3,)]= 0 (3,) in a True (3,) is (3,) False -- http://mail.python.org/mailman/listinfo/python-list

Re: object identity and hashing

2008-02-24 Thread castironpi
On Feb 24, 7:58 pm, Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Can someone explain this? a= {} Create an empty dict and bind it to the name a. a[(3,)]= 0 Set the key/value pair (3,):0 to the dict. (3,) in a Is (3,) one of the keys in the dict? True Yes, it

Re: object identity and hashing

2008-02-24 Thread castironpi
On Feb 24, 9:28 pm, George Sakkis [EMAIL PROTECTED] wrote: On Feb 24, 9:11 pm, [EMAIL PROTECTED] wrote: On Feb 24, 7:58 pm, Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Can someone explain this? a= {} Create an empty dict and bind it to the name a.

@synchronized dect'r c.

2008-02-23 Thread castironpi
To whoso has a serious interest in multi-threading: What advanced thread techniques does Python support? 1) @synchronized @synchronized def function( arg ): behavior() Synchronized prevents usage from more than one caller at once: look up the function in a hash, acquire its lock, and call.

Re: Replacing 'if __name__ == __main__' with decorator (was: Double underscores -- ugly?)

2008-02-23 Thread castironpi
@mainmethod def main(...) and like this: @mainmethod(parser=myparser) def main(...) then you cannot use that decorator for a function that expects or allows a function as its first argument? Because how and If it's called with only one non-keyword parameter, then the language might have

Re: @synchronized dect'r c.

2008-02-23 Thread castironpi
Corrections. Typographical error in the implementation of #1. def synchronized( func ): def presynch( *ar, **kwar ): with _synchlock: lock= _synchhash.setdefault( func, allocate_lock() ) with lock: return func( *ar, **kwar ) return presynch On footnote #4,

Re: @synchronized dect'r c.

2008-02-23 Thread castironpi
On Feb 23, 6:19 pm, Paul McGuire [EMAIL PROTECTED] wrote: On Feb 23, 2:03 pm, [EMAIL PROTECTED] wrote: 1) [EMAIL PROTECTED] @synchronized def function( arg ):    behavior() Synchronized prevents usage from more than one caller at once: look up the function in a hash, acquire

Re: @synchronized dect'r c.

2008-02-23 Thread castironpi
On Feb 23, 7:47 pm, [EMAIL PROTECTED] wrote: On Feb 23, 6:19 pm, Paul McGuire [EMAIL PROTECTED] wrote: On Feb 23, 2:03 pm, [EMAIL PROTECTED] wrote: 1) [EMAIL PROTECTED] @synchronized def function( arg ):    behavior() Synchronized prevents usage from more than one caller

Re: The big shots

2008-02-20 Thread castironpi
On Feb 19, 7:52 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 19 Feb 2008 23:19:29 -0200, [EMAIL PROTECTED] escribió: But 'ext' is actually good. Even if it were, that alone doesn't mean it should be included in the   stdlib. Start writting a recipe in the Python Cookbook:  

Re: The big shots

2008-02-20 Thread castironpi
On Feb 20, 1:14 pm, Kay Schluehr [EMAIL PROTECTED] wrote: On 19 Feb., 04:14, [EMAIL PROTECTED] wrote: The printing press, rail, automobiles, and Python, were not in prevalent use before their invention. True but automobiles fuelled with newspapers and driven by Pythons still aren't.

Re: The big shots

2008-02-20 Thread castironpi
On Feb 20, 6:02 pm, Ben Finney [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] writes: My writing isn't unclear Please re-assess that statement in light of the dozens of responses from many people in the last few weeks, telling you that your writing *is* unclear. For what it's worth, I've

For discussion, semantic construct

2008-02-20 Thread castironpi
Here is a construction for passing parameters. I include the Python idea, a C/C++ equivalent, and write a little about it. (Blech.) It is a little obscure, and my use cases are not as good as yours. So say yours. The presentation is structured: problem, solution. Problem: Sometimes you need

Re: Bored now [was Re: The big shots]

2008-02-20 Thread castironpi
On Feb 20, 7:57 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: Trying to decipher the fractured, incoherent ramblings of castironpi has lost it's amusement value. I no longer care whether the poster is a bot, or a loser nowhere near as smart as he thinks he is with few social

Re: What's the standard for code docs?

2008-02-20 Thread castironpi
On Feb 20, 4:42 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Tue, 19 Feb 2008 16:37:23 -0800, Preston  Landers wrote: On Feb 19, 4:31 pm, [EMAIL PROTECTED] wrote: But after reading some of your other recent posts on other topics, I'm not confident that it was intended to make

Re: Double underscores -- ugly?

2008-02-20 Thread castironpi
On Feb 19, 8:20 pm, Steve Holden [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 19, 10:26 am, Wildemar Wildenburger [EMAIL PROTECTED] wrote: Jason wrote: Hmm.  I must be the only person who doesn't think the double underscores are ugly. Nope. I like them too. :) Frankly,

Re: standardization allows?

2008-02-20 Thread castironpi
On Feb 19, 9:41 pm, Paddy [EMAIL PROTECTED] wrote: On Feb 13, 10:41 pm, [EMAIL PROTECTED] wrote: Standardization helps avoid the readability and reliability problems which arise when many different individuals create their own slightly varying implementations, each with their own quirks

Re: C function in a Python context

2008-02-19 Thread castironpi
#include string #include vector This modification required: compilercommand='c:/programs/mingw/bin/g++' and strctypes= { 'i': 'int', 's': 'const char*', 'O': 'PyObject*' } The output is: #include c:/programs/python/include/Python.h [ user code ] static PyObject *

Re: Passing a callable object to Thread

2008-02-19 Thread castironpi
        The ice-cream example given earlier does /not/ fit the idea of a tuple to me; Vanilla, Chocolate, and Strawberry isn't a tuple -- it's a list... Flavor* flavors[]= { Vanilla, Chocolate, Strawberry }; flavorct= 3; -- http://mail.python.org/mailman/listinfo/python-list

Re: The big shots

2008-02-19 Thread castironpi
On Feb 19, 5:17 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: Diez B. Roggisch a écrit : [EMAIL PROTECTED] schrieb: I'm a little dissatisfied, and just thinking aloud. (snip remaining of mostly inarticulate post, just couldn't make sens of it - as usual) No idea what's wrong

Re: standardization allows?

2008-02-19 Thread castironpi
On Feb 13, 4:41 pm, [EMAIL PROTECTED] wrote: Standardization helps avoid the readability and reliability problems which arise when many different individuals create their own slightly varying implementations, each with their own quirks and naming conventions. Standardization allows RCA

Re: The big shots

2008-02-19 Thread castironpi
On Feb 19, 3:15 pm, Carsten Haese [EMAIL PROTECTED] wrote: On Tue, 2008-02-19 at 12:49 -0800, [EMAIL PROTECTED] wrote: Ok, take this one.  C is faster than Python.  It would be useful, in certain cases, to write C. It is possible but inconvenient, out of the way. Making that easier is a

Re: The big shots

2008-02-19 Thread castironpi
On Feb 19, 12:37 am, George Sakkis [EMAIL PROTECTED] wrote: On Feb 19, 12:08 am, [EMAIL PROTECTED] wrote: The problem did not seem to be miscommunication, rather bias. IMHO it's partly because of the obscurity of the ideas and the code you suggest, and partly because of the poor job you do

Re: standardization allows?

2008-02-19 Thread castironpi
On Feb 19, 4:05 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] writes: Standardization allows RCA cables, bumpers, and 115V plugs.  The Bill of Rights allows Huckleberry Finn.  What is the analogue of the Bill of Rights for programmers and users, whether of programming

Re: Hairy brainstorm

2008-02-19 Thread castironpi
On Feb 15, 11:43 pm, [EMAIL PROTECTED] wrote: On Feb 15, 8:04 pm, [EMAIL PROTECTED] wrote: Hold the future holds effectively nothing for single-threaded programs; single-core PUs have reached the point of diminishing returns of circuit size and IC design; thinking multi-threaded's the

Re: Solve a Debate

2008-02-19 Thread castironpi
Past a many-small certain point on numbers of hash-tables, if that's the right word, in a program, and intepreter process on a machine, is it be more time-efficient to allocate a 2**32-byte table?  Are 'modulo' and 'doublesize' the only steps of the lookup process that it would eliminate, and

Re: standardization allows?

2008-02-19 Thread castironpi
On Feb 19, 3:47 pm, Gerardo Herzig [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Standardization allows RCA cables, bumpers, and 115V plugs.  The Bill of Rights allows Huckleberry Finn.  What is the analogue of the Bill of Rights for programmers and users, whether of programming languages

<    4   5   6   7   8   9   10   11   >