Re: SIMD powered Python
Hi... True... But maybe in NumPy arrays that would be more feasible...? Cheers. Hugo Ferreira Marc 'BlackJack' Rintsch escreveu: In [EMAIL PROTECTED], Bytter wrote: Is there any ID ongoing about using SIMD [1] instructions, like SSE [2], to speed up Python, especially regarding functional features, like list comprehension, map and reduce, etc.. ? SIMD instruction sets know about low level data types, Python is about objects. `map()`, `reduce()`, list comprehension work on arbitrary iterables so how do you expect SIMD instructions handle this? Even simple lists contain objects and those don't have to be of the same type. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
SIMD powered Python
Hi! Is there any ID ongoing about using SIMD [1] instructions, like SSE [2], to speed up Python, especially regarding functional features, like list comprehension, map and reduce, etc.. ? Best regards, Hugo Ferreira -- [1] http://en.wikipedia.org/wiki/SIMD [2] http://en.wikipedia.org/wiki/Streaming_SIMD_Extensions -- http://mail.python.org/mailman/listinfo/python-list
libboost, python, and dijkstra shortest path
Hi everyone, I need to implement a very quick (performance-wise) Dijkstra shortest path in python, and found that libboost already has such thing. Problem is: I cannot find the installation package for my Python 2.4 under windows. Can someone please provide me instructions for installing libboost for python? In alternative, if someone can point out to a fast Dijkstra shortest path in python (the network is over 1 million vertexes), I would appreciate. Thanks in advance, Hugo Ferreira -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting recursion loops
Hi! I hope you are not trying to find infinite loops and I simply misunderstood your question. Because if you are, then forget it (Turing anyone?)... Infinite loops are impossible to find (minus some few, very specific situations). Cf. http://en.wikipedia.org/wiki/Halting_problem Cheers, Hugo Ferreira P.S. Hmmm... It seems I really read it wrong since you define that you want to stop (after N passes or some complex criteria). Anyway I leave the warning for future generations :) My code does recursion loops through a couple of functions. Due to problematic I/O input this leads sometimes to endless recursions and after expensive I/O to the Python recursion exception. What would be a good method to detect recursion loops and stop it by user-Exception (after N passes or some complex criteria) without passing a recursion counter parameter through all the funcs? Robert -- http://mail.python.org/mailman/listinfo/python-list
Re: libboost, python, and dijkstra shortest path
Ok, found the solution here: http://www.osl.iu.edu/~dgregor/bgl-python/ But still cannot make anything that works... Anyone who has experience in this area can help me with the following code: import boost as bgl graph = bgl.Graph() a = graph.add_vertex() b = graph.add_vertex() e = graph.add_edge(a, b) weights = graph.edge_property_map('integer') weights[e] = 5 graph.edge_properties['weight'] = weights boost.dijkstra_shortest_paths(graph, a) On Nov 29, 5:51 pm, Bytter [EMAIL PROTECTED] wrote: Hi everyone, I need to implement a very quick (performance-wise) Dijkstra shortest path in python, and found that libboost already has such thing. Problem is: I cannot find the installation package for my Python 2.4 under windows. Can someone please provide me instructions for installing libboost for python? In alternative, if someone can point out to a fast Dijkstra shortest path in python (the network is over 1 million vertexes), I would appreciate. Thanks in advance, Hugo Ferreira -- http://mail.python.org/mailman/listinfo/python-list
Re: PyParsing and Headaches
Heya there, Ok, found the solution. I just needed to use leaveWhiteSpace() in the places I want pyparsing to take into consideration the spaces. Thx for the help. Cheers! Hugo Ferreira On Nov 23, 11:57 am, Bytter [EMAIL PROTECTED] wrote: (This message has already been sent to the mailing-list, but I don't have sure this is arriving well since it doesn't come up in the usenet, so I'm posting it through here now.) Chris, Thanks for your quick answer. That changes a lot of stuff, and now I'm able to do my parsing as I intended to. Still, there's a remaining problem. By using Combine(), everything is interpreted as a single token. Though what I need is that 'include_bool' and 'literal' be parsed as separated tokens, though without a space in the middle... Paul, Thanks for your detailed explanation. One of the things I think is missing from the documentation (or that I couldn't find easy) is the kind of explanation you give about 'The Way of PyParsing'. For example, It took me a while to understand that I could easily implement simple recursions using OneOrMany(Group()). Or maybe things were out there and I didn't searched enough... Still, fwiw, congratulations for the library. PyParsing allowed me to do in just a couple of hours, including learning about it's API (minus this little inconvenient) what would have taken me a couple of days with, for example, ANTLR (in fact, I've already put aside ANTLR more than once in the past for a built-from-scratch parser). Cheers, Hugo Ferreira On Nov 22, 7:50 pm, Chris Lambacher [EMAIL PROTECTED] wrote: On Wed, Nov 22, 2006 at 11:17:52AM -0800, Bytter wrote: Hi, I'm trying to construct a parser, but I'm stuck with some basic stuff... For example, I want to match the following: letter = A...Z | a...z literal = letter+ include_bool := + | - term = [include_bool] literal So I defined this as: literal = Word(alphas) include_bool = Optional(oneOf(+ -)) term = include_bool + literal+ here means that you allow a space. You need to explicitly override this. Try: term = Combine(include_bool + literal) The problem is that: term.parseString(+a) - (['+', 'a'], {}) # OK term.parseString(+ a) - (['+', 'a'], {}) # KO. It shouldn't recognize any token since I didn't said the SPACE was allowed between include_bool and literal. Can anyone give me an hand here? Cheers! Hugo Ferreira BTW, the following is the complete grammar I'm trying to implement with pyparsing: ## L ::= expr | expr L ## expr ::= term | binary_expr ## binary_expr ::= term binary_op term ## binary_op ::= * | OR | AND ## include_bool ::= + | - ## term ::= ([include_bool] [modifier :] (literal | range)) | (~ literal) ## modifier ::= (letter | _)+ ## literal ::= word | quoted_words ## quoted_words ::= '' word ( word)* '' ## word ::= (letter | digit | _)+ ## number ::= digit+ ## range ::= number (.. | ...) number ## letter ::= A...Z | a...z ## digit ::= 0...9 And this is where I got so far: word = Word(nums + alphas + _) binary_op = oneOf(* and or, caseless=True).setResultsName(operator) include_bool = oneOf(+ -) literal = (word | quotedString).setResultsName(literal) modifier = Word(alphas + _) rng = Word(nums) + (Literal(..) | Literal(...)) + Word(nums) term = ((Optional(include_bool) + Optional(modifier + :) + (literal | rng)) | (~ + literal)).setResultsName(Term) binary_expr = (term + binary_op + term).setResultsName(binary) expr = (binary_expr | term).setResultsName(Expr) L = OneOrMore(expr) -- GPG Fingerprint: B0D7 1249 447D F5BB 22C5 5B9B 078C 2615 504B 7B85 -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Does only emacs and idle support symbolic debugging?
PyScripter (windows only) here: http://mmm-experts.com/Products.aspx?ProductId=4 On Nov 23, 4:00 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Victor Ng wrote: Subject line pretty much says it all - are those the only two editors that support running the symbolic debugger from inside the editor?Nope, eric for example does as well. And I presume komodo will do that also. Diez -- http://mail.python.org/mailman/listinfo/python-list
PyParsing and Headaches
Hi, I'm trying to construct a parser, but I'm stuck with some basic stuff... For example, I want to match the following: letter = A...Z | a...z literal = letter+ include_bool := + | - term = [include_bool] literal So I defined this as: literal = Word(alphas) include_bool = Optional(oneOf(+ -)) term = include_bool + literal The problem is that: term.parseString(+a) - (['+', 'a'], {}) # OK term.parseString(+ a) - (['+', 'a'], {}) # KO. It shouldn't recognize any token since I didn't said the SPACE was allowed between include_bool and literal. Can anyone give me an hand here? Cheers! Hugo Ferreira BTW, the following is the complete grammar I'm trying to implement with pyparsing: ## L ::= expr | expr L ## expr ::= term | binary_expr ## binary_expr ::= term binary_op term ## binary_op ::= * | OR | AND ## include_bool ::= + | - ## term ::= ([include_bool] [modifier :] (literal | range)) | (~ literal) ## modifier ::= (letter | _)+ ## literal ::= word | quoted_words ## quoted_words ::= '' word ( word)* '' ## word ::= (letter | digit | _)+ ## number ::= digit+ ## range ::= number (.. | ...) number ## letter ::= A...Z | a...z ## digit ::= 0...9 And this is where I got so far: word = Word(nums + alphas + _) binary_op = oneOf(* and or, caseless=True).setResultsName(operator) include_bool = oneOf(+ -) literal = (word | quotedString).setResultsName(literal) modifier = Word(alphas + _) rng = Word(nums) + (Literal(..) | Literal(...)) + Word(nums) term = ((Optional(include_bool) + Optional(modifier + :) + (literal | rng)) | (~ + literal)).setResultsName(Term) binary_expr = (term + binary_op + term).setResultsName(binary) expr = (binary_expr | term).setResultsName(Expr) L = OneOrMore(expr) -- GPG Fingerprint: B0D7 1249 447D F5BB 22C5 5B9B 078C 2615 504B 7B85 -- http://mail.python.org/mailman/listinfo/python-list
Rendering Vector Graphics
Hi ppl, I've already posted this message through the mailing-list, but it seems it never arrived here. Strange... Anyway: I need to render high-quality vector graphics with Python. I was thinking of something like 'cairo', though I need to run under win32 and can't find a pycairo package for it. Suggestions? Thanks, Hugo Ferreira -- http://mail.python.org/mailman/listinfo/python-list
Re: Rendering Vector Graphics
Hi! [EMAIL PROTECTED] wrote: I need to render high-quality vector graphics with Python. I was thinking of something like 'cairo', though I need to run under win32 and can't find a pycairo package for it. Suggestions? I've had good experiences doing simple 3d vector stuff with Pygame. It's wraps SDL so it has pretty nice capabilities. What about 2D? I won't be doing any 3d stuff, though I need high-quality 2D, and complex stuff like defining clipping regions with bezier curves and filling with gradients. Thanks! Hugo Ferreira -- http://mail.python.org/mailman/listinfo/python-list