Re: Passing variable to SQL statement when using psycopg2

2010-08-30 Thread Chris Rebert
On Sun, Aug 29, 2010 at 11:29 PM, Julia Jacobson wrote: > Dear python users, > > For passing a variable to a SQL query for psycopg2, I use: > >  >>> my_var = xyz >  >>> print cur.mogrify("SELECT my_values FROM my_table WHERE my_column = > %s",(my_var,)) > > This returns: > >  >>> SELECT my_values

Re: Queue cleanup

2010-08-30 Thread Paul Rubin
Steven D'Aprano writes: > I'm not saying that ref counting systems can avoid incrementing and > decrementing the ref counts. That would be silly. But I'm saying that it > is an accident of implementation that writing C extensions requires you > to manually manage the counts yourself. That's a s

Re: Queue cleanup

2010-08-30 Thread Steven D'Aprano
On Mon, 30 Aug 2010 00:22:17 -0700, Paul Rubin wrote: > I don't think a C compiler could really manage automatic decrementing > while still being C. Think especially of the common style of exception > handling in C using longjmp. You might very well be right. But that's the problem with C -- it'

Re: Queue cleanup

2010-08-30 Thread Gregory Ewing
Paul Rubin wrote: These days I think the GC pause issue is overrated except for real-time control applications. Also for games, which are a fairly common application these days. Even a few milliseconds can be too long when you're trying to achieve smooth animation. I'd be disappointed if CPyt

Re: Problem checking an existing browser cookie

2010-08-30 Thread Nik the Greek
On 30 Αύγ, 06:12, MRAB wrote: > On 30/08/2010 03:55, Nik the Greek wrote: > > > > > > > > > > > On 30 Αύγ, 05:43, MRAB  wrote: > >> On 30/08/2010 03:07, Nik the Greek wrote: > > >>> On 30 Αύγ, 04:51, MRAB    wrote: > On 30/08/2010 02:14, Νίκος wrote: > > > On 29 Αύγ, 21:44, MRAB      wrot

Re: String substitution VS proper mysql escaping

2010-08-30 Thread Gregory Ewing
Nik the Greek wrote: Yes i will i just asked to know if i were to substitute what might be the problem so to understand why i need the quoting. Because if you use % to build a query string, the result must be syntactically valid SQL. The values that you substitute into the placeholders must en

Re: Queue cleanup

2010-08-30 Thread Lawrence D'Oliveiro
In message <7xr5hg3a7s@ruckus.brouhaha.com>, Paul Rubin wrote: > Actually that code looks suspicious. Suppose in > > AddrObj = PyTuple_GetItem(TheBufferInfo, 0); > LenObj = PyTuple_GetItem(TheBufferInfo, 1); > > the first PyTuple_GetItem succeeds and the second one fails.

Re: Passing variable to SQL statement when using psycopg2

2010-08-30 Thread Gregory Ewing
Chris Rebert wrote: On Sun, Aug 29, 2010 at 11:29 PM, Julia Jacobson Where does the "E" in front of 'xyz' come from? It's probably the reason, why my query doesn't work. Quite doubtful, considering the example in the psycopg2 docs also has the E: http://initd.org/psycopg/docs/cursor.html#cur

Re: Queue cleanup

2010-08-30 Thread Lawrence D'Oliveiro
In message <7x39twpuxi@ruckus.brouhaha.com>, Paul Rubin wrote: > Lawrence D'Oliveiro writes: > >>> the CPython API means endlessly finding and fixing refcount bugs that >>> lead to either crashes/security failures, or memory leaks. >> >> I don’t see why that should be so. It seems a very simp

Surge 2010 Early Registration ends Tuesday!

2010-08-30 Thread Jason Dixon
Early Bird Registration for Surge Scalability Conference 2010 ends next Tuesday, August 31. We have a killer lineup of speakers and architects from across the Internet. Listen to experts talk about the newest methods and technologies for scaling your Web presence. http://omniti.com/surge/2010/re

Re: how to find out, whether a path is socket or device

2010-08-30 Thread News123
On 08/30/2010 02:09 AM, Steven D'Aprano wrote: > On Mon, 30 Aug 2010 01:46:16 +0200, News123 wrote: > >> Hi, >> >> Under Linux I'd like to find out, whether I got a file, a character >> device or a socket as a parameter. > > See the stat module. > > Thks a lot. I was looking in os.path and forg

comp.lang.python

2010-08-30 Thread roshini begum
www.127760.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: PyGeo

