Hairy brainstorm

2008-02-15 Thread castironpi
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 way to go. Recognizing that even in event-driven programs, order of execution is important, what does a

Re: Solve a Debate

2008-02-15 Thread castironpi
On Feb 15, 12:32 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-02-15, Ivan Van Laningham <[EMAIL PROTECTED]> wrote: > > > Lookup tables are always significantly faster than a bunch of > > ifs. > > Mostly always.  It depends on what you mean by "lookup table", > and it depends on how the la

Re: Hairy brainstorm

2008-02-15 Thread castironpi
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 > way to go. > > Recognizing that even in event-drive

Re: QOTW: Re: dream hardware

2008-02-16 Thread castironpi
> IHNTA, IJWTSA > > Thanks, but... That defines IHNTA, but not IJWTSA or IJWTW.  "I just > want to say...?"  "I just want to watch?"- Hide quoted text - I just want to what? -- http://mail.python.org/mailman/listinfo/python-list

Re: Solve a Debate

2008-02-16 Thread castironpi
On Feb 15, 11:50 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Dan Bishop wrote: > > On Feb 15, 10:24 am, nexes <[EMAIL PROTECTED]> wrote: > >> Alright so me and my friend are having argument. > > >> Ok the problem we had been asked a while back, to do a programming > >> exercise (in college) > >>

Re: Solve a Debate

2008-02-16 Thread castironpi
> days_in_month = lambda m: m - 2 and 31 - ((m + 9) % 12 % 5 % 2) or 28 > > the guts of which is slightly more elegant than the ancient writing > from which it was derived: Lacks citation. -- http://mail.python.org/mailman/listinfo/python-list

Re: An idea for fast function composition

2008-02-16 Thread castironpi
On Feb 16, 3:47 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > Hi all, > > Recently there was a thread about function composition in Python (and > this was probably not the first).  The fast way to create a > (anonymous) composite function > >      f1 o f2 o ... o fn > > in Python is via > >    

Re: An idea for fast function composition

2008-02-16 Thread castironpi
> def compose( funcs ): >    def reccompose( *args ): >       return compose( funcs[:-1] )( funcs[-1]( *args ) ) if funcs else > funcs[0]( *args ) >    return reccompose- Hide quoted text - Which was, if funcs> 1, which is len( funcs )> 1. >>> [1]>0 Traceback (most recent call last): File "", li

Re: An idea for fast function composition

2008-02-16 Thread castironpi
On Feb 16, 5:57 pm, Boris Borcic <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 16, 3:47 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > >> Hi all, > > >> Recently there was a thread about function composition in Python (and > >> this was probably not the first).  The fast way t

Re: Solve a Debate

2008-02-17 Thread castironpi
On Feb 17, 7:05 am, Wolfgang Draxinger <[EMAIL PROTECTED]> wrote: > nexes wrote: > > there is more data that needed to be assigned(i.e. a couple > > megs of data) it would be simpler (and more efficient) to > > do a compare rather then assigning all that data to an array, > > since you are only goi

Re: QOTW: Re: dream hardware

2008-02-17 Thread castironpi
]> wrote: > >>>> [EMAIL PROTECTED] wrote: > >>>>> On Feb 14, 10:50 pm, [EMAIL PROTECTED] (Aahz) wrote: > >>>>>> In article <[EMAIL PROTECTED]>, > >>>>>> Steven D'Aprano  <[EMAIL PROTECTED]> wrote: > &

Re: call 'the following function' using decorators

2008-02-17 Thread castironpi
On Feb 15, 7:54 pm, [EMAIL PROTECTED] wrote: > > > > > I assert it's easier to write: > > > > > > start_new_thread( this_func ) > > > > > def thrA(): > > > > >     normal_suite() > > > > > > than > > > > > > def thrA(): > > > > >     normal_suite() > > > > > start_new_thread( thrA ) > > > > > > If

Re: XML pickle

2008-02-17 Thread castironpi
> > Which xmlns:ns1 gets "redefined" because I just didn't figure out how > > get xmlns:ns0 definition into the Workbook tag. But too bad for me. > > What about actually *reading* the links I post? > > http://codespeak.net/lxml/tutorial.html#the-e-factory > > Hint: look out for the "nsmap" keyword

Re: Solve a Debate

2008-02-17 Thread castironpi
> days_in_month 12: > 31 > 30 > 28 > 31 > ... > 30 > 31 > assign $days days_in_month[$month] This is missing days_in_month 12: 31 break 30 break Or the addition add $x' $x offset store $r0 $x' assign $days $r0 Is that 4 ticks or 5; or 24 blips? -- http://mail.python.org/mailman/listinfo/python-

Re: Solve a Debate

2008-02-17 Thread castironpi
> What shall there be missing? breaks? You noticed, that I defined > some artificial architecture on purpose. "days_in_month 12:" > tells it, that the next 12 blurps are tabular data, that can be > indexed. If the "interpreter" hits the line "days_in_month 12:" > it will unconditionally jump 12 ins

Re: Solve a Debate

2008-02-18 Thread castironpi
On Feb 17, 11:23 pm, greg <[EMAIL PROTECTED]> wrote: > Wolfgang Draxinger wrote: > > Somehow you seem to think, that a lookup table will require more > > resources (memory I guess you thought) than a sequence of > > comparisons. However you didn't take into account, that the > > program code itself

