Re: function object.func_default off the console

2007-04-26 Thread castironpi
On Apr 25, 1:56 am, Peter Otten <[EMAIL PROTECTED]> wrote: > Aaron Brady wrote: > f.func_defaults[0] > > [2, 3] > f.func_defaults[0]+=[4] > > Traceback (most recent call last): > >File "", line 1, in > > TypeError: 'tuple' object does not support item assignment > f.func_default

Re: Memory addressing

2007-04-27 Thread castironpi
On Apr 27, 4:00 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2007-04-27 at 12:56 -0700, Simon Berube wrote: > > When you call certain objects __repr__() strings in python you often > > get the : happen. I am simply trying to > > understand how that information can be used to recreate a c

exclusive shelve open

2007-04-29 Thread castironpi
I'm trying to be safe and make sure only one python instance opens the shelf. Any ideas? -- http://mail.python.org/mailman/listinfo/python-list

Re: exclusive shelve open

2007-04-29 Thread castironpi
On Apr 29, 2:12 pm, [EMAIL PROTECTED] wrote: > I'm trying to be safe and make sure only one python instance opens the > shelf. Any ideas? Using Windows. -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting

2007-04-29 Thread castironpi
On Apr 29, 2:11 pm, Andy <[EMAIL PROTECTED]> wrote: > Hi, the file below will print all the keywords in a file and also the > line # of the keyword. What I couldn't figure out is to count those > keywords per line. For example - "Line #1 has 3 keywords" > > Can I do like - > > total[j] = total[j] +

module console

2007-05-05 Thread castironpi
Can I get the console to behave like it's in a module? So far I have inspect.getsource() working by setting the filename and linenumbers of the return from compiler.parse(). I'm looking too. -me -- http://mail.python.org/mailman/listinfo/python-list

Re: module console

2007-05-05 Thread castironpi
On May 5, 7:29 pm, [EMAIL PROTECTED] wrote: > Can I get the console to behave like it's in a module? > > So far I have inspect.getsource() working by setting the filename and > linenumbers of the return from compiler.parse(). I'm looking too. -me This at least gets a instance loaded; we'll see.

inspected console

2007-05-07 Thread castironpi
Presents a console permitting inspection. Input as well as output saved in Python-readable form. Python 2.5.1 memoryconsole4.py logging to My Documents\console.log >>> class A: ... def f( self ): ... print 2 ... >>> a=A() >>> import inspect >>> inspect.getsource( a.f ) '\tdef f( se

Re: inspected console

2007-05-07 Thread castironpi
On May 7, 6:52 pm, [EMAIL PROTECTED] wrote: > Presents a console permitting inspection. Input as well as output > saved in Python-readable form. > Python 2.5.1 memoryconsole4.py logging to My Documents\console.log>>> class A: > > ... def f( self ): > ... print 2 > ...>>> a=A() > >>

Re: inspected console

2007-05-07 Thread castironpi
On May 7, 7:59 pm, [EMAIL PROTECTED] wrote: > On May 7, 6:52 pm, [EMAIL PROTECTED] wrote: > > > > > Presents a console permitting inspection. Input as well as output > > saved in Python-readable form. > > Python 2.5.1 memoryconsole4.py logging to My Documents\console.log>>> class > > A: > > > ...

Re: interesting exercise

2007-05-07 Thread castironpi
On May 7, 10:45 pm, Michael Tobis <[EMAIL PROTECTED]> wrote: > I want a list of all ordered permutations of a given length of a set > of tokens. Each token is a single character, and for convenience, they > are passed as a string in ascending ASCII order. > > For example > > permute("abc",2) > > sh

Re: interesting exercise

2007-05-07 Thread castironpi
On May 7, 11:34 pm, [EMAIL PROTECTED] wrote: > On May 7, 10:45 pm, Michael Tobis <[EMAIL PROTECTED]> wrote: > > > > > I want a list of all ordered permutations of a given length of a set > > of tokens. Each token is a single character, and for convenience, they > > are passed as a string in ascendi

Re: interesting exercise

2007-05-07 Thread castironpi
On May 7, 11:42 pm, [EMAIL PROTECTED] wrote: > On May 7, 11:34 pm, [EMAIL PROTECTED] wrote: > > > > > On May 7, 10:45 pm, Michael Tobis <[EMAIL PROTECTED]> wrote: > > > > I want a list of all ordered permutations of a given length of a set > > > of tokens. Each token is a single character, and for

