Re: Don't feed the troll...

2013-06-18 Thread Chris Angelico
On Tue, Jun 18, 2013 at 11:03 AM, 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 me to ac

Re: Don't feed the troll...

2013-06-18 Thread Chris Angelico
On Tue, Jun 18, 2013 at 6:15 AM, Guy Scree 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 thinking that th

Re: Don't feed the troll...

2013-06-18 Thread Chris Angelico
On Tue, Jun 18, 2013 at 2:39 PM, alex23 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. We never ask "ar

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

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 appear

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 m

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 ma

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 file

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 di

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 tha

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 o

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 impo

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 Le

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

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 y

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, Νίκος 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 as befor

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 ra

Re: Python Liscensing

2013-06-18 Thread Oscar Benjamin
On 18 June 2013 09:56, Steven Hern 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 classroom environments (th

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 wi

Re: Don't feed the troll...

2013-06-18 Thread Ben Finney
Oscar Benjamin 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 the mailing list. That is

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 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 = func.func_code.co_varnames >

Re: decorator to fetch arguments from global objects

2013-06-18 Thread Wolfgang Maier
andrea crotti 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 in the API an

Re: Don't feed the troll...

2013-06-18 Thread Grant Edwards
On 2013-06-18, Chris Angelico wrote: > On Tue, Jun 18, 2013 at 2:39 PM, alex23 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 trol

Re: decorator to fetch arguments from global objects

2013-06-18 Thread andrea crotti
2013/6/18 Wolfgang Maier > andrea crotti 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 b

Re: Don't feed the troll...

2013-06-18 Thread Grant Edwards
On 2013-06-18, Antoon Pardon 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 >>> tutorial in everything

Re: decorator to fetch arguments from global objects

2013-06-18 Thread Wolfgang Maier
andrea crotti gmail.com> writes: > > 2013/6/18 Wolfgang Maier biologie.uni-freiburg.de> > > > andrea crotti 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

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 fo

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

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 > Hi, I have a strange problem here. Perhaps someone would care t

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

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, 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.TestCa

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 TestSequenceFunctions(unittest

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 cor

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/(.*)') co

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 yo

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(

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 w

Re: Why is regex so slow?

2013-06-18 Thread Chris Angelico
On Wed, Jun 19, 2013 at 3:08 AM, Roy Smith 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 possible that perf

Re: decorator to fetch arguments from global objects

2013-06-18 Thread andrea crotti
2013/6/18 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 nic

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

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

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 h

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 wa

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") > > '/usr/joebin:/u

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") '/usr/joebin:/usr/local/bin:/usr/bin:/bin:/usr/g

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 i

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

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 , Mark Lawrence 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 installed that and gave it a shot. It's *slower* (and, much higher var

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 m

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

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

Re: Why is regex so slow?

2013-06-18 Thread MRAB
On 18/06/2013 20:21, Roy Smith wrote: In article , Mark Lawrence 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 installed that and gave it a shot. I

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 pa

Re: Why is regex so slow?

2013-06-18 Thread Antoine Pitrou
Roy Smith 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__ operator),

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 f

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") '/usr/joebin:/usr/local/bin:/usr/bin:/bin:/usr/ga

Re: Why is regex so slow?

2013-06-18 Thread Grant Edwards
On 2013-06-18, Antoine Pitrou wrote: > Roy Smith 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 which always twice fast

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 wrote: Roy Smith 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) rou

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

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: > > >> >> 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 "ENQUEUEI

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 sy

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 unaccept

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

Re: Don't feed the troll...

2013-06-18 Thread Grant Edwards
On 2013-06-18, Dennis Lee Bieber wrote: > On Tue, 18 Jun 2013 13:38:40 + (UTC), Grant Edwards >>On 2013-06-18, Chris Angelico wrote: >>> On Tue, Jun 18, 2013 at 2:39 PM, alex23 wrote: tl;dr Stop acting like a troll and we'll stop perceiving you as such. >>> >>> This being Python-list, w

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

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 qu

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

2013-06-18 Thread Tim Roberts
Nick the Gr33k wrote: > >On 16/6/2013 4:55 ??, Tim Roberts wrote: > >> Nick the Gr33k 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 literally >in English. Basi

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 wrote: On 16/6/2013 4:55 ??, Tim Roberts wrote: Nick the Gr33k wrote: Because Python lets you use arbitr

Re: Beginner Question: 3D Models

2013-06-18 Thread Christian Gollwitzer
Am 19.06.13 04:47, schrieb andrewblun...@gmail.com: 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 system so it w

Re: python-django for dynamic web survey?

2013-06-18 Thread chip9munk
On 19-Jun-13 7:04 AM, Jason Friedman wrote: How random do the questions need to be? Is a handful or two different combinations sufficient? Can you manually create these different surveys using, for example, surveymonkey, and distribute them? There are a lot possible combinations and question