devpi-0.9.1: pushing tested releases to pypi

2013-06-18 Thread holger krekel
Hi all, devpi-0.9.1 is out which fixes bugs and introduces support for pushing a tested release candidate from a private index to pypi. See http://doc.devpi.net on the ease of doing devpi upload, test and push commands as well as general information on the devpi-server and devpi tools.

[ANN] Shed Skin 0.9.4

2013-06-18 Thread Mark Dufour
Hi all, I have just released version 0.9.4 of Shed Skin, a (restricted-)Python-(2.x)-to-C++ compiler. This is the fourth maintenance release since 0.9, so no new major features were added. There have been many minor improvements though, and 3 new examples were added, bringing the total number of

ANN: eGenix mxODBC Django Database Engine - Django ODBC Adapter 1.2.0

2013-06-18 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mxODBC Django Database Engine MS SQL Server ORM and ODBC Adapter for the Django Web Framework Version 1.2.0 The

Tonight's meeting + s Database link

2013-06-18 Thread Kevin LaTona
First off what a fun meeting it was tonight with a great conversation. Let's do more of them. Next this is the link to that JSON Database I mentioned but could not recall the name on. http://www.rethinkdb.com/ RethinkDB overview RethinkDB is built to store JSON documents, and scale to

Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.]

2013-06-18 Thread Steven D'Aprano
On Tue, 18 Jun 2013 00:12:34 -0400, Dave Angel wrote: On 06/17/2013 10:42 PM, Steven D'Aprano wrote: On Mon, 17 Jun 2013 21:06:57 -0400, Dave Angel wrote: On 06/17/2013 08:41 PM, Steven D'Aprano wrote: SNIP In Python 3.2 and older, the data will be either UTF-4 or UTF-8, selected

Re: Tonight's meeting + s Database link -- Sorry

2013-06-18 Thread Kevin LaTona
Sorry all, I managed to send that last email to wrong Python list. -Kevin On Jun 17, 2013, at 10:55 PM, Kevin LaTona li...@studiosola.com wrote: First off what a fun meeting it was tonight with a great conversation. Let's do more of them. Next this is the link to that JSON

Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.]

2013-06-18 Thread Larry Hudson
On 06/17/2013 08:50 AM, Simpleton wrote: On 17/6/2013 2:58 μμ, Michael Torrie wrote: a = 5 b = a a --- memory address b --- memory address I like to think a and b as references to the same memory address Not quite: a and b _are_ memory addresses, At the same time, a and b are references to

Re: Don't feed the troll...

2013-06-18 Thread Chris Angelico
On Tue, Jun 18, 2013 at 11:03 AM, ru...@yahoo.com wrote: if Python had perfect documentation, he still wouldn't read it. If your crystal ball is that good, could you try using it to solve some of Nikos' problems? I have done so, many times. Sometimes it helps, often it doesn't. Once, it led

Re: Don't feed the troll...

2013-06-18 Thread Chris Angelico
On Tue, Jun 18, 2013 at 6:15 AM, Guy Scree nob...@nowhere.com wrote: I recommend that all participants in this thread, especially Alex and Anton, research the term Pathological Altruism I don't intend to buy a book about it, but based on flipping through a few Google results and snippets, I'm

Re: Don't feed the troll...

2013-06-18 Thread Chris Angelico
On Tue, Jun 18, 2013 at 2:39 PM, alex23 wuwe...@gmail.com wrote: tl;dr Stop acting like a troll and we'll stop perceiving you as such. This being Python-list, we duck-type. You don't have to declare that you're a troll, like you would in C; you just react like a troll and we'll treat you as one.

Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.]

2013-06-18 Thread Steven D'Aprano
On Mon, 17 Jun 2013 23:39:10 -0700, Larry Hudson wrote: On 06/17/2013 08:50 AM, Simpleton wrote: On 17/6/2013 2:58 μμ, Michael Torrie wrote: a = 5 b = a a --- memory address b --- memory address I like to think a and b as references to the same memory address Not quite: a and b _are_

Help me with the script? How to find items in csv file A and not in file B and vice versa

2013-06-18 Thread Alan Newbie
Hello, Let's say I want to compare two csv files: file A and file B. They are both similarly built - the first column has product IDs (one product per row) and the columns provide some stats about the products such as sales in # and $. I want to compare these files - see which product IDs

ANN: eGenix mxODBC Django Database Engine - Django ODBC Adapter 1.2.0