Re: interesting exercise

2007-05-07 Thread castironpi
On May 8, 12:24 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > <[EMAIL PROTECTED]> wrote: > >... > > > def p(a,b): > > if list( a ) != sorted( list( a ) ): raise ValueError, "String not > > ordered." > > if not b: return [''] > > return [i+j for i in list(a) for j in p(a,b-1)]

Re: interesting exercise

2007-05-08 Thread castironpi
On May 8, 3:55 pm, James Stroud <[EMAIL PROTECTED]> wrote: > Steven D'Aprano wrote: > > On Tue, 08 May 2007 10:22:05 +, James Stroud wrote: > > >>This takes annoying past annoying to some new level of hell to which > >>even satan himself wouldn't venture. > > > And thank you for sharing that pi

Re: interesting exercise

2007-05-08 Thread castironpi
On May 8, 4:55 pm, [EMAIL PROTECTED] wrote: > On May 8, 3:55 pm, James Stroud <[EMAIL PROTECTED]> wrote: > > > > > Steven D'Aprano wrote: > > > On Tue, 08 May 2007 10:22:05 +, James Stroud wrote: > > > >>This takes annoying past annoying to some new level of hell to which > > >>even satan himse

tokenize generate_tokens token[0]

2007-05-08 Thread castironpi
Is token[0] guaranteed to be OP for parentheses, commas, etc.? -- http://mail.python.org/mailman/listinfo/python-list

Re: interesting exercise

2007-05-09 Thread castironpi
On May 9, 1:13 am, Charles Sanders <[EMAIL PROTECTED]> wrote: > Michael Tobis wrote: > > Here is the bloated mess I came up with. I did see that it had to be > > recursive, and was proud of myself for getting it pretty much on the > > first try, but the thing still reeks of my sorry old fortran-add

Re: Checking if string inside quotes?

2007-05-09 Thread castironpi
On May 9, 4:31 pm, "Michael Yanowitz" <[EMAIL PROTECTED]> wrote: > Thanks, but it is a little more complicated than that, > the string could be deep in quotes. > >The problem is in string substitution. > Suppose I have a dictionary with MY_IP : "172.18.51.33" > > I need to replace all insta

Re: Behavior of mutable class variables

2007-05-09 Thread castironpi
On May 9, 5:49 pm, [EMAIL PROTECTED] wrote: > Thanks for the insights. I solved the problem as follows: I created a > new class method called cleanUp, which resets NStocks to an empty list > and N1 to 0. Works like a charm - it's the first time I've used a > class method, and I immediately see its

Re: Checking if string inside quotes?

2007-05-09 Thread castironpi
On May 9, 8:48 pm, [EMAIL PROTECTED] wrote: > On May 9, 2:31 pm, "Michael Yanowitz" <[EMAIL PROTECTED]> wrote: > > > > > Thanks, but it is a little more complicated than that, > > the string could be deep in quotes. > > >The problem is in string substitution. > > Suppose I have a dictionary w

Re: interesting exercise

