Re: Types missing from "types"module

2010-06-23 Thread Ian Kelly
On Thu, Jun 24, 2010 at 12:29 AM, John Nagle wrote: >   Does the "types" module go away in 3.x, then? Not entirely, but it is greatly reduced. -- http://mail.python.org/mailman/listinfo/python-list

Re: Types missing from "types"module

2010-06-23 Thread John Nagle
On 6/23/2010 10:08 PM, Stephen Hansen wrote: On Jun 23, 2010, at 9:24 PM, John Nagle wrote: Here's dir(types), in Python 2.6.5: ['BooleanType', 'BufferType', 'BuiltinFunctionType', 'BuiltinMethodType', 'ClassType', 'CodeType', 'ComplexType', 'DictProxyType', 'DictType', 'DictionaryType',

Re: Another MySQL Problem

2010-06-23 Thread John Nagle
On 6/23/2010 10:59 PM, Dennis Lee Bieber wrote: On Wed, 23 Jun 2010 11:58:24 -0430, Victor Subervi declaimed the following in gmane.comp.python.general: When I have this code: And yes -- it IS an error... You are AGAIN trying to use parameters for SCHEMA entities, not data.

Re: best way to increment an IntVar?

2010-06-23 Thread rantingrick
On Jun 24, 12:07 am, Ben Finney wrote: > Alan G Isaac writes: > > > Of course one can do > >    myintvar.set(myintvar.get()+1) > > but surely there is a better way? > > What is an IntVar? It's not a built-in type, so you'll need to tell us. For those who don't know; IntVar is from the module Tki

Re: best way to increment an IntVar?