2013-06-18 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mxODBC Django Database Engine MS SQL Server ORM and ODBC Adapter for the Django Web Framework Version 1.2.0 The

Re: Don't feed the troll...

2013-06-18 Thread Antoon Pardon
Op 17-06-13 19:56, ru...@yahoo.com schreef: On 06/17/2013 02:15 AM, Antoon Pardon wrote: Op 17-06-13 05:46, ru...@yahoo.com schreef: On 06/16/2013 02:04 PM, Steven D'Aprano wrote: Yes. Trying to start flame wars with Nikos is unacceptable behaviour. It is unproductive, it makes this a

Re: Help me with the script? How to find items in csv file A and not in file B and vice versa

2013-06-18 Thread Peter Otten
Alan Newbie wrote: Hello, Let's say I want to compare two csv files: file A and file B. They are both similarly built - the first column has product IDs (one product per row) and the columns provide some stats about the products such as sales in # and $. I want to compare these files -

Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.]

2013-06-18 Thread Νίκος
Στις 18/6/2013 9:39 πμ, ο/η Larry Hudson έγραψε: Not quite: a and b _are_ memory addresses, At the same time, a and b are references to the data (the objects) stored in those memory locations. The distinction is probably more important in languages like C/C++, where the _language_ gives you

Re: Don't feed the troll...

2013-06-18 Thread Antoon Pardon
Op 18-06-13 01:02, Steven D'Aprano schreef: On Mon, 17 Jun 2013 09:31:53 +0200, Antoon Pardon wrote: Op 16-06-13 22:04, Steven D'Aprano schreef: On Sun, 16 Jun 2013 20:16:34 +0200, Antoon Pardon wrote: You are trying to get it both ways. On the one hand you try to argue that there are no

Re: Help me with the script? How to find items in csv file A and not in file B and vice versa

2013-06-18 Thread alonnirs
Hi Peter, First off - many (many!) thanks. There's some error I don't understand. Here's the amended script I used: import csv #open CSV's and read first column with product IDs into variables pointing to lists with open(Afile.csv, rb) as f: a = {row[0] for row in csv.reader(f)} with

Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.]

2013-06-18 Thread Steven D'Aprano
On Tue, 18 Jun 2013 11:49:36 +0300, Νίκος wrote: Στις 18/6/2013 9:39 πμ, ο/η Larry Hudson έγραψε: Not quite: a and b _are_ memory addresses, At the same time, a and b are references to the data (the objects) stored in those memory locations. The distinction is probably more important in

RE: Python Liscensing

2013-06-18 Thread Steven Hern
From: Steven Hern Sent: 06 June 2013 08:49 To: 'webmas...@python.org' Cc: Dave Jordan Subject: Python Liscensing Dear Sir/Madam, We are an educational establishment which wishes to use Python 3.3.2 - Does the license cover multi-users in a classroom environment? Thanks Steven Hern Wigan and

decorator to fetch arguments from global objects

2013-06-18 Thread andrea crotti
Using a CouchDB server we have a different database object potentially for every request. We already set that db in the request object to make it easy to pass it around form our django app, however it would be nice if I could set it once in the API and automatically fetch it from there.

Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.]

2013-06-18 Thread Νίκος
Στις 18/6/2013 12:05 μμ, ο/η Steven D'Aprano έγραψε: Names are *always* linked to objects, not to other names. a = [] b = a # Now a and b refer to the same list a = {} # Now a refers to a dict, and b refers to the same list as before I see, thank you Steven. But since this is a fact how do

Re: Help me with the script? How to find items in csv file A and not in file B and vice versa

2013-06-18 Thread Andreas Perstinger
alonn...@gmail.com wrote: and when I run it I get an invalid syntex error and (as a true newbie I used a GUI)in_a_not_b is highlighted in the with open(inAnotB.csv, wb) as f: writer = csv.writer(f) writer.writerows([item] for item in_a_not_b)

Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.]

2013-06-18 Thread Chris Angelico
On Tue, Jun 18, 2013 at 7:51 PM, Νίκος supp...@superhost.gr wrote: Στις 18/6/2013 12:05 μμ, ο/η Steven D'Aprano έγραψε: Names are *always* linked to objects, not to other names. a = [] b = a # Now a and b refer to the same list a = {} # Now a refers to a dict, and b refers to the same list

python-django for dynamic web survey?

