[SQL] Pick random rows from SELECT?

2009-09-21 Thread Threader Slash
Here is a simple and quick solution -- Generate a random number "random.shuffle(x[, random])¶Shuffle the sequence x in place. The optional argument random is a 0-argument function returning a random float in [0.0, 1.0); by default, this is the function random()." http://docs.python.org/library/ran

Re: easy question, how to double a variable

2009-09-21 Thread Processor-Dev1l
On Sep 20, 10:27 pm, daggerdvm wrote: >  Write the definition of a function  twice , that receives an  int > parameter and returns an  int that is twice the value of the > parameter. > > how can i do this I will stop this theatre... as you should know, you want your function to make arithmetic op

Solved - Python: automate input to MySQL query

2009-09-21 Thread Threader Slash
-- Forwarded message -- > From: Philip Semanchuk > To: "Python-list (General)" > Date: Mon, 21 Sep 2009 08:49:27 -0400 > Subject: Re: Python: automate input to MySQL query > > On Sep 21, 2009, at 5:18 AM, Threader Slash wrote: > > Hi Everybody... >> >> I have a query that works a

Re: easy question, how to double a variable

2009-09-21 Thread Tim Roberts
daggerdvm wrote: > >carl banks.you are a dork What are you, eleven years old? Look, you asked us to answer for you what is CLEARLY a homework question. It is unethical for you to ask that, and it is unethical for us to answer it. As others have said, show us what you TRIED, and we can h

Re: Tkinter - Text - bullets

2009-09-21 Thread Thomas Lehmann
> This is probably why you had all these alignment problems. But it's > weird, because the script I posted is copied and pasted from a really > script that I've run, and which doesn't cause any error. What is the > version of tcl/tk used by your Tkinter module? And what is your Python > version? U

Re: Non-deprecated equivalent of rfc822.AddressList

2009-09-21 Thread Cameron Simpson
On 21Sep2009 10:49, Jason Tackaberry wrote: | On Wed, 2009-09-16 at 14:49 -0400, Jason Tackaberry wrote: | > Since the rfc822 module was removed in Python 3, and is deprecated in | > 2.3, I am obviously trying to avoid using it. | > | > But I'm having a hard time finding an equivalent to rfc822.A

Re: Finding application data after install - a solution?

2009-09-21 Thread Wolodja Wentland
On Mon, Sep 21, 2009 at 23:52 -0300, Gabriel Genellina wrote: > En Sat, 19 Sep 2009 12:03:52 -0300, Wolodja Wentland > escribió: > > >reliably finding distribution data from your program seems to be an > >unsolved issue for programs packaged with distutils. [...] > Isn't pkgutil.get_data() what

Re: Comparison of parsers in python?

2009-09-21 Thread greg
Nobody wrote: What I want: a tokeniser generator which can take a lex-style grammar (not necessarily lex syntax, but a set of token specifications defined by REs, BNF, or whatever), generate a DFA, then run the DFA on sequences of bytes. It must allow the syntax to be defined at run-time. You

Re: on package import, have it conditionally import a subpackage

2009-09-21 Thread Gabriel Genellina
En Sat, 19 Sep 2009 17:06:11 -0300, Gabriel Rossetti escribió: Hello everyone, I'd like to ba able to import a package and have it's __init__ conditionally import a subpackage. Suppose that you have this structure : mybase/ mybase/__init__.py mybase/mypkg mybase/mypkg/__init__.py mybase/

Re: easy question, how to double a variable

2009-09-21 Thread Grant Edwards
On 2009-09-21, David C Ullrich wrote: > On Sun, 20 Sep 2009 13:27:07 -0700, daggerdvm wrote: > >> Write the definition of a function twice , that receives an int >> parameter and returns an int that is twice the value of the parameter. >> >> how can i do this > > I don't think this can be done

Re: Non-deprecated equivalent of rfc822.AddressList