2010-06-23 Thread Ben Finney
Alan G Isaac writes: > Of course one can do > myintvar.set(myintvar.get()+1) > but surely there is a better way? What is an IntVar? It's not a built-in type, so you'll need to tell us. type(myintvar) Where is it imported from? import sys sys.modules[type(myintvar).__module__

Re: Types missing from "types"module

2010-06-23 Thread Stephen Hansen
On Jun 23, 2010, at 9:24 PM, John Nagle wrote: > Here's dir(types), in Python 2.6.5: > > ['BooleanType', 'BufferType', 'BuiltinFunctionType', 'BuiltinMethodType', > 'ClassType', 'CodeType', 'ComplexType', 'DictProxyType', 'DictType', > 'DictionaryType', 'EllipsisType', 'FileType', 'FloatType',

Re: Types missing from "types"module

2010-06-23 Thread Stephen Hansen
Sent from my iPad On Jun 23, 2010, at 9:24 PM, John Nagle wrote: > Here's dir(types), in Python 2.6.5: > > ['BooleanType', 'BufferType', 'BuiltinFunctionType', 'BuiltinMethodType', > 'ClassType', 'CodeType', 'ComplexType', 'DictProxyType', 'DictType', > 'DictionaryType', 'EllipsisType', 'File

best way to increment an IntVar?

2010-06-23 Thread Alan G Isaac
Of course one can do myintvar.set(myintvar.get()+1) but surely there is a better way? I'm surprsied that myintvar += 1 is not allowed. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Types missing from "types"module

2010-06-23 Thread John Nagle
Here's dir(types), in Python 2.6.5: ['BooleanType', 'BufferType', 'BuiltinFunctionType', 'BuiltinMethodType', 'ClassType', 'CodeType', 'ComplexType', 'DictProxyType', 'DictType', 'DictionaryType', 'EllipsisType', 'FileType', 'FloatType', 'FrameType', 'FunctionType', 'GeneratorType', 'GetSet

Does "distutils" support "python setup.py test"?

2010-06-23 Thread John Nagle
Many library modules support "python setup.py test", but the Python distutils documentation at http://docs.python.org/distutils/configfile.html makes no mention of it, except as a possible future extension. Some setup.py files have test_suite = "modulename" but that does

Re: Jew JUDGE shows off JEW POWER by BULLYING and BLACKMAILING a BLACK PRESIDENT OBAMA

2010-06-23 Thread k...@att.bizzzzzzzzzzzz
On Wed, 23 Jun 2010 19:10:45 -0700 (PDT), MooseFET wrote: >On Jun 23, 2:02 pm, nanothermite911fbibustards > wrote: >> FASCINATING !!! >> An ECOLOGICAL DISASTER is taking place. >> There is a need for HERCULEAN effort to STOP the oil spill. >> Then there is need for a THOROUGH study of the inciden

Re: print line number and source filename

2010-06-23 Thread Peng Yu
On Tue, Jun 22, 2010 at 12:13 PM, Stephen Hansen wrote: > On 6/22/10 9:44 AM, Peng Yu wrote: >> Also, always importing the inspect module and getting the frame and >> accessing the lineno from the frame is not very convenient to type. Is >> there a shorter way to access the line number (for exampl

Re: Jew JUDGE shows off JEW POWER by BULLYING and BLACKMAILING a BLACK PRESIDENT OBAMA

2010-06-23 Thread MooseFET
On Jun 23, 2:02 pm, nanothermite911fbibustards wrote: > FASCINATING !!! > An ECOLOGICAL DISASTER is taking place. > There is a need for HERCULEAN effort to STOP the oil spill. > Then there is need for a THOROUGH study of the incident and EXEMPLARY > PUNISHMENT of ALL THE OIL COMPANY BASTARDS, Brit

[ANN] filepath 0.1

2010-06-23 Thread exarkun
Hello all, I'm happy to announce the initial release of filepath. filepath is an abstract interface to the filesystem. It provides APIs for path name manipulation and for inspecting and modifying the filesystem (for example, renaming files, reading from them, etc). filepath's APIs are intend

Re: Pythonic Idiom For Searching An Include Path

2010-06-23 Thread Chris Rebert
On Wed, Jun 23, 2010 at 3:27 PM, Tim Daneliuk wrote: > Given a program 'foo' that takes a command line argument '-I > includefile', I want to be able to look for 'includefile' in a path > specified in an environment variable, 'FOOPATH'. > > I'd like a semantic that says: > >  "If 'includefile' con

modifying standard library functionality (difflib)

2010-06-23 Thread Vlastimil Brom
Hi all, I'd like to ask about the most reasonable/recommended/... way to modify the functionality of the standard library module (if it is recommended at all). I'm using difflib.SequenceMatcher for character-wise comparisons of the texts; although this might not be a usual use case, the results are

Re: How to send a non-standard IMAP command?

2010-06-23 Thread Tim Chase
On 06/23/2010 05:22 PM, Xianwen Chen wrote: I need to send one line of commands to an IMAP server. The commands are not standard IMAP protocols, hence it's not specified in http://docs.python.org/library/imaplib.html. Sounds like you want to use the imaplib's IMAP4.xatom() to send a custom com

Re: Should I Learn Python or Ruby next?

2010-06-23 Thread Stephen Hansen
> Would you like to present another way of achieving the same code that > makes Python look better, i would love to see it. Here is an even more > interesting example of "Ruby linear-flow" verses "Python lisp-style- > nesting"... > > RUBY: > ["three","one","two"].map{|x| x.capitalize}.sort.join(','

Re: Should I Learn Python or Ruby next?

2010-06-23 Thread rantingrick
On Jun 23, 4:43 pm, "Rhodri James" wrote: > > And how exactly does your example express itself in a more > > "syntactically-correct" "linear-flow" than the two code snippets i > > provided earlier, hmmm? > > You did rather carefully pick an example where Python's syntax flow the   > other way rou

Pythonic Idiom For Searching An Include Path

2010-06-23 Thread Tim Daneliuk
Given a program 'foo' that takes a command line argument '-I includefile', I want to be able to look for 'includefile' in a path specified in an environment variable, 'FOOPATH'. I'd like a semantic that says: "If 'includefile' contains one or more path separator characters, ignore 'FOOPATH'.

How to send a non-standard IMAP command?

2010-06-23 Thread Xianwen Chen
Dear Pythoners, I need to send one line of commands to an IMAP server. The commands are not standard IMAP protocols, hence it's not specified in http://docs.python.org/library/imaplib.html. Can you please give me a hint? Best regards, Xianwen -- http://mail.python.org/mailman/listinfo/python-li

Re: Should I Learn Python or Ruby next?

2010-06-23 Thread Rhodri James
On Wed, 23 Jun 2010 04:25:38 +0100, rantingrick wrote: On Jun 22, 9:31 pm, MRAB wrote: [snip] Napoleon once said "Never interrupt your enemy when he is making a mistake."! :-) And how exactly does your example express itself in a more "syntactically-correct" "linear-flow" than the two co

Re: Jew JUDGE shows off JEW POWER by BULLYING and BLACKMAILING a BLACK PRESIDENT OBAMA

2010-06-23 Thread nanothermite911fbibustards
FASCINATING !!! An ECOLOGICAL DISASTER is taking place. There is a need for HERCULEAN effort to STOP the oil spill. Then there is need for a THOROUGH study of the incident and EXEMPLARY PUNISHMENT of ALL THE OIL COMPANY BASTARDS, Brits, Halliburtons and ALL of them. But the JUDGE is worried about h

Re: Should I Learn Python or Ruby next?

2010-06-23 Thread Terry Reedy
On 6/23/2010 1:39 AM, Dennis Lee Bieber wrote: On Tue, 22 Jun 2010 15:55:51 -0700, Stephen Hansen declaimed the following in gmane.comp.python.general: I second Forth. Learning and using that was -- slightly painful, but Just pick up any advanced HP programmable calculator... RPL is

Re: Another MySQL Problem

2010-06-23 Thread Stephen Hansen
On Jun 23, 2010, at 11:20 AM, Victor Subervi wrote: On Wed, Jun 23, 2010 at 12:51 PM, Stephen Hansen wrote: > The problem is not this line but: > > > File "/var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py", line > 38, in mailSpreadsheet > cursor.execute('select * from %s', (client

Re: Another MySQL Problem

2010-06-23 Thread Victor Subervi
On Wed, Jun 23, 2010 at 12:51 PM, Stephen Hansen wrote: > The problem is not this line but: > > > File "/var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py", line > 38, in mailSpreadsheet > cursor.execute('select * from %s', (client,)) > > > This one. > Yes, can't use the comma, must

Re: Instance method decorator garbage collection problem

2010-06-23 Thread Thomas Jollans
On 06/23/2010 02:56 PM, John Reid wrote: > > > Thomas Jollans wrote: >>> The InstanceCounted.count is 1 at the end. If I omit the call to >>> "self.method = print_exception_decorator(self.method)" then the instance >>> count goes down to 0 as desired. I thought that the decorator might be >>> hol

Re: Does a '_sre.SRE_Pattern' have state,or is it thread-safe?

2010-06-23 Thread MRAB
John Nagle wrote: '_sre.SRE_Pattern' is what "re.compile" returns. Is that a mutable object, with state that changes during the parse, or is it an immutable constant? Can two threads use the same '_sre.SRE_Pattern' at the same time? (I'm writing something to find race conditions in ex

ttk Scale: missing attributes

2010-06-23 Thread Alan G Isaac
Tkinter's Scale widget had a `label` and a `resolution` attribute. These appear to be missing from the Ttk Scale widget. Is there a reason? These were important attributes. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Does a '_sre.SRE_Pattern' have state,or is it thread-safe?

2010-06-23 Thread Stephen Hansen
On Jun 23, 2010, at 9:10 AM, John Nagle wrote: > '_sre.SRE_Pattern' is what "re.compile" returns. > > Is that a mutable object, with state that changes > during the parse, or is it an immutable constant? Can > two threads use the same '_sre.SRE_Pattern' at the same time? Ouch. I hope it is

Re: Book review / advise

2010-06-23 Thread John Bokma
Stephen Hansen writes: > On 6/22/10 9:48 PM, John Bokma wrote: [..] > Its when you package it up in such a way that the buyer doesn't realize > what they're buying, that's where the problem comes-- and that's what is > happening quite a lot these days. Which is not the case here. > If it look

Re: Another MySQL Problem

2010-06-23 Thread Stephen Hansen
On Jun 23, 2010, at 9:28 AM, Victor Subervi wrote: Ok, let's start all over again. When I have this code: cursor.execute('select clientEmail from clients where client="%s"', (client.replace('_', ' '),)) clientEmail = cursor.fetchone()[0] Already addressed this. Do not quote inside the SQL.

Re: Another MySQL Problem

2010-06-23 Thread Stephen Hansen
On Jun 23, 2010, at 9:12 AM, Paul Rubin wrote: Stephen Hansen writes: On 6/23/10 6:45 AM, Victor Subervi wrote: cursor.execute('select clientEmail from clients where client=%s', ... Do, 'client.replace("_", " ")' instead. Er, look what happened to Little Bobby Tables (a quick web search on

the bugerrd code

2010-06-23 Thread Victoria Hernandez
The new mision I herits the buggered code (i do not the bugger). How do debugger him? Tahnk you very much. Vikhy :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Another MySQL Problem

2010-06-23 Thread Victor Subervi
Ok, let's start all over again. When I have this code: cursor.execute('select clientEmail from clients where client="%s"', (client.replace('_', ' '),)) clientEmail = cursor.fetchone()[0] I get this error: /var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py 67 68 ''' 69 70

Re: Another MySQL Problem

2010-06-23 Thread Tim Chase
On 06/23/2010 08:45 AM, Victor Subervi wrote: Hi; I have this line: cursor.execute('select clientEmail from clients where client=%s', (string.replace(client, '_', ' '))) clientEmail = cursor.fetchone()[0] cursor.execute('select * from %s' % (client)) client = "Lincoln_Properties" With

Re: Another MySQL Problem

2010-06-23 Thread Tapi
On Wed, 23 Jun 2010 10:46:37 -0430, Victor Subervi wrote: > On Wed, Jun 23, 2010 at 10:25 AM, Stephen Hansen > wrote: > >> On 6/23/10 6:45 AM, Victor Subervi wrote: >> > Hi; >> > I have this line: >> > >> > cursor.execute('select clientEmail from clients where client=%s', >> > (string.replace(c

Re: Another MySQL Problem

2010-06-23 Thread Paul Rubin
Stephen Hansen writes: >On 6/23/10 6:45 AM, Victor Subervi wrote: >> cursor.execute('select clientEmail from clients where client=%s', ... > Do, 'client.replace("_", " ")' instead. Er, look what happened to Little Bobby Tables (a quick web search on his name should find his story) because someo

Does a '_sre.SRE_Pattern' have state,or is it thread-safe?

2010-06-23 Thread John Nagle
'_sre.SRE_Pattern' is what "re.compile" returns. Is that a mutable object, with state that changes during the parse, or is it an immutable constant? Can two threads use the same '_sre.SRE_Pattern' at the same time? (I'm writing something to find race conditions in existing code, which

Re: Another MySQL Problem

2010-06-23 Thread Simon Malinge
On Wed, 23 Jun 2010 10:46:37 -0430, Victor Subervi wrote: > On Wed, Jun 23, 2010 at 10:25 AM, Stephen Hansen > wrote: > >> On 6/23/10 6:45 AM, Victor Subervi wrote: >> > Hi; >> > I have this line: >> > >> > cursor.execute('select clientEmail from clients where client=%s', >> > (string.replace(c

Re: Another MySQL Problem

2010-06-23 Thread Stephen Hansen
On 6/23/10 8:16 AM, Victor Subervi wrote: > On Wed, Jun 23, 2010 at 10:25 AM, Stephen Hansen > mailto:pyt...@ixokai.io>> wrote: > > On 6/23/10 6:45 AM, Victor Subervi wrote: > > Hi; > > I have this line: > > > > cursor.execute('select clientEmail from clients where client=%s'

Re: Another MySQL Problem

2010-06-23 Thread Victor Subervi
On Wed, Jun 23, 2010 at 10:25 AM, Stephen Hansen wrote: > On 6/23/10 6:45 AM, Victor Subervi wrote: > > Hi; > > I have this line: > > > > cursor.execute('select clientEmail from clients where client=%s', > > (string.replace(client, '_', ' '))) > > clientEmail = cursor.fetchone()[0] > > curso

Parsing email

2010-06-23 Thread Xianwen Chen
Hi guys, I use these codes to read emails from an IMAP server: import imaplib imap_srv_addr = "someserver" imap_srv = imaplib.IMAP4_SSL(imap_srv_addr) imap_srv.login("username","passwd") imap_srv.select("Inbox") msg = imap_srv.fetch(1, '(RFC822)') How can I parse msg so it can be appended to th

Re: Another MySQL Problem

2010-06-23 Thread Stephen Hansen
On 6/23/10 6:45 AM, Victor Subervi wrote: > Hi; > I have this line: > > cursor.execute('select clientEmail from clients where client=%s', > (string.replace(client, '_', ' '))) > clientEmail = cursor.fetchone()[0] > cursor.execute('select * from %s' % (client)) > > client = "Lincoln_Properti

Re: Should I Learn Python or Ruby next?

2010-06-23 Thread Dave Angel
Stephen Hansen wrote: On 6/22/10 10:39 PM, Dennis Lee Bieber wrote: On Tue, 22 Jun 2010 15:55:51 -0700, Stephen Hansen declaimed the following in gmane.comp.python.general: I second Forth. Learning and using that was -- slightly painful, but Just pick up any advanced H

Another MySQL Problem

2010-06-23 Thread Victor Subervi
Hi; I have this line: cursor.execute('select clientEmail from clients where client=%s', (string.replace(client, '_', ' '))) clientEmail = cursor.fetchone()[0] cursor.execute('select * from %s' % (client)) client = "Lincoln_Properties" With the replacement, the interpreter complains that myd

Re: Should I Learn Python or Ruby next?

2010-06-23 Thread Ed Keith
--- On Wed, 6/23/10, Dennis Lee Bieber wrote: > From: Dennis Lee Bieber > Subject: Re: Should I Learn Python or Ruby next? > To: python-list@python.org > Date: Wednesday, June 23, 2010, 1:39 AM > On Tue, 22 Jun 2010 15:55:51 -0700, > Stephen Hansen > > declaimed the following in > gmane.comp.p

Re: Should I Learn Python or Ruby next?

2010-06-23 Thread Ed Keith
--- On Wed, 6/23/10, Stephen Hansen wrote: > From: Stephen Hansen > Subject: Re: Should I Learn Python or Ruby next? > To: python-list@python.org > Date: Wednesday, June 23, 2010, 1:51 AM > On 6/22/10 10:39 PM, Dennis Lee > Bieber wrote: > > On Tue, 22 Jun 2010 15:55:51 -0700, Stephen Hansen > >

Re: Instance method decorator garbage collection problem

2010-06-23 Thread John Reid
Thomas Jollans wrote: The InstanceCounted.count is 1 at the end. If I omit the call to "self.method = print_exception_decorator(self.method)" then the instance count goes down to 0 as desired. I thought that the decorator might be holding a reference to the instance through the bound method, so

Re: Instance method decorator garbage collection problem

2010-06-23 Thread Christian Heimes
> The InstanceCounted.count is 1 at the end. If I omit the call to > "self.method = print_exception_decorator(self.method)" then the instance > count goes down to 0 as desired. I thought that the decorator might be > holding a reference to the instance through the bound method, so I added > t

Re: Instance method decorator garbage collection problem

2010-06-23 Thread Peter Otten
John Reid wrote: > Hi, > > I've written a decorator that prints exceptions and I'm having some > trouble with garbage collection. > > My decorator is: > > import sys > def print_exception_decorator(fn): > def decorator(self, *args, **kwds): > try: > return fn(*args, *

Re: Instance method decorator garbage collection problem

2010-06-23 Thread Thomas Jollans
On 06/23/2010 01:40 PM, John Reid wrote: > Hi, > > I've written a decorator that prints exceptions and I'm having some > trouble with garbage collection. > > My decorator is: > > import sys > def print_exception_decorator(fn): > def decorator(self, *args, **kwds): > try: >

Instance method decorator garbage collection problem

2010-06-23 Thread John Reid
Hi, I've written a decorator that prints exceptions and I'm having some trouble with garbage collection. My decorator is: import sys def print_exception_decorator(fn): def decorator(self, *args, **kwds): try: return fn(*args, **kwds) except: print '

Re: example of multi threads

2010-06-23 Thread Stefan Behnel
Mag Gam, 23.06.2010 12:24: I am looking for a simple multi threaded example. Lets say I have to ssh to 20 servers and I would like to that in parallel. Can someone please provide a an example for that? Sounds like you want to run background processes, not threads. Take a look at the subproce

Re: Should I Learn Python or Ruby next?

2010-06-23 Thread hackingKK
Ruby is a nice language to learn, but I seem to find it less matured. That might be my own personal perception. But looking at its success which you can read on Pythonology, I think it is going to be my choice and of many others for a long time to come. Besides ruby is more popular due to the r

example of multi threads

2010-06-23 Thread Mag Gam
I am looking for a simple multi threaded example. Lets say I have to ssh to 20 servers and I would like to that in parallel. Can someone please provide a an example for that? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: "isinstance" question

2010-06-23 Thread Thomas Jollans
On 06/23/2010 08:39 AM, Satish Eerpini wrote: > > > I want to test whether an object is an instance of any > user-defined > class. "isinstance" is less helpful than one would expect. > > >>> import types > >>> class foo() : # define dummy class >

Re: Should I Learn Python or Ruby next?

2010-06-23 Thread Jean-Michel Pichavant
rantingrick wrote: --- On Jun 22, 4:29 am, Jean-Michel Pichavant wrote: This is a python list, fully dedicated to our dutch semi God. So how can you even immagine that someone here will suggest you to go for rub... sorry I can't prononce this blasphemous name. --- ...After reading

Re: adding new function

2010-06-23 Thread Christian Heimes
Am 22.06.2010 19:18, schrieb Terry Reedy: > On 6/22/2010 5:44 AM, Daniel Fetchinson wrote: >>> how can i simply add new functions to module after its initialization >>> (Py_InitModule())? I'm missing something like >>> PyModule_AddCFunction(). > > in Python, for modules written in python > > imp

Re: encodings.idna.ToASCII( unicodeStr ) != unicodeStr.encode( 'idna' )

2010-06-23 Thread Gabriel Genellina
En Tue, 22 Jun 2010 11:02:58 -0300, escribió: Python 2.6.4 (Win32): Anyone have any explanation for the following encodings.idna.ToASCII( unicodeStr ) != unicodeStr.encode( 'idna' ) Given that other processes may have to use the output of these methods, what is the recommended technique? Dem

Re: Book review / advise

2010-06-23 Thread Stephen Hansen
On 6/22/10 9:45 PM, John Bokma wrote: > Stephen Hansen writes: > >> I *have* seen people burned by confusion over situations *extremely* >> similar to this; > > But is it? You didn't even ask yourself that question. Yes. I did. I don't really make a point of publishing internal dialog on maili

Re: adding new function

2010-06-23 Thread Gabriel Genellina
En Tue, 22 Jun 2010 14:18:59 -0300, Terry Reedy escribió: On 6/22/2010 5:44 AM, Daniel Fetchinson wrote: how can i simply add new functions to module after its initialization (Py_InitModule())? I'm missing something like PyModule_AddCFunction(). in Python, for modules written in python imp