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 what it refers

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. It is possible but

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 and gals.  What are all

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 beginning, but

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

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

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 requires

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 0-tuple, and even

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 __init__( self,

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.

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] writes: Why not?  They seem

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 on the right.  This is not the

Re: The big shots

2008-02-18 Thread castironpi
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 candidates which come before the final release.   Interesting, but I would bet that castironpi actually is referring to alpha males

Re: The big shots

2008-02-18 Thread castironpi
.   Interesting, but I would bet that castironpi actually is referring to alpha males (particularly in the context of big shots); however, your confusion is precisely why I called it out.  Incoherent writing rarely flies well in this community (which is one reason why I love Python

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 going to be

Re: QOTW: Re: dream hardware

2008-02-17 Thread castironpi
) 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? I'm not sure that the Python interpreter actually does dream, but if it's anything like me, it's

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 you don't, stop reading. Nothing beats 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 argument.

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

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 instructions

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) That would tell you

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      lambda x:

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

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 to create a

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 And any way to make

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: ?xml version=1.0?

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

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? I'm not sure that the Python interpreter actually does

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

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 diminishing

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 what are the chances of getting it in

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

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 language

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

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, bearophile all(x%i

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:

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

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 it doesn't tell

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 environmental conditions and

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=

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://www.telit.co.it/product.asp?productId=96

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... I dont know, but hardware for the Python interpreter, yes

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,

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+$, convert) in

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. ?xml version=1.0? ?mso-application progid=Excel.Sheet? Workbook xmlns=urn:schemas-microsoft-com:office:spreadsheet

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 hardware is a very wide

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 strictest sense of

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 starting point.

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 you a bot or something? Almost all your

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 actually does dream, but if it's anything like me, it's

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():     normal_suite() than

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

Re: dream hardware

2008-02-12 Thread castironpi
On Feb 12, 3:42 pm, Bjoern Schliessmann usenet- [EMAIL PROTECTED] 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

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

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 mediocre

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 char* sep ) {      

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 only dream hardware I

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

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_suite() start_new_thread(

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 like ``for i in

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; i++ ) {    

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 and reader, and truer to the

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 ):       block() run3():    

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 run3( block ):    for _ in

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

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_suite() Introduces new syntax;

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( 3 ):       block()

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 readability, meaning is

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:     def f( x ):         normal suite( x

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

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 ).start() ]:

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

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, default 2rd arg, even if not None, b ) --

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

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 11, 8:04 pm, Paul Rubin http://[EMAIL PROTECTED] 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 question. The main

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 http://[EMAIL PROTECTED] 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

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 http://[EMAIL PROTECTED] 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 mutator

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 http://[EMAIL PROTECTED] 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

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 http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] writes: Could you: lockerA= Locker( listA, listB ) lockerA.op( listB.reverse )

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 12, 12:26 pm, Paul Rubin http://[EMAIL PROTECTED] 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 have direct

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 12, 1:03 pm, Paul Rubin http://[EMAIL PROTECTED] 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. Access

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 12, 12:26 pm, Paul Rubin http://[EMAIL PROTECTED] 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 have direct

Re: removeall() in list

2008-01-12 Thread castironpi
On Jan 12, 1:28 pm, Paul Rubin http://[EMAIL PROTECTED] 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 have a

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 http://[EMAIL PROTECTED] 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 lock

Re: removeall() in list

2008-01-11 Thread castironpi
On Jan 11, 5:26 pm, Paul Rubin http://[EMAIL PROTECTED] 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 wanting to

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 http://[EMAIL PROTECTED] 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.

Re: removeall() in list

2008-01-11 Thread castironpi
On Jan 11, 5:51 pm, Paul Rubin http://[EMAIL PROTECTED] 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 time, which

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 http://[EMAIL PROTECTED] 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

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

<    5   6   7   8   9   10   11   >