2009-09-21 Thread Gabriel Genellina
En Mon, 21 Sep 2009 11:49:15 -0300, Jason Tackaberry escribió: On Wed, 2009-09-16 at 14:49 -0400, Jason Tackaberry wrote: Since the rfc822 module was removed in Python 3, and is deprecated in 2.3, I am obviously trying to avoid using it. But I'm having a hard time finding an equivalent to r

where is ctrl+newline handled in pywin editor?

2009-09-21 Thread C or L Smith
I use the pywin environment on Windows for python code editing and interactive environment. I've been able to find the place in the editor files where the enter key is handled and where the whitespace is stripped from a line and I've been able to get it to not leave any white space when a doub

Re: Finding application data after install - a solution?

2009-09-21 Thread Gabriel Genellina
En Sat, 19 Sep 2009 12:03:52 -0300, Wolodja Wentland escribió: reliably finding distribution data from your program seems to be an unsolved issue for programs packaged with distutils. I have seen a lot of code that manipulates mod.__file__ to solve this problem, but this *will* break for som

Re: easy question, how to double a variable

2009-09-21 Thread Tim Chase
But you actually want to return twice the value. I don't see how to do that. Ah, I think I see...returning more than once is done with the "yield" keyword: def f(param): yield param yield param That returns twice the integer parameter... :-D However, the OP was instructed to "Wri

Re: using python 2.5

2009-09-21 Thread Sean DiZazzo
On Sep 21, 4:42 pm, "kunal.k" wrote: > I have installed python 2.5 for a particular code. Now i have 2.6 > already installed. How do i direct this code to use the 2.5 modules?? I don't think you do. You should install the modules for python 2.6. You could try to hand copy the modules, and some m

Re: easy question, how to double a variable

2009-09-21 Thread Steven D'Aprano
On Mon, 21 Sep 2009 13:50:23 -0500, David C Ullrich wrote: > But you actually want to return twice the value. I don't see how to do > that. What? Seriously? You're not just yanking the OP's chain??? -- Steven who normally does quite well detecting sarcasm in writing -- http://mail.python.org

Re: OK to memoize re objects?

2009-09-21 Thread Steven D'Aprano
On Mon, 21 Sep 2009 13:33:05 +, kj wrote: > I find the docs are pretty confusing on this point. They first make the > point of noting that pre-compiling regular expressions is more > efficient, and then *immediately* shoot down this point by saying that > one need not worry about pre-compilin

Re: How to change string or number passed as argument?

2009-09-21 Thread Gabriel Genellina
En Sat, 19 Sep 2009 22:59:21 -0300, Peng Yu escribió: I know that strings or numbers are immutable when they passed as arguments to functions. But there are cases that I may want to change them in a function and propagate the effects outside the function. I could wrap them in a class, which I f

expy 0.2 released!

2009-09-21 Thread Yingjie Lan
Hi, This is to announce the release of expy 0.2. What's new? 1. fixed the 'const char*' bug. 2. introduced the 'raw_type'. What is expy? -- expy is an expressway to extend Python! For more details, visit http://expy.sf.net/ Have a nice one! Yingjie --

Re: An assessment of the Unicode standard

2009-09-21 Thread Emile van Sebille
On 9/19/2009 11:33 PM Greg Ewing said... It's possible that some individuals do this more frequently than others, e.g. mathematicians and other people who are in the habit of exploring new ideas may be less influenced by the constraints of language than the general population. As I recall Shak

using python 2.5

2009-09-21 Thread kunal.k
I have installed python 2.5 for a particular code. Now i have 2.6 already installed. How do i direct this code to use the 2.5 modules?? -- http://mail.python.org/mailman/listinfo/python-list

Re: An assessment of the Unicode standard

2009-09-21 Thread Gabriel Genellina
En Sun, 20 Sep 2009 03:33:47 -0300, Greg Ewing escribió: Hendrik van Rooyen wrote: In any case, it doesn't affect my point, which was that I was thinking about something that I didn't have a word, or even a convenient phrase for. That is probably true, but on the other hand, it is not totally

Re: easy question, how to double a variable