2013-06-18 Thread chip9munk
Hi guys! Please help me with your advices and ideas. I need to create a web survey that will dynamically (randomly) select questions and descriptions from a dataset, present them to users, collect their answers and store them back in the dataset. (Every user gets different set of questions

Re: Python Liscensing

2013-06-18 Thread Oscar Benjamin
On 18 June 2013 09:56, Steven Hern s.h...@wigan-leigh.ac.uk wrote: We are an educational establishment which wishes to use Python 3.3.2 – Does the license cover multi-users in a classroom environment? Yes, absolutely. Many educational institutions universities, schools, etc. use Python in

Re: Help me with the script? How to find items in csv file A and not in file B and vice versa

2013-06-18 Thread Alan Newbie
thanks a lot :) -- http://mail.python.org/mailman/listinfo/python-list

Re: python-django for dynamic web survey?

2013-06-18 Thread andrea crotti
Django makes your life a lot easier in many ways, but you still need some time to learn it. The task you're trying it's not trivial though, depending on your experience it might take a while with any library/framework.. -- http://mail.python.org/mailman/listinfo/python-list

Re: python-django for dynamic web survey?

2013-06-18 Thread chip9munk
On 18-Jun-13 12:59 PM, andrea crotti wrote: Django makes your life a lot easier in many ways, but you still need some time to learn it. The task you're trying it's not trivial though, depending on your experience it might take a while with any library/framework.. I have an overall experience

Re: Don't feed the troll...

2013-06-18 Thread Ben Finney
Oscar Benjamin oscar.j.benja...@gmail.com writes: There is a very simple solution used by many mailing lists Yes, that solution is described in RFC 2369: the “List-Post” field in the header of every message sent through the mailing list. which is to set the Reply-To header to point back to

Re: decorator to fetch arguments from global objects

2013-06-18 Thread Fábio Santos
On Tue, Jun 18, 2013 at 10:47 AM, andrea crotti andrea.crott...@gmail.com wrote: def with_optional_db(func): Decorator that sets the database to the global current one if not passed in or if passed in and None @wraps(func) def _with_optional_db(*args, **kwargs): func_args =

Re: decorator to fetch arguments from global objects

2013-06-18 Thread Wolfgang Maier
andrea crotti andrea.crotti.0 at gmail.com writes: Using a CouchDB server we have a different database object potentially for every request. We already set that db in the request object to make it easy to pass it around form our django app, however it would be nice if I could set it once

Re: Don't feed the troll...

2013-06-18 Thread Grant Edwards
On 2013-06-18, Chris Angelico ros...@gmail.com wrote: On Tue, Jun 18, 2013 at 2:39 PM, alex23 wuwe...@gmail.com wrote: tl;dr Stop acting like a troll and we'll stop perceiving you as such. This being Python-list, we duck-type. You don't have to declare that you're a troll, like you would in

Re: decorator to fetch arguments from global objects

2013-06-18 Thread andrea crotti
2013/6/18 Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de andrea crotti andrea.crotti.0 at gmail.com writes: Using a CouchDB server we have a different database object potentially for every request. We already set that db in the request object to make it easy to pass it

Re: Don't feed the troll...

2013-06-18 Thread Grant Edwards
On 2013-06-18, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Op 17-06-13 19:56, ru...@yahoo.com schreef: I don't see that much change in his style. He just admitted not reading help files (because they are too technical for him). So essentialy he is asking we give him a beginners

Re: decorator to fetch arguments from global objects

2013-06-18 Thread Wolfgang Maier
andrea crotti andrea.crotti.0 at gmail.com writes: 2013/6/18 Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de andrea crotti andrea.crotti.0 at gmail.com writes: Using a CouchDB server we have a different database object potentially for every request. We already set

dynamic if statement

2013-06-18 Thread upperdecksu
I am new to python and struggling with creating a dynamic if statement. I have a set of queries that are run against various databases/tables. The result is all the same in that I always get back the same field names. What I want to do is total the results differently based on the table. so

weird behavior. bug perhaps?

2013-06-18 Thread zoom
Hi, I have a strange problem here. Perhaps someone would care to help me. In the file test.py I have the following code: from scipy import matrix, tile, mean, shape import unittest class TestSequenceFunctions(unittest.TestCase): def setUp(self): self.m = [[1,2],[3,4],[3,4],[3,4]]

Re: weird behavior. bug perhaps?

2013-06-18 Thread rusi
On Jun 18, 7:23 pm, zoom z...@yahoo.com wrote: Hi, I have a strange problem here. Perhaps someone would care to help me. In the file test.py I have the following code: from scipy import matrix, tile, mean, shape import unittest class TestSequenceFunctions(unittest.TestCase):      def