Re: Passing a callable object to Thread

2008-02-18 Thread castironpi
On Feb 18, 4:26 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Lie wrote: > > On Feb 16, 12:29 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > >> Paul Rubin wrote: > >>> Jeff Schwab <[EMAIL PROTECTED]> writes: > Why not?  They seem intuitive to me.  I would find it weird if you > couldn't have

Re: XML pickle

2008-02-18 Thread castironpi
> from lxml import etree > > class XMLable: >         cname= '' >         Text= object() >         class CTor: >                 def __init__( self, *ar ): >                         self.ar, self.kwar= ar, dict( ar ) >         ctor= CTor() >         FTor= dict >         ftor= {} >         def __ini

The big shots

2008-02-18 Thread castironpi
I'm a little dissatisfied, and just thinking aloud. Some of the ideas that have been proposed on Python-ideas as well as Python, have received partial evaluation from the alphas. Lesser individuals than they could not have invented Python, and would be liable to ban me merely for this post. Notw

Re: Passing a callable object to Thread

2008-02-18 Thread castironpi
On Feb 18, 5:23 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 18, 4:26 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > >> Lie wrote: > >>> On Feb 16, 12:29 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Paul Rubin wrote: > > Jeff Schwab <[EMAIL PROTECTED]> wri

Re: Passing a callable object to Thread

2008-02-18 Thread castironpi
> a= object() > (a,) is a > > False > > (a,) is not identical with a. > > (a,) is (a,) > > False > > The tuple on the left is not identical with the tuple on the right, even > though they are equivalent. > > a is a > > True > > The variable on the left is identical with the one

Re: The big shots

2008-02-18 Thread castironpi
Python-ideas as well as > >>>Python, have received partial evaluation from the alphas. > > >> What do you mean by "alphas"? > > >Alpha test releases are the round of test distributions before the > >beta tests, which come before the release c

Re: The big shots

2008-02-18 Thread castironpi
by "alphas"? > >>> Alpha test releases are the round of test distributions before the > >>> beta tests, which come before the release candidates which come before > >>> the final release.   > >> Interesting, but I would bet that castironpi actually

Re: C function in a Python context

2008-02-19 Thread castironpi
> #include > #include This modification required: compilercommand='c:/programs/mingw/bin/g++' and strctypes= { 'i': 'int', 's': 'const char*', 'O': 'PyObject*' } The output is: #include [ user code ] static PyObject * extcode_enumfactors(PyObject *self, PyObject *args) {

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 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 with these people

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 cab

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 e

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

Re: standardization allows?

2008-02-19 Thread castironpi
On Feb 19, 4:05 pm, Paul Rubin 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 program

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 t

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 eliminat

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 la

Re: The big shots

2008-02-19 Thread castironpi
On Feb 19, 4:25 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-02-19, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I'm going to start marking my subjective comments with a star, > > so it's clear what is emperically verifiable, and what is not. > > > It's a bad sign. > > I've no idea

Re: The big shots

2008-02-19 Thread castironpi
On Feb 19, 3:48 pm, [EMAIL PROTECTED] wrote: > 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. > > > > I

Re: What's "the standard" for code docs?

2008-02-19 Thread castironpi
On Feb 19, 4:21 pm, Preston Landers <[EMAIL PROTECTED]> wrote: > On Feb 19, 4:16 pm, [EMAIL PROTECTED] wrote: > > > On Feb 19, 4:12 pm, Preston  Landers <[EMAIL PROTECTED]> wrote: > > > > On Feb 16, 1:56 am, John Nagle <[EMAIL PROTECTED]> wrote: > > > > > Preston Landers wrote: > > > > > Hey guys

Re: Double underscores -- ugly?

2008-02-19 Thread castironpi
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, I think it's just a matter of adaption. I too found it rather > "ugly" in the be

Re: What's "the standard" for code docs?

2008-02-19 Thread castironpi
On Feb 19, 4:12 pm, Preston Landers <[EMAIL PROTECTED]> wrote: > On Feb 16, 1:56 am, John Nagle <[EMAIL PROTECTED]> wrote: > > > Preston Landers wrote: > > > Hey guys and gals.  What are all the cool kids using these days to > > > document their code? > > >    HTML.  Text-only docs are so last-cen

Re: The big shots

2008-02-19 Thread castironpi
On Feb 19, 5:31 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > May I insist?  By the criteria you've mentioned so far, nothing rules > > out 'ext'.  If it's still a bad idea, there's a reason.  What is it? > > You imply that just because something is somehow working and even useful > for a *

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 Co

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 are

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,

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

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

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 the

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

python-list@python.org

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 m

python-list@python.org

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

python-list@python.org

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 funct

python-list@python.org

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

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

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

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 f

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 t

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 memb

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? -- http://mail.python.org/mailman/listin

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 tal

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.

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

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 Wi

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 semantica

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

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

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

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: > >   { '

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 t

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

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] wr

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

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

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 t

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

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 wit

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 j

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 i

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

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(

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

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]: > >             i

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 Netherlan

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 k

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

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

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 s

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: > > http://portal.acm.org/citation.cfm?

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

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

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 e

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 co

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

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

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 i

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__( se

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