2009-09-21 Thread Sean DiZazzo
On Sep 21, 1:46 pm, daggerdvm wrote: > u don't want to answerthen why post?...get lost. I eat children... -- http://mail.python.org/mailman/listinfo/python-list

Re: socket send O(N**2) complexity

2009-09-21 Thread Zac Burns
On Mon, Sep 21, 2009 at 2:10 PM, Rob Williscroft wrote: >  wrote in news:mailman.216.1253565002.2807.python-l...@python.org in > comp.lang.python: > >>>Niether of the CPython versions (2.5 and 3.0 (with modified code)) >>>exibited any memory increase between "allocated 1 meg + " and "end" >> >> Yo

Re: easy question, how to double a variable

2009-09-21 Thread Ethan Furman
daggerdvm wrote: u don't want to answerthen why post?...get lost. On the contrary! We *do* want to answer. Prizes are awarded based on the most outlandish yet correct answer, on the most literal answer, and on the funniest answer! Ridiculous questions like yours are what m

Re: specify max width to reportlab.canvas.drawString

2009-09-21 Thread juanefren
On Sep 18, 3:20 am, Robin Becker wrote: > juanefren wrote: > > I am usingreportlabto create pdf documents, everything looks fine, > > how ever, is there a way to specify a max width to drawString > > function ? I mean cut the sentence and continue a step down... > > > Cheers > > You'll get bet

Re: socket send O(N**2) complexity

2009-09-21 Thread Rob Williscroft
wrote in news:mailman.216.1253565002.2807.python-l...@python.org in comp.lang.python: >>Niether of the CPython versions (2.5 and 3.0 (with modified code)) >>exibited any memory increase between "allocated 1 meg + " and "end" > > You bumped into a special case that CPython optimizes. s[:] is s.

Re: Plotting wav file

2009-09-21 Thread Rami Chowdhury
On Mon, 21 Sep 2009 12:53:44 -0700, Maggie wrote: I am by far more acquainted with R and generally would use it in this case, however, this particular experiment does require a lot of AFNI work, therefore I am a bit lost. the .wav was generated via -- waver -WAV -TR 2.5 -tstim `cat a_STD_W.1D`

Re: easy question, how to double a variable

2009-09-21 Thread daggerdvm
carl banks.you are a dork -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question, how to double a variable

2009-09-21 Thread daggerdvm
u don't want to answerthen why post?...get lost. -- http://mail.python.org/mailman/listinfo/python-list

Re: socket send O(N**2) complexity

2009-09-21 Thread Jack Diederich
On Mon, Sep 21, 2009 at 4:00 PM, Rob Williscroft wrote: > AIUI, as a python string is imutable, a slice of a string is a > new string which points (C char *) to the start of the slice data > and with a length that is the length of the slice, about 8 bytes > on 32 bit machine. Not in CPython. Whi

Re: socket send O(N**2) complexity

2009-09-21 Thread exarkun
On 08:00 pm, r...@freenet.co.uk wrote: Zac Burns wrote in news:mailman.211.1253559803.2807.python- l...@python.org in comp.lang.python: The mysocket.mysend method given at http://docs.python.org/howto/sockets.html has an (unwitting?) O(N**2) complexity for long msg due to the string slicing. I

Re: Plotting wav file

2009-09-21 Thread Rami Chowdhury
On Mon, Sep 21, 2009 at 4:11 PM, Rami Chowdhury wrote: On Mon, 21 Sep 2009 12:53:44 -0700, Maggie wrote: I am by far more acquainted with R and generally would use it in this case, however, this particular experiment does require a lot of AFNI work, therefore I am a bit lost. the .wav was gen

Re: socket send O(N**2) complexity

2009-09-21 Thread Rob Williscroft
Zac Burns wrote in news:mailman.211.1253559803.2807.python-l...@python.org in comp.lang.python: > The mysocket.mysend method given at > http://docs.python.org/howto/sockets.html has an (unwitting?) O(N**2) > complexity for long msg due to the string slicing. > > I've been looking for a way to op