Re: weird behavior. bug perhaps?

2013-06-18 Thread Marcel Rodrigues
Note that print [shape(m)[1],1] just prints a list with two elements where the first element is shape(m)[1] and the second is the number 1 (regardless of the value of m). I'm pretty sure that's not what you want. 2013/6/18 zoom z...@yahoo.com Hi, I have a strange problem here. Perhaps

Re: dynamic if statement

2013-06-18 Thread Tim Chase
On 2013-06-18 07:10, upperdec...@gmail.com wrote: I have a set of queries that are run against various databases/tables. The result is all the same in that I always get back the same field names. I query fld1, fld2, fld3, qty, qty2 from table1 then I loop thru the results if fld1 = 'a'

Re: weird behavior. bug perhaps?

2013-06-18 Thread Robert Kern
On 2013-06-18 15:23, zoom wrote: Hi, I have a strange problem here. Perhaps someone would care to help me. In the file test.py I have the following code: from scipy import matrix, tile, mean, shape import unittest class TestSequenceFunctions(unittest.TestCase): def setUp(self):

Re: dynamic if statement

2013-06-18 Thread Mark Lawrence
On 18/06/2013 15:56, Tim Chase wrote: On 2013-06-18 07:10, upperdec...@gmail.com wrote: I have a set of queries that are run against various databases/tables. The result is all the same in that I always get back the same field names. I query fld1, fld2, fld3, qty, qty2 from table1 then I loop

Re: weird behavior. bug perhaps?

2013-06-18 Thread zoom
On 06/18/2013 04:27 PM, rusi wrote: On Jun 18, 7:23 pm, zoomz...@yahoo.com wrote: Hi, I have a strange problem here. Perhaps someone would care to help me. In the file test.py I have the following code: from scipy import matrix, tile, mean, shape import unittest class

Re: weird behavior. bug perhaps?

2013-06-18 Thread zoom
On 06/18/2013 05:25 PM, Robert Kern wrote: On 2013-06-18 15:23, zoom wrote: Hi, I have a strange problem here. Perhaps someone would care to help me. In the file test.py I have the following code: from scipy import matrix, tile, mean, shape import unittest class

Re: decorator to fetch arguments from global objects

2013-06-18 Thread Terry Reedy
On 6/18/2013 5:47 AM, andrea crotti wrote: Using a CouchDB server we have a different database object potentially for every request. We already set that db in the request object to make it easy to pass it around form our django app, however it would be nice if I could set it once in the API and

Re: dynamic if statement