2010-08-30 Thread Thomas Jollans
On Monday 30 August 2010, it occurred to L to exclaim: > I have tried it and as soon as you try any of the examples in the > examples dir it cannot find numpy etc > > I have manually move the pygeo dirs and contents to > /usr/lib/python2.6/dis-packages, > > (this is the directory where num

Re: Confused: Newbie Function Calls

2010-08-30 Thread Stefan Schwarzer
Hi Pinku, On 2010-08-11 21:35, Pinku Surana wrote: > Even though I used the same name "x" for a local and global variable, > they are actually completely different. When I call "fun(x)" it COPIES > the global value of "x" into the local variable "x" in "fun". [...] The global value isn't copied w

Re: Queue cleanup

2010-08-30 Thread Paul Rubin
Lawrence D'Oliveiro writes: >> AddrObj = PyTuple_GetItem(TheBufferInfo, 0); >> LenObj = PyTuple_GetItem(TheBufferInfo, 1); >> >> the first PyTuple_GetItem succeeds and the second one fails. > > Admittedly, I did take a shortcut here: array.buffer_info returns a tuple of > two i

Re: How to convert (unicode) text to image?

2010-08-30 Thread Thomas Jollans
On Monday 30 August 2010, it occurred to ru...@yahoo.com to exclaim: > Face the facts dude. The Python docs have some major problems. > They were pretty good when Python was a new, cool, project used > by a handful of geeks. They are good relative to the "average" > (whatever that is) open source

Re: help in code

2010-08-30 Thread Ulrich Eckhardt
Steven D'Aprano wrote: [reading Bengali] > In Python 2, you probably need to do this: > > f = open("filename") > bytes = f.read() > text = bytes.decode('which-encoding-you-use') > f.close() In Python 2, I'd rather take a look at the "codecs" module (see http://docs.python.org), namely the "codecs

Re: Queue cleanup

2010-08-30 Thread Paul Rubin
Lawrence D'Oliveiro writes: >> If it hasn't happened to you yet, you're either burning a bunch of effort >> that programmers of more automatic systems can put to more productive >> uses ... > > What makes you say that? Avoiding bugs is not a “productive use”? Avoiding any particular bug through c

Re: Queue cleanup

2010-08-30 Thread Paul Rubin
Gregory Ewing writes: >> These days I think the GC pause issue is overrated except for real-time >> control applications. > > Also for games, which are a fairly common application > these days. Even a few milliseconds can be too long when > you're trying to achieve smooth animation. The usual hac

Re: How to convert (unicode) text to image?

2010-08-30 Thread Paul Rubin
Thomas Jollans writes: > Actually, the Python standard library reference manual is excellent. At least > that's my opinion > What exactly are you comparing the Python docs to, I wonder? Obviously not > something like Vala, but that goes without saying. I didn't know Vala had especially goo

Re: How to convert (unicode) text to image?

2010-08-30 Thread Thomas Jollans
On Monday 30 August 2010, it occurred to Paul Rubin to exclaim: > Thomas Jollans writes: > > Actually, the Python standard library reference manual is excellent. At > > least that's my opinion > > What exactly are you comparing the Python docs to, I wonder? Obviously > > not something like Val

Re: Simple Problem but tough for me if i want it in linear time

2010-08-30 Thread Aahz
In article , Tim Chase wrote: >On 08/18/10 21:47, Steven D'Aprano wrote: >> >> Frankly, I think the OP doesn't really know what he wants, other than >> premature optimization. It's amazing how popular that is :) > >You see, the trick to prematurely optimizing is to have a good >algorithm for pre

Re: Queue cleanup

2010-08-30 Thread Aahz
In article <4c7b279d$0$28650$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: >On Sun, 29 Aug 2010 17:52:38 -0700, Paul Rubin wrote: >>Attribution lost: >>> >>> That's a problem with the CPython API, not reference counting. The >>> problem is that the CPython API is written at too low a level,

Re: Using a function for regular expression substitution

2010-08-30 Thread naugiedoggie
On Aug 29, 1:14 pm, MRAB wrote: > On 29/08/2010 15:22, naugiedoggie wrote: > > I'm having a problem with using a function as the replacement in > > re.sub(). > > Here is the function: > > def normalize(s) : > >      return > > urllib.quote(string.capwords(urllib.unquote(s.group('provider' >

Re: Performance: sets vs dicts.

2010-08-30 Thread Aahz
In article , Raymond Hettinger wrote: >On Aug 29, 12:12=A0pm, John Nagle wrote: >> >> Is the "in" test faster for a dict or a set? Is "frozenset" faster >> than "set"? Use case is for things like applying "in" on a list of >> 500 or so words while checking a large body of text. > >There is no s

Re: Using a function for regular expression substitution

2010-08-30 Thread naugiedoggie
On Aug 30, 8:52 am, naugiedoggie wrote: > On Aug 29, 1:14 pm, MRAB wrote: > > > > > > > On 29/08/2010 15:22, naugiedoggie wrote: > > > I'm having a problem with using a function as the replacement in > > > re.sub(). > > > Here is the function: > > > def normalize(s) : > > >      return > > > urll

Re: Performance: sets vs dicts.

2010-08-30 Thread Paul Rubin
a...@pythoncraft.com (Aahz) writes: > That reminds me: one co-worker (who really should have known better ;-) > had the impression that sets were O(N) rather than O(1). Although > writing that off as a brain-fart seems appropriate, it's also the case > that the docs don't really make that clear, i

Re: Problem checking an existing browser cookie

2010-08-30 Thread Nik the Greek
On 30 Αύγ, 11:01, Nik the Greek wrote: > On 30 Αύγ, 06:12, MRAB wrote: > > > > > > > > > > > On 30/08/2010 03:55, Nik the Greek wrote: > > > > On 30 Αύγ, 05:43, MRAB  wrote: > > >> On 30/08/2010 03:07, Nik the Greek wrote: > > > >>> On 30 Αύγ, 04:51, MRAB    wrote: > > On 30/08/2010 02:14, Ν

shlex, unicode, and subprocess.Popen on Windows

2010-08-30 Thread python
Python 2.6/Windows: shlex.split() does not support unicode strings. Is this simply a limitation of the current shlex implementation or is this an intentional design decision that reflects the behavior of how the Windows shell supports unicode values? Specifically, it doesn't appear that subprocess

Re: shlex, unicode, and subprocess.Popen on Windows

2010-08-30 Thread Chris Rebert
On Mon, Aug 30, 2010 at 6:54 AM, wrote: > Python 2.6/Windows: shlex.split() does not support unicode strings. Is this > simply a limitation of the current shlex implementation or is this an > intentional design decision that reflects the behavior of how the Windows > shell supports unicode values

Re: Performance: sets vs dicts.

2010-08-30 Thread Ben Finney
a...@pythoncraft.com (Aahz) writes: > That reminds me: one co-worker (who really should have known better ;-) > had the impression that sets were O(N) rather than O(1). For settling exactly this kind of confusion, Python's standard library comes with a module, the ‘timeit’ module. Your co-worker

meta-class troubles

2010-08-30 Thread Ethan Furman
Good Day! I am stuck... hopefully a few fresh pairs of eyes will spot what I am missing. I have a metaclass, Traits, and two different testing files, test_traits.py and tests.py. test_traits works fine, tests generates the following error: C:\Python31\Lib\site-packages\traits\tests>\pytho

Re: meta-class troubles

2010-08-30 Thread Chris Rebert
On Mon, Aug 30, 2010 at 7:10 AM, Ethan Furman wrote: > Good Day! > > I am stuck... hopefully a few fresh pairs of eyes will spot what I am > missing. > > I have a metaclass, Traits, and two different testing files, test_traits.py > and tests.py.  test_traits works fine, tests generates the followi

Re: meta-class troubles

2010-08-30 Thread Xavier Ho
Ethan, are you trying to write the constructor in the class statement? Cheers, Xav On 31 August 2010 00:10, Ethan Furman wrote: > Good Day! > > I am stuck... hopefully a few fresh pairs of eyes will spot what I am > missing. > > I have a metaclass, Traits, and two different testing files, test_

Re: meta-class troubles

2010-08-30 Thread Xavier Ho
Actually, scrape what I said. I think you need to have metaclass in the class statement, not just meta. -Xav On 31 August 2010 00:16, Xavier Ho wrote: > Ethan, are you trying to write the constructor in the class statement? > > Cheers, > Xav > > > On 31 August 2010 00:10, Ethan Furman wrote:

Re: shlex, unicode, and subprocess.Popen on Windows

2010-08-30 Thread python
Hi Chris, > It's a bug: http://bugs.python.org/issue1170 Thanks for pointing out the shlex bug. My concern was that shlex had Windows specific Unicode limitations because of the way the Windows shell so poorly supports unicode output. > Kudos for avoiding shell=True My understanding is that the

python 2.6.6 installation problems on osx

2010-08-30 Thread jal
Hi All, I'm attempting a framework install of python 2.6.6 from source, on an intel mac running osx 10.6.4. At the end of the install the following errors occur. install: mkdir /usr/local/bin: Permission denied make[1]: *** [altinstallunixtools] Error 71 make: *** [frameworkaltinstallunixtools]

Re: How to implement a pipeline...??? Please help

2010-08-30 Thread Ritchy lelis
On 26 Ago, 08:52, Dennis Lee Bieber wrote: > On Tue, 24 Aug 2010 22:21:34 -0700 (PDT), Ritchy lelis > declaimed the following in > gmane.comp.python.general: > > > hi friend Dennis Lee Bieber > > > I have watching your code sujestion and now i can understand more of > > what you have there.. > >

Re: PyGeo

2010-08-30 Thread villorent
Maybe you could try this: http://hyry.dip.jp/files/pygeo.7z I found it on this page: http://hyry.dip.jp/blogt.py?file=0432.blog -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble importing cx_Oracle on HPUX

2010-08-30 Thread Cliff Martin
including libttsh11 fixed the problem. Thank you! Now I can get on with fixing everything that Python 3 broke... err changed. :) -- Cliff On Sat, Aug 28, 2010 at 11:20 AM, Alexander Gattin wrote: > Hello, > > On Sat, Aug 28, 2010 at 09:27:05AM -0400, Cliff > Martin wrote: > > Yes, our entire

Re: python 2.6.6 installation problems on osx

2010-08-30 Thread Benjamin Kaplan
On Mon, Aug 30, 2010 at 10:29 AM, jal wrote: > Hi All, > > I'm attempting a framework install of python 2.6.6 from source, on an > intel mac running osx 10.6.4. > > At the end of the install the following errors occur. > > install: mkdir /usr/local/bin: Permission denied > make[1]: *** [altinstall

Re: meta-class troubles

2010-08-30 Thread Ethan Furman
Chris Rebert wrote: Shouldn't meta= instead be metaclass= ? Xavier Ho wrote: > I think you need to have metaclass in the class statement, not just meta. Argh. Thank you both. I'm glad it was simple! ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Optimising literals away

2010-08-30 Thread Thomas Jollans
On Monday 30 August 2010, it occurred to Tobias Weber to exclaim: > Hi, > whenever I type an "object literal" I'm unsure what optimisation will do > to it. > > def m(arg): > if arg & set([1,2,3]): > return 4 > > Is the set created every time the method is called? What about a > frozenset? O

Re: Optimising literals away

2010-08-30 Thread Benjamin Peterson
Tobias Weber gmx.net> writes: > > Hi, > whenever I type an "object literal" I'm unsure what optimisation will do > to it. > > def m(arg): > if arg & set([1,2,3]): > return 4 > > Is the set created every time the method is called? Yes, and the list. > What about a > frozenset? Yep.

Re: Optimising literals away

2010-08-30 Thread Arnaud Delobelle
Tobias Weber writes: > Hi, > whenever I type an "object literal" I'm unsure what optimisation will do > to it. > > def m(arg): > if arg & set([1,2,3]): > return 4 > > Is the set created every time the method is called? What about a > frozenset? Or tuple vs list? After how many calls per s

Re: String substitution VS proper mysql escaping

2010-08-30 Thread Nik the Greek
On 30 Αύγ, 11:11, Gregory Ewing wrote: > Nik the Greek wrote: > > Yes i will i just asked to know if i were to substitute what might be > > the problem so to understand why i need the quoting. > > Because if you use % to build a query string, the result must > be syntactically valid SQL. The value

JSONBOT 0.3 RELEASE

2010-08-30 Thread Bart Thate
Hello world ! I just released version 0.3 of JSONBOT. JSONBOT is a remote event driven framework for building bots that talk JSON to each other over XMPP. This distribution provides bots built on this framework for console, IRC, XMPP for the shell and WWW and XMPP for the Google Application engin

Re: Problem checking an existing browser cookie

2010-08-30 Thread Peter Otten
Nik the Greek wrote: >> Perhpas its doenst get loaded like that? >> >> # initialize cookie >> cookie = SimpleCookie() >> cookie.load( os.environ.get('HTTP_COOKIE', '') ) >> mycookie = cookie.get('visitor') > > Please someone else has an idea on how this to work? Add a print statement to verify t

Re: String substitution VS proper mysql escaping

2010-08-30 Thread Alexander Kapps
Nik the Greek wrote: cursor.execute(''' SELECT hits FROM counters WHERE page = %s and date = %s and host = %s ''' , a_tuple ) and cursor.execute(''' SELECT hits FROM counters WHERE page = %s and date = %s and host = %s ''' , (a_tuple) ) are both syntactically correct right? buw what about c

Re: Problem checking an existing browser cookie

2010-08-30 Thread MRAB
On 30/08/2010 04:33, Nik the Greek wrote: On 30 Αύγ, 06:12, MRAB wrote: This part: ( not mycookie or mycookie.value != 'nikos' ) is false but this part: re.search( r'(msn|yandex|13448|spider|crawl)', host ) is None is true because host doesn't contain any of those substrings.

Re: String substitution VS proper mysql escaping

2010-08-30 Thread MRAB
On 30/08/2010 17:09, Nik the Greek wrote: On 30 Αύγ, 11:11, Gregory Ewing wrote: Nik the Greek wrote: Yes i will i just asked to know if i were to substitute what might be the problem so to understand why i need the quoting. Because if you use % to build a query string, the result must be sy

Re: String substitution VS proper mysql escaping

2010-08-30 Thread MRAB
On 30/08/2010 17:34, Alexander Kapps wrote: Nik the Greek wrote: cursor.execute(''' SELECT hits FROM counters WHERE page = %s and date = %s and host = %s ''' , a_tuple ) and cursor.execute(''' SELECT hits FROM counters WHERE page = %s and date = %s and host = %s ''' , (a_tuple) ) are both sy

Re: bug? pkgutil.walk_packages returns packages that result in an ImportError

2010-08-30 Thread Chris Withers
Peter Otten wrote: My expectation of this is that if onerrors is left as None, names yielded will be importable. I would infer no such promise, especially as the generator also yields modules, and no attempt at all is made to import those. Really? I thought the __import__ fired over everythi

python+sqlite3 in memory database

2010-08-30 Thread Denis Gomes
Hi Everyone, I am using sqlite3 with python2.5 and the pysqlite wrapper. I am trying to copy tables from one database (in memory) to another database (file) using ATTACH. I looked on the internet and found a couple of sites that show how to do this but the table schema is not copied. def Save

Re: Problem checking an existing browser cookie

2010-08-30 Thread Nik the Greek
On 30 Αύγ, 19:41, MRAB wrote: > On 30/08/2010 04:33, Nik the Greek wrote: > > > > > > > > > On 30 Αύγ, 06:12, MRAB  wrote: > > >> This part: > > >>       ( not mycookie or mycookie.value != 'nikos' ) > > >> is false but this part: > > >>       re.search( r'(msn|yandex|13448|spider|crawl)', host )

Re: Problem checking an existing browser cookie

2010-08-30 Thread Nik the Greek
On 30 Αύγ, 19:21, Peter Otten <__pete...@web.de> wrote: > Nik the Greek wrote: > >> Perhpas its doenst get loaded like that? > > >> # initialize cookie > >> cookie = SimpleCookie() > >> cookie.load( os.environ.get('HTTP_COOKIE', '') ) > >> mycookie = cookie.get('visitor') > > > Please someone else

Re: Helper app for intranet site

2010-08-30 Thread kevinlcarlson
On Aug 29, 8:46 pm, Lawrence D'Oliveiro wrote: > In message > <45e0772c-24a8-4cbb-a4fc-74a1b6c25...@n19g2000prf.googlegroups.com>, > > kevinlcarlson wrote: > > I'm exploring the possibility of developing a helper app for an > > existing internal company website.  Basically, it would automatically

Re: Problem checking an existing browser cookie

2010-08-30 Thread Nik the Greek
On 30 Αύγ, 19:41, MRAB wrote: > On 30/08/2010 04:33, Nik the Greek wrote: > > > > > > > > > On 30 Αύγ, 06:12, MRAB  wrote: > > >> This part: > > >>       ( not mycookie or mycookie.value != 'nikos' ) > > >> is false but this part: > > >>       re.search( r'(msn|yandex|13448|spider|crawl)', host )

Re: shlex, unicode, and subprocess.Popen on Windows

2010-08-30 Thread Tim Golden
On 30/08/2010 3:24 PM, pyt...@bdurham.com wrote: My understanding is that the only time one needs to use shell=True is when they are 'executing' a non-executable file whose executable must be discovered via file association rules? Does that sound accurate? I'm not entirely sure what you mean by

Re: Problem checking an existing browser cookie

2010-08-30 Thread Rami Chowdhury
On Mon, Aug 30, 2010 at 23:36, Nik the Greek wrote: > # initialize cookie > cookie = SimpleCookie() > cookie.load( os.environ.get('HTTP_COOKIE', '') ) > visitor = cookie.get('visitor') > > This statement > > if (visitor.value != 'nikos') and re.search( r'(msn|yandex|13448| > spider|crawl)', host

Re: Problem checking an existing browser cookie

2010-08-30 Thread MRAB
On 30/08/2010 18:16, Nik the Greek wrote: On 30 Αύγ, 19:41, MRAB wrote: On 30/08/2010 04:33, Nik the Greek wrote: On 30 Αύγ, 06:12, MRABwrote: This part: ( not mycookie or mycookie.value != 'nikos' ) is false but this part: re.search( r'(msn|yandex|13448|sp

Re: Problem checking an existing browser cookie

2010-08-30 Thread MRAB
On 30/08/2010 18:36, Nik the Greek wrote: On 30 Αύγ, 19:41, MRAB wrote: On 30/08/2010 04:33, Nik the Greek wrote: On 30 Αύγ, 06:12, MRABwrote: This part: ( not mycookie or mycookie.value != 'nikos' ) is false but this part: re.search( r'(msn|yandex|13448|sp

Re: Problem checking an existing browser cookie

2010-08-30 Thread Nik the Greek
On 30 Αύγ, 20:53, MRAB wrote: > > Why visitor.value is undefined? > > Because visitor is None. It's not seeing any cookie. WHY NOT?! THE COOKIE _DOES_EXIST !!! What am i missing here?! -- http://mail.python.org/mailman/listinfo/python-list

Re: python 2.6.6 installation problems on osx

2010-08-30 Thread jal
I just did 'make install' because according to the osx section of the README: On a clean OSX /usr/local does not exist. Do a "sudo mkdir -m 775 /usr/local" before you do a make install. It is probably not a good idea to do "sudo make install" which installs everythi

Looking for Python and Python/Django workplaces in Chicago

2010-08-30 Thread Erik Reppen
I'm a really strong front end web dev with an interest in becoming more of a generalist web and app dev through Python. Anybody aware of studios/agencies that actually prefer Python in Chicago I could keep an eye on. -- http://mail.python.org/mailman/listinfo/python-list

Re: in place functions from operator module

2010-08-30 Thread Arnaud Delobelle
Raymond Hettinger writes: > On Aug 29, 8:33 am, Arnaud Delobelle wrote: >> ernest writes: >> > Hi, >> >> > The operator module provides separate functions for >> > "in place" operations, such as iadd(), isub(), etc. >> > However, it appears that these functions don't really >> > do the operatio

Re: python+sqlite3 in memory database

2010-08-30 Thread Benjamin Peterson
Denis Gomes gmail.com> writes: > > Eventually my goal is to dynamically load and unload sections of a file based database (could be tables or rows) in and out of memory for effeciency purposes. Have you actually found this to be an useful optimization? SQLite already internally caches database

Re: How to convert (unicode) text to image?

2010-08-30 Thread Terry Reedy
On 8/30/2010 7:14 AM, Paul Rubin wrote: example, tkinter has been part of the stdlib for at least a decade but is totally undocumented in the Python library manual. I have trouble equating 'totally undocumented' to about 400 lines + 200 for tix + 600 for ttk ;-). Yes, 400, while more than mos

Re: How to convert (unicode) text to image?

2010-08-30 Thread Nobody
On Mon, 30 Aug 2010 12:50:32 +0200, Thomas Jollans wrote: >> Face the facts dude. The Python docs have some major problems. >> They were pretty good when Python was a new, cool, project used >> by a handful of geeks. They are good relative to the "average" >> (whatever that is) open source proje

Re: How to convert (unicode) text to image?

2010-08-30 Thread Terry Reedy
On 8/30/2010 12:23 AM, ru...@yahoo.com wrote: The Python docs have some major problems. And I have no idea what you think they are. I have participated in 71 doc improvement issues on the tracker. Most of those I either initiated or provided suggestions. How many have you helped with? -- T

Re: shlex, unicode, and subprocess.Popen on Windows

2010-08-30 Thread Nobody
On Mon, 30 Aug 2010 10:24:26 -0400, python wrote: >> Kudos for avoiding shell=True > > My understanding is that the only time one needs to use shell=True is > when they are 'executing' a non-executable file whose executable must be > discovered via file association rules? Does that sound accurate

Re: python+sqlite3 in memory database

2010-08-30 Thread Denis Gomes
Hey Benjamin, Take a look at this website I found about cached and in-memory databases. I think the gist of the article is that caching is good if you are doing SELECTs on data that is frequently used whereas in-memory speeds up writes, (inserts and updates) to the db as well as querying. Maybe I

triangle python user's group?

2010-08-30 Thread Tim Arnold
Hi, Is there a python users group in the Research Triangle Park area (North Carolina, USA)? If there is not one and you're in the area and would be interested, please send an email to jtim.arnold at gmail.com and I'll organize a get-together to get one started. I'll try to find a locale convenien

Re: python+sqlite3 in memory database

2010-08-30 Thread Benjamin Peterson
Denis Gomes gmail.com> writes: > > > Hey Benjamin, >   >  Take a look at this website I found about cached and in-memory databases.  I think the gist of the article is that caching is good if you are doing SELECTs on data that is frequently used whereas in-memory speeds up writes, (inserts and

Re: triangle python user's group?

2010-08-30 Thread Albert Hopkins
On Mon, 2010-08-30 at 12:38 -0700, Tim Arnold wrote: > Hi, > Is there a python users group in the Research Triangle Park area > (North Carolina, USA)? Google "triangle python user's group" -- http://mail.python.org/mailman/listinfo/python-list

Re: bug? pkgutil.walk_packages returns packages that result in an ImportError

2010-08-30 Thread Peter Otten
Chris Withers wrote: > Peter Otten wrote: >>> My expectation of this is that if onerrors is left as None, names >>> yielded will be importable. >> >> I would infer no such promise, especially as the generator also yields >> modules, and no attempt at all is made to import those. > > Really? Ye

Re: String substitution VS proper mysql escaping

2010-08-30 Thread John Nagle
On 8/30/2010 1:11 AM, Gregory Ewing wrote: Nik the Greek wrote: Yes i will i just asked to know if i were to substitute what might be the problem so to understand why i need the quoting. Because if you use % to build a query string, the result must be syntactically valid SQL. The values that

Re: python+sqlite3 in memory database

2010-08-30 Thread Denis Gomes
Yep, I see what you are saying. I am going to do a bit more research to see how sqlite3 works internally, ie. cache size, page size, etc, and then decide if I will need to mess with in-memory databases. Thanks for your insight, appreciate it. Denis On Mon, Aug 30, 2010 at 3:51 PM, Benjamin Pete

Re: python+sqlite3 in memory database

2010-08-30 Thread John Nagle
On 8/30/2010 12:00 PM, Benjamin Peterson wrote: Denis Gomes gmail.com> writes: Eventually my goal is to dynamically load and unload sections of a file based database (could be tables or rows) in and out of memory for effeciency purposes. Have you actually found this to be an useful optimiz

Re: python+sqlite3 in memory database

2010-08-30 Thread Benjamin Peterson
John Nagle animats.com> writes: > "sqlite" has reasonably good SELECT performance on simple indices, > but anything beyond that isn't all that great. Multiple processes > updating the same sqlite database will have terrible performance, > because the locking mechanism not only locks the entir

Re: Helper app for intranet site

2010-08-30 Thread Lawrence D'Oliveiro
In message <61894f54-90ff-4e0e-9c81-860b6e9cd...@p12g2000prn.googlegroups.com>, kevinlcarlson wrote: > On Aug 29, 8:46 pm, Lawrence D'Oliveiro > wrote: >> >> In message >> <45e0772c-24a8-4cbb-a4fc-74a1b6c25...@n19g2000prf.googlegroups.com>, >> kevinlcarlson wrote: >>> >>> I'm exploring the poss

Re: Queue cleanup

2010-08-30 Thread Lawrence D'Oliveiro
In message <7xr5hguzzi@ruckus.brouhaha.com>, Paul Rubin wrote: > JHC (experimental Haskell compiler) recently started using a mixture of > gc and region inference. It will be interesting to see how that works > out. That’s what people have been saying about garbage collection for about half

Re: Performance: sets vs dicts.

2010-08-30 Thread Aahz
In article <878w3ogpvq@benfinney.id.au>, Ben Finney wrote: >a...@pythoncraft.com (Aahz) writes: >> >> That reminds me: one co-worker (who really should have known better ;-) >> had the impression that sets were O(N) rather than O(1). > >For settling exactly this kind of confusion, Python's st

Functions continuing to ru after returning something?

2010-08-30 Thread Bradley Hintze
I may be having a brain fart, but is it at all possible to have a function first return a value then continue its calculation. Like this simple example: my_var = 5 def my_function(): return my_var my_var +=1 This obviously won't work as written but is there a cleaver way around this. --

Re: Functions continuing to ru after returning something?

2010-08-30 Thread MRAB
On 31/08/2010 01:05, Bradley Hintze wrote: I may be having a brain fart, but is it at all possible to have a function first return a value then continue its calculation. Like this simple example: my_var = 5 def my_function(): return my_var my_var +=1 This obviously won't work as writt

Re: Queue cleanup

2010-08-30 Thread Paul Rubin
Lawrence D'Oliveiro writes: > Meanwhile, real-world programmers get on to writing real-world code that is > productive and efficient on real-world systems. It's pretty well established by now that GC doesn't have any significant speed penalty compared with manual allocation. It does consume mor

Re: Performance: sets vs dicts.

2010-08-30 Thread Paul Rubin
a...@pythoncraft.com (Aahz) writes: > Possibly; IMO, people should not need to run timeit to determine basic > algorithmic speed for standard Python datatypes. Indeed. Alex Stepanov (designer of C++ Standard Template Library) was emphatic that algorithm complexity assertions should be part of the

Structured programming with optionParser

2010-08-30 Thread NickC
I'm writing a short (200 lines) script that has half-a-dozen parameter options, and using optionParser to process the options. I try to write well-written procedural programmes with functions doing one thing well, and so on. The problem I'm getting is that, inevitably, the function that uses Opt

Installing Python as Scripting Language in IIS

2010-08-30 Thread naugiedoggie
Hello, Windows 2003, 64-bit, standard edition server with IIS 6.0. I followed the MS instruction sheets on setting up CGI application with Python as scripting engine. I'm just getting 404 for the test script, whereas an html file in the same virtual directory is properly displayed. Here: Creat

Source code for itertools

2010-08-30 Thread vsoler
I'm interested in studying the itertools source code, especially the permutations function. However, I cannot find the library. Where could I find it? Running Python 3.1 Thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: Source code for itertools

2010-08-30 Thread Lawrence D'Oliveiro
In message <9aa266f0-be9b-4c9a-bfbd-6cdfc86ad...@t20g2000yqa.googlegroups.com>, vsoler wrote: > I'm interested in studying the itertools source code, especially the > permutations function. > > However, I cannot find the library. Where could I find it? l...@theon:python> apt-get source python3.

Re: Source code for itertools

2010-08-30 Thread Shashwat Anand
On Tue, Aug 31, 2010 at 7:30 AM, vsoler wrote: > I'm interested in studying the itertools source code, especially the > permutations function. > > However, I cannot find the library. Where could I find it? > > Running Python 3.1 > > Thank you > Either you can download it or browse it on the net.

Re: Source code for itertools

2010-08-30 Thread vsoler
On 31 ago, 04:14, Lawrence D'Oliveiro wrote: > In message > <9aa266f0-be9b-4c9a-bfbd-6cdfc86ad...@t20g2000yqa.googlegroups.com>, vsoler > wrote: > > > I'm interested in studying the itertools source code, especially the > > permutations function. > > > However, I cannot find the library. Where c

Re: Source code for itertools

2010-08-30 Thread Paul Rubin
vsoler writes: > I was expecting an itertools.py file, but I don't see it in your list. >> ./python3.1-3.1.2+20100829/Modules/itertoolsmodule.c looks promising. Lots of stdlib modules are written in C for speed or access to system facilities. -- http://mail.python.org/mailman/listinfo/python-l

Re: Source code for itertools

2010-08-30 Thread vsoler
On 31 ago, 04:42, Paul Rubin wrote: > vsoler writes: > > I was expecting an itertools.py file, but I don't see it in your list. > >> ./python3.1-3.1.2+20100829/Modules/itertoolsmodule.c > > looks promising.  Lots of stdlib modules are written in C for speed or > access to system facilities. Lawr

Re: Structured programming with optionParser

2010-08-30 Thread Michele Simionato
On Aug 31, 3:45 am, NickC wrote: > I'm struggling to see how you could refactor the option parsing function. > After all, it has to process the options, so it has to do all the setup > for those options, and then process them. Perhaps plac could simplify your life, by removing most of the boilerp

Re: Source code for itertools

2010-08-30 Thread Rolando Espinoza La Fuente
On Mon, Aug 30, 2010 at 11:06 PM, vsoler wrote: > On 31 ago, 04:42, Paul Rubin wrote: >> vsoler writes: >> > I was expecting an itertools.py file, but I don't see it in your list. >> >> ./python3.1-3.1.2+20100829/Modules/itertoolsmodule.c >> >> looks promising.  Lots of stdlib modules are writte

Re: Functions continuing to ru after returning something?

2010-08-30 Thread Aidan
Bradley Hintze wrote: I may be having a brain fart, but is it at all possible to have a function first return a value then continue its calculation. Like this simple example: my_var = 5 def my_function(): return my_var my_var +=1 This obviously won't work as written but is there a cleav

Re: Source code for itertools

2010-08-30 Thread Brian Curtin
On Mon, Aug 30, 2010 at 22:06, vsoler wrote: > On 31 ago, 04:42, Paul Rubin wrote: > > vsoler writes: > > > I was expecting an itertools.py file, but I don't see it in your list. > > >> ./python3.1-3.1.2+20100829/Modules/itertoolsmodule.c > > > > looks promising. Lots of stdlib modules are wri

Re: Source code for itertools

2010-08-30 Thread Terry Reedy
On 8/30/2010 10:27 PM, vsoler wrote: I was expecting an itertools.py file, but I don't see it in your list. The manual page has the original python source for each function. I recommend you look at that. Itertool was rewritten in C for speed but the C source will not tell you any more about t

  1   2   >