Re: socket send O(N**2) complexity

2009-09-21 Thread Mike
On Sep 21, 2:03 pm, Zac Burns wrote: > The mysocket.mysend method given > athttp://docs.python.org/howto/sockets.htmlhas an (unwitting?) O(N**2) > complexity for long msg due to the string slicing. > > I've been looking for a way to optimize this, but aside from a pure > python 'string slice view

Re: Plotting wav file

2009-09-21 Thread Rami Chowdhury
On Mon, 21 Sep 2009 12:13:30 -0700, Maggie wrote: On Sep 21, 3:07 pm, "Rami Chowdhury" wrote: On Mon, 21 Sep 2009 11:58:30 -0700, Maggie wrote: > What would be the best way to plot a small .wav file in python? If > there are any tutorials or sample code, I would really appreciate it! I'm so

Re: OK to memoize re objects?

2009-09-21 Thread Ethan Furman
Nobody wrote: On Mon, 21 Sep 2009 07:11:36 -0700, Ethan Furman wrote: Looking in the code for re in 2.5: _MAXCACHE = 100 On the other hand, I (a re novice, to be sure) have only used between two to five in any one program... it'll be a while before I hit _MAXCACHE! Do you know how m

Re: Plotting wav file

2009-09-21 Thread Maggie
On Sep 21, 3:07 pm, "Rami Chowdhury" wrote: > On Mon, 21 Sep 2009 11:58:30 -0700, Maggie wrote: > > What would be the best way to plot a small .wav file in python? If > > there are any tutorials or sample code, I would really appreciate it! > > I'm sorry, what are you hoping to plot about the .wa

Re: Plotting wav file

2009-09-21 Thread Rami Chowdhury
On Mon, 21 Sep 2009 11:58:30 -0700, Maggie wrote: What would be the best way to plot a small .wav file in python? If there are any tutorials or sample code, I would really appreciate it! I'm sorry, what are you hoping to plot about the .wav file? -- Rami Chowdhury "Never attribute to malice

socket send O(N**2) complexity

2009-09-21 Thread Zac Burns
The mysocket.mysend method given at http://docs.python.org/howto/sockets.html has an (unwitting?) O(N**2) complexity for long msg due to the string slicing. I've been looking for a way to optimize this, but aside from a pure python 'string slice view' that looks at the original string I can't thin

Plotting wav file

2009-09-21 Thread Maggie
What would be the best way to plot a small .wav file in python? If there are any tutorials or sample code, I would really appreciate it! -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question, how to double a variable

2009-09-21 Thread David C Ullrich
On Sun, 20 Sep 2009 13:27:07 -0700, daggerdvm wrote: > Write the definition of a function twice , that receives an int > parameter and returns an int that is twice the value of the parameter. > > how can i do this I don't think this can be done in Python. Looking at the Subject line I though

Re: entry widget won't validate

2009-09-21 Thread Mike
On Sep 21, 12:47 pm, Peter Otten <__pete...@web.de> wrote: > Mike wrote: > > I'm trying to arrange for an Entry widget to check whether its data > > is all digits and whether the number represented is small enough. > > The validate function seem to be called once at startup and not > > afterwards:

Re: entry widget won't validate

2009-09-21 Thread Peter Otten
Mike wrote: > I'm trying to arrange for an Entry widget to check whether its data > is all digits and whether the number represented is small enough. > The validate function seem to be called once at startup and not > afterwards: > > import sys, Tkinter, tkFileDialog, tkMessageBox > > tk=Tkinter

entry widget won't validate

2009-09-21 Thread Mike
I'm trying to arrange for an Entry widget to check whether its data is all digits and whether the number represented is small enough. The validate function seem to be called once at startup and not afterwards: import sys, Tkinter, tkFileDialog, tkMessageBox tk=Tkinter tkfd=tkFileDialog ... class

Re: Non-deprecated equivalent of rfc822.AddressList