2013-06-18 Thread Tim Chase
On 2013-06-18 16:27, Mark Lawrence wrote: On 18/06/2013 15:56, Tim Chase wrote: name_index_map = dict( (info[0], i) for info, i in enumerate(cursor.description) Looks like this should be :- for i, info in enumerate(cursor.description) Doh, indeed, you're correct. As

Why is regex so slow?

2013-06-18 Thread Roy Smith
I've got a 170 MB file I want to search for lines that look like: [2010-10-20 16:47:50.339229 -04:00] INFO (6): songza.amie.history - ENQUEUEING: /listen/the-station-one This code runs in 1.3 seconds: -- import re pattern = re.compile(r'ENQUEUEING: /listen/(.*)')

Re: Why is regex so slow?

2013-06-18 Thread Skip Montanaro
I don't understand why the first way is so much slower. I have no obvious answers, but a couple suggestions: 1. Can you anchor the pattern at the beginning of the line? (use match() instead of search()) 2. Does it get faster it you eliminate the (.*) part of the pattern? It seems that if you

os.putenv() has no effect

2013-06-18 Thread Johannes Bauer
Hi group, I've tracked down a bug in my application to a rather strange phaenomenon: os.putenv() doesn't seem to have any effect on my platform (x86-64 Gentoo Linux, Python 3.2.3): os.getenv(PATH) '/usr/joebin:/usr/local/bin:/usr/bin:/bin:/usr/games/bin:/usr/sbin:/sbin:~/bin' os.putenv(PATH,

Re: Why is regex so slow?

2013-06-18 Thread Roy Smith
On Jun 18, 2013, at 1:01 PM, Skip Montanaro wrote: I don't understand why the first way is so much slower. I have no obvious answers, but a couple suggestions: 1. Can you anchor the pattern at the beginning of the line? (use match() instead of search()) That's one of the things we

Re: Why is regex so slow?

2013-06-18 Thread Chris Angelico
On Wed, Jun 19, 2013 at 3:08 AM, Roy Smith r...@panix.com wrote: I'm tempted to open this up as a performance bug against the regex module (which I assume will be rejected, at least for the 2.x series). Yeah, I'd try that against 3.3 before opening a performance bug. Also, it's entirely

Re: decorator to fetch arguments from global objects

2013-06-18 Thread andrea crotti
2013/6/18 Terry Reedy tjre...@udel.edu On 6/18/2013 5:47 AM, andrea crotti wrote: Using a CouchDB server we have a different database object potentially for every request. We already set that db in the request object to make it easy to pass it around form our django app, however it would

Re: Why is regex so slow?

2013-06-18 Thread MRAB
On 18/06/2013 17:45, Roy Smith wrote: I've got a 170 MB file I want to search for lines that look like: [2010-10-20 16:47:50.339229 -04:00] INFO (6): songza.amie.history - ENQUEUEING: /listen/the-station-one This code runs in 1.3 seconds: -- import re pattern =

Re: Why is regex so slow?

2013-06-18 Thread Mark Lawrence
On 18/06/2013 18:08, Roy Smith wrote: On Jun 18, 2013, at 1:01 PM, Skip Montanaro wrote: I don't understand why the first way is so much slower. I have no obvious answers, but a couple suggestions: 1. Can you anchor the pattern at the beginning of the line? (use match() instead of

Re: os.putenv() has no effect

2013-06-18 Thread Johannes Bauer
On 18.06.2013 19:24, inq1ltd wrote: if you are trying to add a dir to a linux path you need to understand how to add or change environment variables. Yeah, about this; I actually am fully aware of what I'm doing. research this; $ export PATH= $PATH: ???/???/??? You really couldn't have

multiprocessing pipes with custom pickler

2013-06-18 Thread skunkwerk
Hi, I need inter-process communication in Python, and was looking at the documentation here: http://docs.python.org/2/library/multiprocessing.html I am using a custom pickler, though, in order to deal with some objects that are not serialize-able through the built-in pickler. Is there any

Re: os.putenv() has no effect

2013-06-18 Thread inq1ltd
On Tuesday, June 18, 2013 06:49:31 PM Johannes Bauer wrote: Hi group, I've tracked down a bug in my application to a rather strange phaenomenon: os.putenv() doesn't seem to have any effect on my platform (x86-64 Gentoo Linux, Python 3.2.3): os.getenv(PATH)

Re: os.putenv() has no effect

2013-06-18 Thread Dave Angel
On 06/18/2013 12:49 PM, Johannes Bauer wrote: Hi group, I've tracked down a bug in my application to a rather strange phaenomenon: os.putenv() doesn't seem to have any effect on my platform (x86-64 Gentoo Linux, Python 3.2.3): os.getenv(PATH)

Re: os.putenv() has no effect

2013-06-18 Thread Johannes Bauer
On 18.06.2013 20:09, Dave Angel wrote: In other words, you shouldn't use putenv(), but instead modify os.environ. Huh... this is surprising to me. Because I actually looked it up in the manual and vaguely remember that there stood that os.environ is just a copy of the environment variables at

Re: os.putenv() has no effect

2013-06-18 Thread Johannes Bauer
On 18.06.2013 20:12, Johannes Bauer wrote: I am extremely certain that I found that passage, but can't find it right now anymore (probably staring right at it and can't find it still) :-/ Obviously, yes: Note On some platforms, including FreeBSD and Mac OS X, setting environ may cause memory

Re: os.putenv() has no effect

2013-06-18 Thread Skip Montanaro
Does anybody know why this would happen or what I could be doing wrong? os.putenv will only affect the environment in subprocesses. Consider this session fragment: % python Python 2.7.2 (default, Oct 17 2012, 03:11:33) [GCC 4.4.6 [TWW]] on sunos5 Type help, copyright, credits or license for

collecting variable assignments through settrace

2013-06-18 Thread skunkwerk
Hi, I'm writing a custom profiler that uses sys.settrace. I was wondering if there was any way of tracing the assignments of variables inside a function as its executed, without looking at locals() at every single line and comparing them to see if anything has changed. Sort of like xdebug's

Re: Why is regex so slow?

2013-06-18 Thread Johannes Bauer
On 18.06.2013 19:20, Chris Angelico wrote: Yeah, I'd try that against 3.3 before opening a performance bug. Also, it's entirely possible that performance is majorly different in 3.x anyway, on account of strings being Unicode. Definitely merits another look imho. Hmmm, at least Python 3.2

Re: Why is regex so slow?

2013-06-18 Thread Roy Smith
In article mailman.3549.1371576854.3114.python-l...@python.org, Mark Lawrence breamore...@yahoo.co.uk wrote: Out of curiousity have the tried the new regex module from pypi rather than the stdlib version? A heck of a lot of work has gone into it see http://bugs.python.org/issue2636 I just

Re: Why is regex so slow?

2013-06-18 Thread Rick Johnson
On Tuesday, June 18, 2013 11:45:29 AM UTC-5, Roy Smith wrote: I've got a 170 MB file I want to search for lines that look like: [2010-10-20 16:47:50.339229 -04:00] INFO (6): songza.amie.history - ENQUEUEING: /listen/the-station-one This code runs in 1.3 seconds:

Re: Why is regex so slow?

2013-06-18 Thread Roy Smith
On Tuesday, June 18, 2013 2:10:16 PM UTC-4, Johannes Bauer wrote: Resulting file has a size of 91530018 and md5 of 2d20c3447a0b51a37d28126b8348f6c5 (just to make sure we're on the same page because I'm not sure the PRNG is stable across Python versions). If people want to test against my

Oportunidade: Desenvolvedor Python

2013-06-18 Thread zughumancapital
Fabrica de software localizada na Barra da Tijuca contrata: Desenvolvedor Python Objetivo geral da Posição: Desenvolvimento de sistemas Web com Python/Django, HTML5, Javascript e CSS. Pré­requisitos: Experiência com Python/Django ou outro framework MVC. Familiarizado com desenvolvimento

Oportunidade: Desenvolvedor Python

2013-06-18 Thread zughumancapital
Fabrica de software localizada na Barra da Tijuca contrata: Desenvolvedor Python Objetivo geral da Posição: Desenvolvimento de sistemas Web com Python/Django, HTML5, Javascript e CSS. Pré­requisitos: Experiência com Python/Django ou outro framework MVC. Familiarizado com desenvolvimento

Re: Why is regex so slow?

2013-06-18 Thread MRAB
On 18/06/2013 20:21, Roy Smith wrote: In article mailman.3549.1371576854.3114.python-l...@python.org, Mark Lawrence breamore...@yahoo.co.uk wrote: Out of curiousity have the tried the new regex module from pypi rather than the stdlib version? A heck of a lot of work has gone into it see

Re: Why is regex so slow?

2013-06-18 Thread André Malo
* Johannes Bauer wrote: The pre-check version is about 42% faster in my case (0.75 sec vs. 1.3 sec). Curious. This is Python 3.2.3 on Linux x86_64. A lot of time is spent with dict lookups (timings at my box, Python 3.2.3) in your inner loop (150 times...) #!/usr/bin/python3 import re

Re: Why is regex so slow?

2013-06-18 Thread Antoine Pitrou
Roy Smith roy at panix.com writes: Every line which contains 'ENQ' also matches the full regex (61425 lines match, out of 2.1 million total). I don't understand why the first way is so much slower. One invokes a fast special-purpose substring searching routine (the str.__contains__

Re: Why is regex so slow?

2013-06-18 Thread André Malo
* André Malo wrote: * Johannes Bauer wrote: The pre-check version is about 42% faster in my case (0.75 sec vs. 1.3 sec). Curious. This is Python 3.2.3 on Linux x86_64. A lot of time is spent with dict lookups (timings at my box, Python 3.2.3) in your inner loop (150 times...) [...]

Re: Why is regex so slow?

2013-06-18 Thread Roy Smith
On Tuesday, June 18, 2013 4:05:25 PM UTC-4, Antoine Pitrou wrote: One invokes a fast special-purpose substring searching routine (the str.__contains__ operator), the other a generic matching engine able to process complex patterns. It's hardly a surprise for the specialized routine to be

Re: os.putenv() has no effect

2013-06-18 Thread Terry Reedy
On 6/18/2013 12:49 PM, Johannes Bauer wrote: Hi group, I've tracked down a bug in my application to a rather strange phaenomenon: os.putenv() doesn't seem to have any effect on my platform (x86-64 Gentoo Linux, Python 3.2.3): os.getenv(PATH)

Re: Why is regex so slow?

2013-06-18 Thread Grant Edwards
On 2013-06-18, Antoine Pitrou solip...@pitrou.net wrote: Roy Smith roy at panix.com writes: You should read again on the O(...) notation. It's an asymptotic complexity, it tells you nothing about the exact function values at different data points. So you can have two O(n) routines, one of

Re: Why is regex so slow?

2013-06-18 Thread Terry Reedy
On 6/18/2013 4:30 PM, Grant Edwards wrote: On 2013-06-18, Antoine Pitrou solip...@pitrou.net wrote: Roy Smith roy at panix.com writes: You should read again on the O(...) notation. It's an asymptotic complexity, it tells you nothing about the exact function values at different data points. So

Re: collecting variable assignments through settrace

2013-06-18 Thread Terry Reedy
On 6/18/2013 2:38 PM, skunkwerk wrote: Hi, I'm writing a custom profiler that uses sys.settrace. I was wondering if there was any way of tracing the assignments of variables inside a function as its executed, without looking at locals() at every single line and comparing them to see if anything

Re: A certainl part of an if() structure never gets executed.

2013-06-18 Thread Jan Riechers
On 13.06.2013 20:00, Νικόλαος Κούρας wrote: if '-' not in name + month + year: cur.execute( '''SELECT * FROM works WHERE clientsID = (SELECT id FROM clients WHERE name = %s) and MONTH(lastvisit) = %s and YEAR(lastvisit) = %s ORDER BY lastvisit ASC''', (name, month, year) )

Re: Why is regex so slow?

2013-06-18 Thread Steven D'Aprano
On Tue, 18 Jun 2013 12:45:29 -0400, Roy Smith wrote: I've got a 170 MB file I want to search for lines that look like: [2010-10-20 16:47:50.339229 -04:00] INFO (6): songza.amie.history - ENQUEUEING: /listen/the-station-one This code runs in 1.3 seconds: --

Re: Why is regex so slow?

2013-06-18 Thread Dave Angel
On 06/18/2013 09:51 PM, Steven D'Aprano wrote: SNIP Even if the regex engine is just as efficient at doing simple character matching as `in`, and it probably isn't, your regex tries to match all eleven characters of ENQUEUEING while the `in` test only has to match three, ENQ. The rest of

Beginner Question: 3D Models

2013-06-18 Thread andrewblundon
Hi there, Sorry for the complete beginner question but I thought the readers here might be able to provide me with some guidance. I've done some programming with Visual Basic and VBA plus a little PHP, CSS and HTML. I'm looking at developing a program for work that can be distributed to

Re: Why is regex so slow?

2013-06-18 Thread Steven D'Aprano
On Tue, 18 Jun 2013 22:11:01 -0400, Dave Angel wrote: On 06/18/2013 09:51 PM, Steven D'Aprano wrote: SNIP Even if the regex engine is just as efficient at doing simple character matching as `in`, and it probably isn't, your regex tries to match all eleven characters of ENQUEUEING

Re: Beginner Question: 3D Models

2013-06-18 Thread Steven D'Aprano
On Tue, 18 Jun 2013 19:47:34 -0700, andrewblundon wrote: However, for one part of the program I'd like to be able to create a 3D model based on the user input. The model would be very basic consisting of a number of lines and objects. We have 3D models of each component within our CAD

Re: Don't feed the troll...

2013-06-18 Thread rurpy
On 06/18/2013 02:22 AM, Antoon Pardon wrote: Op 17-06-13 19:56, ru...@yahoo.com schreef: On 06/17/2013 02:15 AM, Antoon Pardon wrote: Op 17-06-13 05:46, ru...@yahoo.com schreef: On 06/16/2013 02:04 PM, Steven D'Aprano wrote: Yes. Trying to start flame wars with Nikos is unacceptable

Re: Don't feed the troll...

2013-06-18 Thread rurpy
On 06/18/2013 01:21 AM, Chris Angelico wrote: On Tue, Jun 18, 2013 at 2:39 PM, alex23 wuwe...@gmail.com wrote: tl;dr Stop acting like a troll and we'll stop perceiving you as such. This being Python-list, we duck-type. You don't have to declare that you're a troll, like you would in C; you

Re: Don't feed the troll...

2013-06-18 Thread Grant Edwards
On 2013-06-18, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Tue, 18 Jun 2013 13:38:40 + (UTC), Grant Edwards On 2013-06-18, Chris Angelico ros...@gmail.com wrote: On Tue, Jun 18, 2013 at 2:39 PM, alex23 wuwe...@gmail.com wrote: tl;dr Stop acting like a troll and we'll stop perceiving

Re: decorator to fetch arguments from global objects

2013-06-18 Thread Steven D'Aprano
On Tue, 18 Jun 2013 10:47:57 +0100, andrea crotti wrote: Using a CouchDB server we have a different database object potentially for every request. We already set that db in the request object to make it easy to pass it around form our django app, however it would be nice if I could set it

Re: python-django for dynamic web survey?

2013-06-18 Thread Jason Friedman
Hi guys! Please help me with your advices and ideas. I need to create a web survey that will dynamically (randomly) select questions and descriptions from a dataset, present them to users, collect their answers and store them back in the dataset. (Every user gets different set of questions

Re: A certainl part of an if() structure never gets executed.

2013-06-18 Thread Tim Roberts
Nick the Gr33k supp...@superhost.gr wrote: On 16/6/2013 4:55 ??, Tim Roberts wrote: Nick the Gr33k supp...@superhost.gr wrote: Because Python lets you use arbitrary values in a Boolean context, the net result is exactly the same. What is an arbitrary value? don even knwo what arbitrary means

Re: A certainl part of an if() structure never gets executed.

2013-06-18 Thread Dave Angel
I think this is an excellent description of name binding with mutable objects. I just have one clarification to insert below. On 06/19/2013 01:08 AM, Tim Roberts wrote: Nick the Gr33k supp...@superhost.gr wrote: On 16/6/2013 4:55 ??, Tim Roberts wrote: Nick the Gr33k supp...@superhost.gr

[issue16901] In http.cookiejar.FileCookieJar() the .load() and .revert() methods don't work

2013-06-18 Thread Martin Panter
Changes by Martin Panter vadmium...@gmail.com: -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16901 ___ ___ Python-bugs-list

[issue9740] Support for HTTP 1.1 persistent connections throughout the standard library

2013-06-18 Thread Martin Panter
Changes by Martin Panter vadmium...@gmail.com: -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9740 ___ ___ Python-bugs-list

[issue14000] Subprocess stdin.flush does not flush

2013-06-18 Thread Jian Wen
Jian Wen added the comment: The following code shows how to use pts. #!/usr/bin/env python import os import pty import shlex import time _args = /usr/bin/ssh example.com args = shlex.split(_args) pid, child_fd = pty.fork() if pid == 0: # Child os.execv(/usr/bin/ssh, args) else:

[issue18251] test_subprocess_jy fails when Argument has embedded quote

2013-06-18 Thread Sowmya
New submission from Sowmya: test_subprocess_jy fails with below error: test test_subprocess_jy failed -- Traceback (most recent call last): File \'L:\\apps\\ascii\\jython\\70files\\current\\win\\Lib\\test\\test_subprocess_jy.py\', line 13, in testDefaultEnvIsInherited p1 =

[issue18252] timeit makes code run faster?

2013-06-18 Thread icedream91
New submission from icedream91: I used Python 3.3.2 to try this problem: http://projecteuler.net/problem=23 , and I got a correct answer. When I wanted to check how long it took, I found something strange: When I ran 23.py directly, it showed that it took about 13s. But if I use timeit

[issue18252] timeit makes code run faster?

2013-06-18 Thread icedream91
Changes by icedream91 icedrea...@gmail.com: Removed file: http://bugs.python.org/file30633/23.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18252 ___

[issue18252] timeit makes code run faster?

2013-06-18 Thread icedream91
icedream91 added the comment: I used Python 3.3.2 to try this problem: http://projecteuler.net/problem=23 , and I got a correct answer. When I wanted to check how long it took, I found something strange: When I ran 23.py directly, it showed that it took about 13s. But if I use timeit module,

[issue18253] make standard library PEP8 compliant

2013-06-18 Thread Friedrich Spee von Langenfeld
New submission from Friedrich Spee von Langenfeld: The modules in the standard library aren´t PEP( compliant. I´ve written a script to change this. It uses autopep8.py (must be in the path) and is written for Windows users. -- components: Library (Lib) files: autopepframework.py

[issue18252] timeit makes code run faster?

2013-06-18 Thread Richard Oudkerk
Richard Oudkerk added the comment: I think if you use timeit then the code is wrapped inside a function before it is compiled. This means that your code can mostly use faster local lookups rather than global lookups. -- nosy: +sbt ___ Python

  1   2   >