2007-05-09 Thread castironpi
579',3)) = 125 > > >> Charles > > > Could you explain, this one, actually? Don't forget StopIteration. > > As Michael said, simple counting in base n with the > string as the digits. No attempt at clarity or efficiency (I > did say it was a "

the inspect thing

2007-05-10 Thread castironpi
-the code: class A: b=2 import inspect print inspect.getsource(A) class A: c=2 print inspect.getsource(A) -unavailable from the console, but gets you: class A: b=2 class A: b=2 One thought is, in inspect, could at least: def findsource(object): #snip

How to find C source

2007-05-10 Thread castironpi
How do I get to the source for parser.suite()? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find C source

2007-05-10 Thread castironpi
On May 10, 8:36 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 10 May 2007 21:47:39 -0300, <[EMAIL PROTECTED]> escribió: > > > How do I get to the source for parser.suite()? > > Are you looking for function parser_suite in parsermodule.c? > > -- > Gabriel Genellina Looks like -it-.

any() and all() shorthand

2008-01-07 Thread castironpi
any( iterab ) and all( iterab ) as shorthand for reduce( operator.or_, iterab ) and reduce( operator.and_, iterab ). What do you think? -- http://mail.python.org/mailman/listinfo/python-list

Re: any() and all() shorthand

2008-01-07 Thread castironpi
> You are too late, any and all are built-in into python 2.5 Hi, excellent. Now how about something more generic, possibly: [ x.y() for x or _next_ in c ] where the context of _next_ is limited in complexity, and/or can only occur in a generator? -- http://mail.python.org/mailman/listinfo/pyth

Re: any() and all() shorthand

2008-01-07 Thread castironpi
On Jan 7, 1:29 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > 2008/1/7, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > > > You are too late, any and all are built-in into python 2.5 > > > Hi, excellent. Now how about something more generic, possibly: > > > [ x.y() for x or _next_ in c ] > > > where

Re: any() and all() shorthand

2008-01-07 Thread castironpi
On Jan 7, 1:45 pm, [EMAIL PROTECTED] wrote: > On Jan 7, 1:29 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > > The idea is a shorthand for reduce. Here, _next_ meant the next item > in the iterable c. 'Only' is another known quantifier in logic: 'all and only'. Any (there exists) and all (for

Re: any() and all() shorthand

2008-01-07 Thread castironpi
>print 'lookahead2(initial=3.14159, last=42)' >for this, next in lookahead2([1,2,3,4,5], >initial=3.14159, last=42): > print this, next No, actually. But my mistake. [ a.b() or _previous_ for a in c ] means 1 or 2 or 3 or 4 or 5 where c= [ 1, 2, 3, 4, 5]. The mistake: thi

removeall() in list

2008-01-11 Thread castironpi
Any ideas for a thread-safe list.removeall( X ): removing all occurrences of X within list L, when L might be modified concurrently? Sincerely, Aaron -- http://mail.python.org/mailman/listinfo/python-list

Re: removeall() in list

2008-01-11 Thread castironpi
On Jan 11, 2:57 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > Any ideas for a thread-safe list.removeall( X ): removing all > > occurrences of X within list L, when L might be modified concurrently? > > That way lies madness. Do something sensible instead. Put a

Re: removeall() in list

2008-01-11 Thread castironpi
On Jan 11, 5:26 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > This function just wants X out of the list. It doesn't matter if this > > happens before, during, or after something else; so long as it happens. > > 2. Associate a lock with the list. Anything wantin

Re: removeall() in list

2008-01-11 Thread castironpi
On Jan 11, 5:43 pm, [EMAIL PROTECTED] wrote: > On Jan 11, 5:26 pm, Paul Rubin wrote: > > > [EMAIL PROTECTED] writes: > > > This function just wants X out of the list. It doesn't matter if this > > > happens before, during, or after something else; so long as it happens.

Re: removeall() in list

2008-01-11 Thread castironpi
On Jan 11, 5:51 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > listA.op( insert, x ) > > listA.op( remove, x ) > > Sure, there are various ways you can make the code look uniform. What > gets messy is if you want to (say) operate on several lists at the > same tim

Re: removeall() in list

2008-01-11 Thread castironpi
On Jan 11, 6:17 pm, [EMAIL PROTECTED] wrote: > On Jan 11, 5:51 pm, Paul Rubin wrote: > > > > > [EMAIL PROTECTED] writes: > > > listA.op( insert, x ) > > > listA.op( remove, x ) > > > Sure, there are various ways you can make the code look uniform. What > > gets messy is

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 11, 8:04 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > Could you: > > > lockerA= Locker( listA, listB ) > > lockerA.op( listB.reverse ) > > lockerA.op( listA.pop ) > > > Where lockerA ops acquire the locks on all its threads? > > I don't understand that que

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 12, 2:37 am, [EMAIL PROTECTED] wrote: > On Jan 11, 8:04 pm, Paul Rubin wrote: > > > > > [EMAIL PROTECTED] writes: > > > Could you: > > > > lockerA= Locker( listA, listB ) > > > lockerA.op( listB.reverse ) > > > lockerA.op( listA.pop ) > > > > Where lockerA ops acqu

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 12, 3:51 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I'm writing an NxN observer pattern, mostly for my own personal > > exploration. Two threads -might- be calling 'Disconnect' at the same > > time, and I can't even guarantee that the function runs properly.

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 11, 5:26 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > 1. Put a single thread in charge of the list, and communicate with it > by message passing through Queues. To get X out of the list, you'd > send the mutator thread a message asking for removal. The m

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 12, 8:04 am, [EMAIL PROTECTED] wrote: > On Jan 11, 5:26 pm, Paul Rubin wrote: > > > [EMAIL PROTECTED] writes: > > > 1. Put a single thread in charge of the list, and communicate with it > > by message passing through Queues. To get X out of the list, you'd > > sen

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 12, 11:22 am, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > On Jan 12, 1:37 am, [EMAIL PROTECTED] wrote: > > > > > On Jan 11, 8:04 pm, Paul Rubin wrote: > > > > [EMAIL PROTECTED] writes: > > > > Could you: > > > > > lockerA= Locker( listA, listB ) > > > > lockerA.op(

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 12, 12:26 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > 2) List is referenced by others; concurrent modifications may be going > > on; can not replace it. Can I make asynchronous modifications and > > merge the changes, SCM-style? > > Nothing else should h

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 12, 1:03 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > > Nothing else should have direct access to the list. > > Impossible to guarantee in Python. If you do, the reference to you does. > > Well, ok. Nothing else should USE that access. Ah, very agreed.

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 12, 12:26 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > 2) List is referenced by others; concurrent modifications may be going > > on; can not replace it. Can I make asynchronous modifications and > > merge the changes, SCM-style? > > Nothing else should h

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 12, 1:28 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > Will you engage with me over e-mail to discuss the Locker > > implementation I'm developing? Aaron > > I really can't, sorry. I'm finding it hard enough to follow over the > newsgroup. If you just ha

Function wrappers

2008-01-23 Thread castironpi
def f( callback, *bar, **bkwar ): def preg ( callfore, *far, **fkwar ): return g( callback, callfore, bar, bkwar, far, fkwar ) return preg Does anyone see a way to rewrite this, perhaps along the lines of partial( partial, partial )?

Re: handling asynchronous callbacks from c++ in a python script

2008-01-23 Thread castironpi
On Jan 23, 5:46 pm, Tim Spens <[EMAIL PROTECTED]> wrote: > I have a c++ program running that has boost python hooks for the c++ api. > I'm running a python client that makes calls into the c++ api. The problem > is there are c++ > asynchronous callbacks that need to pass information to the python

functools possibilities

2008-02-01 Thread castironpi
1. functools.partialpre: partialpre( f, x, y )( z )-> f( z, x, y ) 2. functools.pare: pare( f, 1 )( x, y )-> f( y ) 3. functools.parepre: parepre( f, 1 )( x, y )-> f( x ) 4. functools.calling_default: calling_default( f, a, DefaultA, b )-> f( a, , b ) -- http://mail.python.org/mailman/listinfo/pyt

Re: functools possibilities

2008-02-02 Thread castironpi
On Feb 2, 12:13 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > 1. functools.partialpre: partialpre( f, x, y )( z )-> f( z, x, y ) > > 2. functools.pare: pare( f, 1 )( x, y )-> f( y ) > > 3. functools.parepre: parepre( f, 1 )( x, y )-> f( x ) > > 4. functools.calling_de

future multi-threading for-loops

2008-02-04 Thread castironpi
Some iterables and control loops can be multithreaded. Worries that it takes a syntax change. for X in A: def f( x ): normal suite( x ) start_new_thread( target= f, args= ( X, ) ) Perhaps a control-flow wrapper, or method on iterable. @parallel for X in A: normal suite( X )

Re: future multi-threading for-loops

2008-02-04 Thread castironpi
On Feb 4, 9:22 pm, [EMAIL PROTECTED] wrote: > Some iterables and control loops can be multithreaded.  Worries that > it takes a syntax change. > > for X in A: >     def f( x ): >         normal suite( x ) >     start_new_thread( target= f, args= ( X, ) ) > > Perhaps a control-flow wrapper, or metho

Re: future multi-threading for-loops

2008-02-04 Thread castironpi
On Feb 5, 12:26 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > On 5 feb, 03:46, [EMAIL PROTECTED] wrote: > > > Some timing stats: On Windows XP, Python 3.0a2. > > > [timing code, 10,000 calls] > > [ f( X ) ]: 0.0210021106034 > > [ start_new_thread( f, X ) ]: 1.15759908033 > > [ Thread( f, X ).s

Re: future multi-threading for-loops

2008-02-05 Thread castironpi
On Feb 5, 1:21 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Mon, 04 Feb 2008 19:22:29 -0800, castironpi wrote: > > Some iterables and control loops can be multithreaded.  Worries that > > it takes a syntax change. > > > for X in A: > &g

Code block function syntax, anonymous functions decorator

2008-02-06 Thread castironpi
def run3( block ): for _ in range( 3 ): block() run3(): normal_suite() Introduces new syntax; arbitrary functions can follow 'colon'. Maintains readability, meaning is consistent. Equivalent to: def run3( block ): for _ in range( 3 ): block() @run3 def anonfunc(): norm

Re: Code block function syntax, anonymous functions decorator

2008-02-06 Thread castironpi
On Feb 6, 5:45 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Wed, 06 Feb 2008 23:59:27 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> > wrote: > > > > > > >[EMAIL PROTECTED] schrieb: > >> def run3( block ): > >>    for _ in range( 3 ): > >>       block() > > >> run3(): > >>    normal_suit

Re: Code block function syntax, anonymous functions decorator

2008-02-06 Thread castironpi
On Feb 6, 8:10 pm, [EMAIL PROTECTED] wrote: > On Feb 6, 5:45 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > > > > > > > On Wed, 06 Feb 2008 23:59:27 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> > > wrote: > > > >[EMAIL PROTECTED] schrieb: > > >> def run3( block ): > > >>    for _ in range(

Re: Code block function syntax, anonymous functions decorator

2008-02-06 Thread castironpi
On Feb 6, 4:59 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > > > def run3( block ): > >    for _ in range( 3 ): > >       block() > > > run3(): > >    normal_suite() > > > Introduces new syntax; arbitrary functions can follow 'colon'. > > > Maintains reada

Re: Code block function syntax, anonymous functions decorator

2008-02-07 Thread castironpi
On Feb 7, 2:48 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Jean-Paul Calderone schrieb: > > > > > > > On Wed, 06 Feb 2008 23:59:27 +0100, "Diez B. Roggisch" > > <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > >>> def run3( block ): > >>>    for _ in range( 3 ): > >>>       bloc

Re: Code block function syntax, anonymous functions decorator

2008-02-07 Thread castironpi
On Feb 7, 7:13 pm, [EMAIL PROTECTED] wrote: > On Feb 7, 2:48 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > > > Jean-Paul Calderone schrieb: > > > > On Wed, 06 Feb 2008 23:59:27 +0100, "Diez B. Roggisch" > > > <[EMAIL PROTECTED]> wrote: > > >> [EMAIL PROTECTED] schrieb: > > >>> def run

Re: Code block function syntax, anonymous functions decorator

2008-02-08 Thread castironpi
On Feb 8, 1:08 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Feb 8, 6:50 am, [EMAIL PROTECTED] wrote: > > > > > > > Sometimes, it's more appropriate to write > > > @call > > def f(): > >    normal_suite() > > > than > > > def f(): > >    normal_suite() > > f(). > > > It's clearer to the eye

C function in a Python context

2008-02-09 Thread castironpi
To write quick C things that Python won't do up to speed. So it's got a redundancy. import ext extA= ext.Ext() extA[ 'enumfactors' ]= r""" int enumfactors( int a, const char* sep ) { int ret= 0, i; for( i= 1; i<= a; i++ ) { if( a% i== 0 ) { ret+= 1;

Re: C function in a Python context

2008-02-09 Thread castironpi
On Feb 9, 1:48 pm, [EMAIL PROTECTED] wrote: > To write quick C things that Python won't do up to speed.  So it's got > a redundancy. > > import ext > extA= ext.Ext() > extA[ 'enumfactors' ]= r""" >     int enumfactors( int a, const char* sep ) { >         int ret= 0, i; >         for( i= 1; i<= a;

Re: Why not a Python compiler?

2008-02-10 Thread castironpi
On Feb 10, 7:29 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Steven D'Aprano wrote: > > On Sat, 09 Feb 2008 01:11:09 +, Marc 'BlackJack' Rintsch wrote: > > >> On Fri, 08 Feb 2008 05:12:29 -0800, Ryszard Szopa wrote: > > >>> Expressing simple loops as C for loops... > >> You mean simple loops

Re: dream hardware

2008-02-12 Thread castironpi
On Feb 12, 7:31 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Steven D'Aprano wrote: > > On Tue, 12 Feb 2008 10:05:59 -0800, castironpi wrote: > > >> What is dream hardware for the Python interpreter? > > > I'm not sure that the Python interpreter actu

Re: call 'the following function' using decorators

2008-02-12 Thread castironpi
On Feb 12, 12:10 pm, [EMAIL PROTECTED] wrote: > On Feb 12, 12:05 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: > > > > > > > En Tue, 12 Feb 2008 15:20:32 -0200, <[EMAIL PROTECTED]> escribi�: > > > > I assert it's easier to write: > > > > start_new_thread( this_func ) > > > def thrA(): > > >

Re: dream hardware

2008-02-12 Thread castironpi
On Feb 12, 4:51 pm, "Martin P. Hellwig" <[EMAIL PROTECTED]> wrote: > Bjoern Schliessmann wrote: > > Jeff Schwab wrote: > > >> The only "dream hardware" I know of is the human brain. > > > Nah. Too few storage capacity, and too slow and error-prone at > > simple calculations. The few special but ver

Re: dream hardware

2008-02-12 Thread castironpi
On Feb 12, 3:42 pm, Bjoern Schliessmann wrote: > Jeff Schwab wrote: > > The only "dream hardware" I know of is the human brain. > > Nah. Too few storage capacity, and too slow and error-prone at > simple calculations. The few special but very advanced features are > all hard-wired to custom hardwa

Re: dream hardware

2008-02-12 Thread castironpi
On Feb 12, 2:15 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Feb 12, 1:05 pm, [EMAIL PROTECTED] wrote: > > > What is dream hardware for the Python interpreter? > > A 10 GHz single core. > > (Dual core if doing lots of I/O.) > > Carl Banks Handle a dual 6GHz core. Code sometimes happens in order

Re: dream hardware

2008-02-12 Thread castironpi
On Feb 12, 1:03 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > >>> What is dream hardware for the Python interpreter? > > > The only "dream hardware" I know of is the human brain.  I have a > > slightly used one myself, and it's a  pretty mediocre Python interpreter. > > the human brain may be a pretty

Re: C function in a Python context

2008-02-12 Thread castironpi
On Feb 9, 3:04 pm, [EMAIL PROTECTED] wrote: > On Feb 9, 1:48 pm, [EMAIL PROTECTED] wrote: > > > > > > > To write quick C things that Python won't do up to speed.  So it's got > > a redundancy. > > > import ext > > extA= ext.Ext() > > extA[ 'enumfactors' ]= r""" > >     int enumfactors( int a, const

Re: dream hardware

2008-02-12 Thread castironpi
On Feb 12, 12:31 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > > On Feb 12, 2008 1:05 PM,  <[EMAIL PROTECTED]> wrote: > >> What is dream hardware for the Python interpreter? > Warren Myers wrote: > >  > A Cray? >  > >  > What are you trying to do? "dream" hardware is a very wide question. > > The on

dream hardware

2008-02-12 Thread castironpi
What is dream hardware for the Python interpreter? -- http://mail.python.org/mailman/listinfo/python-list

call 'the following function' using decorators

2008-02-12 Thread castironpi
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 you don't, stop reading. If you do, accomplish it like this: @decwrap( start_new_thread, Link, ( 2, 3 ) ) def anonfunc( a, b ): p

Re: call 'the following function' using decorators

2008-02-12 Thread castironpi
On Feb 12, 12:05 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 12 Feb 2008 15:20:32 -0200, <[EMAIL PROTECTED]> escribi�: > > > > > > > I assert it's easier to write: > > > start_new_thread( this_func ) > > def thrA(): > >     normal_suite() > > > than > > > def thrA(): > >     normal

Re: dream hardware

2008-02-13 Thread castironpi
On Feb 13, 2:01 pm, Laurent Pointal <[EMAIL PROTECTED]> wrote: > Le Tue, 12 Feb 2008 10:05:59 -0800, castironpi a écrit : > > > What is dream hardware for the Python interpreter? > > Dream... I dont know, but hardware for the Python interpreter, yes. > > http

Re: dream hardware

2008-02-13 Thread castironpi
On Feb 13, 2:23 pm, [EMAIL PROTECTED] wrote: > On Feb 13, 2:01 pm, Laurent Pointal <[EMAIL PROTECTED]> > wrote: > > > Le Tue, 12 Feb 2008 10:05:59 -0800, castironpi a écrit : > > > > What is dream hardware for the Python interpreter? > > > Dream..

XML pickle

2008-02-13 Thread castironpi
Readability of the Pickle module. Can one export to XML, from cost of speed and size, to benefit of user-readability? It does something else: plus functions do not export their code, either in interpreter instructions, or source, or anything else; and classes do not export their dictionaries, jus

Re: fromfunc functions

2008-02-13 Thread castironpi
On Feb 13, 1:32 pm, azrael <[EMAIL PROTECTED]> wrote: > Thaks guys. this helped May I point you to partial: f= partial( func, arg ) f() -> func( arg ) -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular Expression for Prime Numbers (or How I came to fail at them, and love the bomb)

2008-02-13 Thread castironpi
On Feb 13, 9:48 am, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Wed, 2008-02-13 at 07:31 -0800, [EMAIL PROTECTED] wrote: > >     return re.match("^1?$|^(11+?)\1+$", convert) > > That needs to be either > > return re.match(r"^1?$|^(11+?)\1+$", convert) > > or > > return re.match("^1?$|^(11+?)\\1+$

Re: Word document accessing using python

2008-02-13 Thread castironpi
On Feb 13, 12:07 pm, Juan_Pablo <[EMAIL PROTECTED]> wrote: > > import win32com.client > >  but, window32com.client is only functional in  windows Excel can read XML. abc 123 Word command line to save as text, or the reader from Microsoft? -- http://mail.python.org/

standardization allows?

2008-02-13 Thread castironpi
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. -- http://mail.python.org/mailman/listinfo/python-list

Re: dream hardware

2008-02-13 Thread castironpi
On Feb 13, 10:14 am, Florian Diesch <[EMAIL PROTECTED]> wrote: > Jeff Schwab <[EMAIL PROTECTED]> wrote: > >> On Feb 12, 2008 1:05 PM,  <[EMAIL PROTECTED]> wrote: > >>> What is dream hardware for the Python interpreter? > > > Warren Myers wrote: > >> A Cray? > > >> What are you trying to do? "dream"

Re: Regular Expression for Prime Numbers (or How I came to fail at them, and love the bomb)

2008-02-13 Thread castironpi
On Feb 13, 5:43 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Feb 13, 5:14 pm, [EMAIL PROTECTED] wrote: > > > Isn't the finite state machine "regular expression 'object'" really > > large? > > There's no finite state machine involved here, since this isn't a > regular expression in the stricte

Re: XML pickle

2008-02-13 Thread castironpi
On Feb 13, 10:41 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Feb 13, 4:43 pm, [EMAIL PROTECTED] wrote: > > > Readability of the Pickle module.  Can one export to XML, from cost > > of speed and size, to benefit of user-readability? > > Take a look at gnosis.xml.pickle, it seems a good startin

Re: dream hardware

2008-02-13 Thread castironpi
On Feb 13, 8:28 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 13 Feb 2008 17:45:33 -0800, castironpi wrote: > > Fortran is better than what?  Ideal semantics beat pain and pleasure any > > day, they are practical goals. > > Okay, are yo

Re: Regular Expression for Prime Numbers (or How I came to fail at them, and love the bomb)

2008-02-14 Thread castironpi
On Feb 14, 5:26 am, [EMAIL PROTECTED] wrote: > cokofree: > > > Sadly that is pretty slow though... > > It's quadratic, and it's not even short, you can do (quadratic still): > > print [x for x in range(2, 100) if all(x%i for i in range(2, x))] > > In D you can write similar code. > Bye, > bearophil

Re: XML pickle

2008-02-14 Thread castironpi
On Feb 14, 12:45 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Hi, > > [EMAIL PROTECTED] wrote: > > Readability of the Pickle module.  Can one export to XML, from cost of > > speed and size, to benefit of user-readability? > > Regarding pickling to XML, lxml.objectify can do that: > > http://codes

Re: XML pickle

2008-02-14 Thread castironpi
On Feb 14, 12:31 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 14, 12:45 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >>> Readability of the Pickle module.  Can one export to XML, from cost of > >>> speed and size, to benefit of u

Re: XML pickle

2008-02-14 Thread castironpi
On Feb 14, 1:49 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Hi, > > [EMAIL PROTECTED] wrote: > > Stefan Behnel wrote: > >> What I meant was: please state what you are trying to do. What you describe > >> are the environmental conditions and possible solutions that you are > >> thinking of, but i

Re: XML pickle

2008-02-14 Thread castironpi
On Feb 14, 5:31 pm, [EMAIL PROTECTED] wrote: > On Feb 14, 1:49 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > > > > > > > Hi, > > > [EMAIL PROTECTED] wrote: > > > Stefan Behnel wrote: > > >> What I meant was: please state what you are trying to do. What you > > >> describe > > >> are the environme

Re: XML pickle

2008-02-14 Thread castironpi
Great! --  \          "I moved into an all-electric house. I forgot and left the |   `\   porch light on all day. When I got home the front door wouldn't | _o__)                                         open."  -- Steven Wright | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list

Re: XML pickle

2008-02-14 Thread castironpi
> I cannot tell if the above approach will solve your problem or not. Well, declare me a persistent object. from lxml import etree SS= '{urn:schemas-microsoft-com:office:spreadsheet}' book= etree.Element( 'Workbook' ) book.set( 'xmlns', 'urn:schemas-microsoft-com:office:spreadsheet' ) sheet= etr

Re: XML pickle

2008-02-15 Thread castironpi
On Feb 15, 12:07 pm, [EMAIL PROTECTED] wrote: > On Feb 15, 11:10 am, [EMAIL PROTECTED] wrote: > > > > > Can you use set( '{ss}Type' ) somehow? > > > > What is 'ss' here? A prefix? > > > > What about actually reading the tutorial? > > > >http://codespeak.net/lxml/tutorial.html#namespaces > > > > > A

Re: XML pickle

2008-02-15 Thread castironpi
> > Can you use set( '{ss}Type' ) somehow? > > What is 'ss' here? A prefix? > > What about actually reading the tutorial? > > http://codespeak.net/lxml/tutorial.html#namespaces > > > And any way to make this look > > closer to the original? > > What's the difference you experience? Target:

Re: XML pickle

2008-02-15 Thread castironpi
> In Economics, they call it "Economy to Scale"- the effect, and the > point, and past it, where the cost to produce N goods on a supply > curve on which 0 goods costs 0 exceeds that on one on which 0 goods > costs more than 0: the opposite of diminishing returns.  Does the > benefit of encapsulati

Re: QOTW: Re: dream hardware

2008-02-15 Thread castironpi
On Feb 14, 10:50 pm, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Steven D'Aprano  <[EMAIL PROTECTED]> wrote: > > >On Tue, 12 Feb 2008 10:05:59 -0800, castironpi wrote: > > >> What is dream hardware for the Python interpreter? &

Re: XML pickle

2008-02-15 Thread castironpi
On Feb 15, 11:10 am, [EMAIL PROTECTED] wrote: > > > Can you use set( '{ss}Type' ) somehow? > > > What is 'ss' here? A prefix? > > > What about actually reading the tutorial? > > >http://codespeak.net/lxml/tutorial.html#namespaces > > > > And any way to make this look > > > closer to the original? >

Re: XML pickle

2008-02-15 Thread castironpi
On Feb 15, 2:58 pm, [EMAIL PROTECTED] wrote: > > In Economics, they call it "Economy to Scale"- the effect, and the > > point, and past it, where the cost to produce N goods on a supply > > curve on which 0 goods costs 0 exceeds that on one on which 0 goods > > costs more than 0: the opposite of di

Re: call 'the following function' using decorators

2008-02-15 Thread castironpi
> > > > 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 you don't, stop reading. Nothing beats if forkthread(): but wh

  1   2   3   4   5   6   7   8   9   10   >