2009-09-21 Thread Aahz
In article , Jason Tackaberry wrote: >On Wed, 2009-09-16 at 14:49 -0400, Jason Tackaberry wrote: >> Since the rfc822 module was removed in Python 3, and is deprecated in >> 2.3, I am obviously trying to avoid using it. >> >> But I'm having a hard time finding an equivalent to rfc822.AddressList

Re: passing object between classes

2009-09-21 Thread Jean-Michel Pichavant
daved170 wrote: On Sep 21, 1:44 pm, Duncan Booth wrote: daved170 wrote: Hi everybody, I built my owen log obj as a class. I'm passing it to another object (actually to a thread). When I run my app it raise error at the line when I'm using that log obj. is there any problem with the co

Re: recommendation for webapp testing?

2009-09-21 Thread Aahz
In article <2053e5e2-763e-44fb-854e-c17204518...@z34g2000vbl.googlegroups.com>, Schif Schaf wrote: > >I need to do some basic website testing (log into account, add item to >cart, fill out and submit forms, check out, etc.). What modules would >be good to use for webapp testing like this? Windmi

Re: OK to memoize re objects?

2009-09-21 Thread Nobody
On Mon, 21 Sep 2009 07:11:36 -0700, Ethan Furman wrote: > Looking in the code for re in 2.5: > _MAXCACHE = 100 > On the other hand, I (a > re novice, to be sure) have only used between two to five in any one > program... it'll be a while before I hit _MAXCACHE! Do you know how many REs import-e

Re: Comparison of parsers in python?

2009-09-21 Thread Nobody
On Sat, 19 Sep 2009 13:21:58 -0700, Peng Yu wrote: > I did a google search and found various parser in python that can be > used to parse different files in various situation. I don't see a page > that summarizes and compares all the available parsers in python, from > simple and easy-to-use ones

Re: Granularity of OSError

2009-09-21 Thread kj
In MRAB writes: >kj wrote: >> In MRAB >> writes: >> >>> If, for example, you're >>> going to copy a file, it's a good idea to check beforehand that there's >>> enough space available for the copy. >> >> How do you do that? >> >There's os.statvfs(...), although that's Unix only. Thanks!

Re: Non-deprecated equivalent of rfc822.AddressList

2009-09-21 Thread Jason Tackaberry
On Wed, 2009-09-16 at 14:49 -0400, Jason Tackaberry wrote: > Since the rfc822 module was removed in Python 3, and is deprecated in > 2.3, I am obviously trying to avoid using it. > > But I'm having a hard time finding an equivalent to rfc822.AddressList > in the email module, which I want to use t

Re: OK to memoize re objects?

2009-09-21 Thread Ethan Furman
kj wrote: In Robert Kern writes: kj wrote: My Python code is filled with assignments of regexp objects to globals variables at the top level; e.g.: _spam_re = re.compile('^(?:ham|eggs)$', re.I) Don't like it. My Perl-pickled brain wishes that re.compile was a memoizing method, so that

Re: passing object between classes

2009-09-21 Thread daved170
On Sep 21, 1:44 pm, Duncan Booth wrote: > daved170 wrote: > > Hi everybody, > > I built my owen log obj as a class. > > I'm passing it to another object (actually to a thread). > > When I run my app it raise error at the line when I'm using that log > > obj. is there any problem with the concept

Re: OK to memoize re objects?

2009-09-21 Thread kj
In Robert Kern writes: >kj wrote: >> >> My Python code is filled with assignments of regexp objects to >> globals variables at the top level; e.g.: >> >> _spam_re = re.compile('^(?:ham|eggs)$', re.I) >> >> Don't like it. My Perl-pickled brain wishes that re.compile was >> a memoizing method

Re: Compile kinterbasdb with mingw32 and python 2.6 - DLL load failed

2009-09-21 Thread Laszlo Nagy
Christian Heimes írta: Laszlo Nagy wrote: The building and installation went find. But I cannot "import kinterbasdb" because I get a "DLL load failed" error. I figured out that has something to do with msvcr90 and "_ftime". Can you please give me some advice how to solve this problem?

Re: Python: automate input to MySQL query

2009-09-21 Thread Philip Semanchuk
On Sep 21, 2009, at 5:18 AM, Threader Slash wrote: Hi Everybody... I have a query that works as follows: Code: db.query("""SELECT traveler.travelerFirstName,vaccine.vaccineName from (traveler INNER JOIN takenvaccine ON traveler.travelerID = takenvaccine.travelerID) INNER JOIN vaccine

Re: raise errors

2009-09-21 Thread Benjamin Kaplan
On Mon, Sep 21, 2009 at 5:17 AM, daved170 wrote: > Hi everybody, > I need help with exceptions raising. > My goal is to print at the outer functions all the errors including > the most inner one. > > For example: > > def foo1(self): >   try: >        foo2() >   except ? : >         print "outer Er

Re: passing object between classes

2009-09-21 Thread Duncan Booth
daved170 wrote: > Hi everybody, > I built my owen log obj as a class. > I'm passing it to another object (actually to a thread). > When I run my app it raise error at the line when I'm using that log > obj. is there any problem with the concept of passing object as I do > it? > How can I do that?

Re: [ANN] Athens Python User Group - Meeting September 9, 2009, 19:00.

2009-09-21 Thread Orestis Markou
Blogged about the results of the meeting here: http://orestis.gr/blog/2009/09/21/athens-python-ug-1st-meeting-results/ Also announcing a dedicated maling list: http://mail.python.org/mailman/listinfo/pyathens Orestis On 04 Σεπ 2009, at 7:42 μ.μ., Orestis Markou wrote: == Announcing the 1st

passing object between classes

2009-09-21 Thread daved170
Hi everybody, I built my owen log obj as a class. I'm passing it to another object (actually to a thread). When I run my app it raise error at the line when I'm using that log obj. is there any problem with the concept of passing object as I do it? How can I do that? class A: def foo1: myLog =

Re: Compile kinterbasdb with mingw32 and python 2.6 - DLL load failed

2009-09-21 Thread Christian Heimes
Laszlo Nagy wrote: > The building and installation went find. But I cannot "import > kinterbasdb" because I get a "DLL load failed" error. I figured out that > has something to do with msvcr90 and "_ftime". Can you please give me > some advice how to solve this problem? I know from experience t

Re: [SQL] Pick random rows from SELECT?

2009-09-21 Thread Peter Otten
Gilles Ganault wrote: > I have a working Python script that SELECTs rows from a database to > fetch a company's name from a web-based database. > > Since this list is quite big and the site is the bottleneck, I'd like > to run multiple instances of this script, and figured a solution would > be t

Re: raise errors

2009-09-21 Thread Peter Otten
daved170 wrote: > I need help with exceptions raising. > My goal is to print at the outer functions all the errors including > the most inner one. > > For example: > > def foo1(self): >try: > foo2() >except ? : > print "outer Err at foo1" + ?? > > def foo2(self): >t

Re: Is there a concerted effort afoot to improve the Python Wiki?

2009-09-21 Thread Paul Boddie
On 21 Sep, 02:52, s...@pobox.com wrote: > I've noticed over the past few weeks a huge increase in the frequency of > edits in the Python wiki.  Many of those are due to Carl Trachte's work on > non-English pages about Python.  There are plenty of other pages going under > the knife as well though.

Re: raise errors

2009-09-21 Thread Ulrich Eckhardt
daved170 wrote: > I need help with exceptions raising. > My goal is to print at the outer functions all the errors including > the most inner one. > > For example: > > def foo1(self): >try: > foo2() >except ? : > print "outer Err at foo1" + ?? > > def foo2(self): >tr

Re: I look for proxy cache like apt-proxy (for Debian Package) but for python eggs package…

2009-09-21 Thread KLEIN Stéphane
Le Sun, 20 Sep 2009 18:33:10 +0200, Klein Stéphane a écrit : > Hi, > > I look for a tools to do proxy cache like apt-proxy (for Debian Package) > but for python eggs package. > > Can a easy-install option perform this feature ? I found somethings to do that : http://pypi.python.org/pypi/collec

raise errors

2009-09-21 Thread daved170
Hi everybody, I need help with exceptions raising. My goal is to print at the outer functions all the errors including the most inner one. For example: def foo1(self): try: foo2() except ? : print "outer Err at foo1" + ?? def foo2(self): try: error occured ex

Python: automate input to MySQL query

2009-09-21 Thread Threader Slash
Hi Everybody... I have a query that works as follows: Code: db.query("""SELECT traveler.travelerFirstName,vaccine.vaccineName from (traveler INNER JOIN takenvaccine ON traveler.travelerID = takenvaccine.travelerID) INNER JOIN vaccine ON takenvaccine.vaccineID=vaccine.vaccineID I

Compile kinterbasdb with mingw32 and python 2.6 - DLL load failed

2009-09-21 Thread Threader Slash
I have spent two week working with MinGW. The conclusion I came after a lot of headaches and making the project getting late is: MinGW doesn't work properly on MS Windows -- there are many conflicting variables and functions with similar names on MinGW libs and MS Libs, e.g. windows.h, etc, etc. My

Re: easy question, how to double a variable

2009-09-21 Thread Tim Chase
Steven D'Aprano wrote: Write the definition of a function twice , that receives an int parameter and returns an int that is twice the value of the parameter. how can i do this Yes, that certainly is an easy question. Here's my solution: class MultiplierFactory(object): [snip a marvel of

[SQL] Pick random rows from SELECT?

2009-09-21 Thread Gilles Ganault
Hello I have a working Python script that SELECTs rows from a database to fetch a company's name from a web-based database. Since this list is quite big and the site is the bottleneck, I'd like to run multiple instances of this script, and figured a solution would be to pick rows at rando

Re: List comprehension vs generator expression memory allocation

2009-09-21 Thread candide
Duncan Booth a écrit : > Why are you slicing the result of range? Why not just pass appropriate > arguments to range or xrange directly? > Why ? Guilty ignorance ;) > def f(a,b,m): > return xrange((a+m-1)//m*m, b, m) > Nice code, furthermore giving the best execution time, thanks. --

Re: An assessment of the Unicode standard

2009-09-21 Thread Mel
Dennis Lee Bieber wrote: > A one-eyed, one-horned, flying purple people eater? > > {Which brings up the confusing question... Is the eater purple, or does > it eat purple people (which is why it is so rare... it only eats people > caught in the last stages of suffocation )} Since we're spending

Pythons in Florida (training next month)

2009-09-21 Thread Mark Lutz
Don't miss your chance to attend our first Florida Python training session next month. This 3-day class is being held October 20-22, in Sarasota, Florida. It is open to both individual and group enrollments. For more details on the class, as well as registration instructions, please visit the cla

Re: Am I doing this wrong? Why does this seem so clumsy (time, datetime vs. DateTime)

2009-09-21 Thread Ben Morrow
[This is not a Perl question. F'ups set to c.l.python.] Quoth Schif Schaf : > The other day I needed to convert a date like "August 2009" into a > "seconds-since-epoch" value (this would be for the first day of that > month, at the first second of that day). Note that this is not unique: you need

Re: testing code in python source package

2009-09-21 Thread Ben Finney
Peng Yu writes: > I'm wondering if the development of python is test driven. If it is, > where in the Python-2.6.2 source directory is the test code for the > modules in ./Lib? A great majority of your many questions in this forum are already answered in the available documentation online. You s

Re: List comprehension vs generator expression memory allocation

2009-09-21 Thread Duncan Booth
candide wrote: > Each of the following two functions mult1() and mult2() solves the > question : > > > # - > def mult1(a,b,m): > return (x for x in range(a,b)[(m-a%m)%m:b:m]) > > def mult2(a,b,m): > return range(a,b)[(m-a%m)%m:b:m] > # --

Re: Substitute for KConfig in Qt4

2009-09-21 Thread nusch
On Sep 19, 3:53 am, David Boddie wrote: > On Thursday 17 September 2009 13:04, nusch wrote: > > > I want to remove pyKDE dependencies from my app to make it pure PyQt. > > What will be the best substitute for KConfig? > > What exactly do you use KConfig for in your application? > > David e.g stor

Re:OT - people eaters - was: An assessment of the Unicode standard

2009-09-21 Thread Cousin Stanley
> On Friday 18 September 2009 06:39:57 Dennis Lee Bieber wrote: > >> A one-eyed, one-horned, flying purple people eater? >> >> {Which brings up the confusing question... Is the eater purple, or does >> it eat purple people (which is why it is so rare... it only eats people >> caught in the l

SQLObject 0.11.1

2009-09-21 Thread Oleg Broytmann
Hello! I'm pleased to announce version 0.11.1, a minor bugfix release of 0.11 branch of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be eas

Re: Compile kinterbasdb with mingw32 and python 2.6 - DLL load failed

2009-09-21 Thread Paul Rudin
Laszlo Nagy writes: >>> The building and installation went find. But I cannot "import kinterbasdb" >>> because I get a "DLL load failed" error. I figured out that has something to >>> do with msvcr90 and "_ftime". Can you please give me some advice how to >>> solve this problem? >>> >> >> Do

Re: Compile kinterbasdb with mingw32 and python 2.6 - DLL load failed

2009-09-21 Thread Gerhard Häring
Laszlo Nagy wrote: > >>> The building and installation went find. But I cannot "import >>> kinterbasdb" >>> because I get a "DLL load failed" error. I figured out that has >>> something to >>> do with msvcr90 and "_ftime". Can you please give me some advice how to >>> solve this problem? >>>

Re: easy question, how to double a variable

2009-09-21 Thread Carl Banks
On Sep 20, 1:27 pm, daggerdvm wrote: >  Write the definition of a function  twice , that receives an  int > parameter and returns an  int that is twice the value of the > parameter. > > how can i do this Simple: Once you define the function, "copy" it using your editor commands, then "paste" it

Re: Python-list Digest, Vol 72, Issue 210

2009-09-21 Thread Threader Slash
Hi Roman, I am using MySQL with Python -- in Windows XP for a contract. I hope my comments can be useful: When dealing with installation on Python, I noticed that tiny details can make a difference -- e.g. first I installed the latest version of Python 3.x, but it did not attend what I am lookin

Re: explicit call to __init__(self) in subclass needed?

2009-09-21 Thread Bruno Desthuilliers
Andrew MacKeith a écrit : Bruno Desthuilliers wrote: Andrew MacKeith a écrit : I create a class like this in Python-2.6 >>> class Y(str): ... def __init__(self, s): ... pass ... >>> y = Y('giraffe') >>> y 'giraffe' >>> How does the base class (str) get initialized with the value

Re: Compile kinterbasdb with mingw32 and python 2.6 - DLL load failed

2009-09-21 Thread Laszlo Nagy
The building and installation went find. But I cannot "import kinterbasdb" because I get a "DLL load failed" error. I figured out that has something to do with msvcr90 and "_ftime". Can you please give me some advice how to solve this problem? Download Microsoft Visual C++.2008 Express Ed

Re: Tkinter - Text - bullets

2009-09-21 Thread eb303
On Sep 19, 5:53 pm, Thomas Lehmann wrote: > > Something like this maybe? > > > > from Tkinter import * > > > root = Tk() > > txt = Text(root, wrap='word') > > txt.pack() > > > txt.tag_configure('text_body', font=('Times', 18), lmargin1=0, > > lmargin2=0) > > txt.tag_configure('bulleted_list',

Reset Your LinkedIn Password

2009-09-21 Thread LinkedIn Password
LinkedIn We have received your request to reset your LinkedIn password. Please use this secure URL to reset your password within 5 days: https://www.linkedin.com/e/pwr/26793251/OGWCdFSS/ To reset your password, please enter your new password twice on the page that opens. Thank yo