Re: multiplication of lists of strings

2008-03-05 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : (snip) > > That reminds me: Is there a generic 'relation' pattern/recipie, such > as finding a computer that's "paired" with multiple users, each of who > are "paired" with multiple computers, without maintaining dual- > associativity? > Yes : use a relational databas

Re: Protocol for thread communication

2008-03-05 Thread bockman
On 5 Mar, 06:12, Michael Torrie <[EMAIL PROTECTED]> wrote: > Does anyone have any recommended ideas/ways of implementing a proper > control and status protocol for communicating with threads?  I have a > program that spawns a few worker threads, and I'd like a good, clean way > of communicating the

draining pipes simultaneously

2008-03-05 Thread Dmitry Teslenko
Hello! Here's my implementation of a function that executes some command and drains stdout/stderr invoking other functions for every line of command output: def __execute2_drain_pipe(queue, pipe): for line in pipe: queue.put(line) return def execute2(command, out_f

Re: draining pipes simultaneously

2008-03-05 Thread bockman
On 5 Mar, 10:33, "Dmitry Teslenko" <[EMAIL PROTECTED]> wrote: > Hello! > Here's my implementation of a function that executes some command and > drains stdout/stderr invoking other functions for every line of > command output: > > def __execute2_drain_pipe(queue, pipe): >         for line in pipe:

Leopard and MySQL

2008-03-05 Thread arbo . newmedia
Hi, can anyone help me with MySQL. I've got Mac OSX Leopard and I'm trying to install MySQLdb for Python. I'm running build and it goes withous any errors and install. But when I'm typing : import MySQLdb in IDLE I've got this: Traceback (most recent call last): File "", line 1, in impor

Using re module better

2008-03-05 Thread Mike
I seem to fall into this trap (maybe my Perl background) where I want to simultaneously test a regular expression and then extract its match groups in the same action. For instance: if (match = re.search('(\w+)\s*(\w+)', foo)): field1 = match.group(1) field2 = match.group(2) ... (com

Re: draining pipes simultaneously

2008-03-05 Thread Dmitry Teslenko
On Wed, Mar 5, 2008 at 1:34 PM, <[EMAIL PROTECTED]> wrote: > The Queue.get method by default is blocking. The documentation is not > 100% clear about that (maybe it should report > the full python definition of the function parameters, which makes > self-evident the default value) but if you d

Re: popening a process in a specific working directory

2008-03-05 Thread Sion Arrowsmith
Michael Torrie <[EMAIL PROTECTED]> wrote: >I'm currently using popen2.Popen4. Is there a way to properly specify a >particular working directory when launching a process in python? Switch to using subprocess.Popen and specify the cwd argument. -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org

Re: Using re module better

2008-03-05 Thread Tim Chase
> if (match = re.search('(\w+)\s*(\w+)', foo)): Caveat #1: use a raw string here Caveat #2: inline assignment is verboten match = re.search(r'(\w+)\s*(\w*+)', foo) if match: > field1 = match.group(1) > field2 = match.group(2) This should then work more or less. However, since y

Re: Using re module better

2008-03-05 Thread Bruno Desthuilliers
Mike a écrit : > I seem to fall into this trap (maybe my Perl background) where I want > to simultaneously test a regular expression and then extract its match > groups in the same action. > For instance: > > if (match = re.search('(\w+)\s*(\w+)', foo)): > field1 = match.group(1) > field2

Re: Altering imported modules

2008-03-05 Thread Bruno Desthuilliers
Tro a écrit : > Hi, list. > > I've got a simple asyncore-based server. However, I've modified the asyncore > module to allow me to watch functions as well as sockets. The modified > asyncore module is in a specific location in my project and is imported as > usual from my classes. > > Now I'd

Re: draining pipes simultaneously

2008-03-05 Thread bockman
> > Inserting delay in the beginning of the loop causes feeling of command > taking long to start and delay at the end of the loop may cause of > data loss when both thread became inactive during delay. time.sleep() pauses ony the thread that executes it, not the others. And queue objects can hol

Re: Leopard and MySQL

2008-03-05 Thread martin . laloux
There is a macpython list that you can consult at http://www.nabble.com/Python---pythonmac-sig-f2970.html. When you search for your problem http://www.nabble.com/forum/Search.jtp?forum=2970&local=y&query=mysqldb you have the solution http://www.nickshanny.com/2007/10/os-x-105-python-and-mysqldb.ht

documenting formal operational semantics of Python

2008-03-05 Thread gideon
Hi Everybody, In the context of a master's thesis I'm currently looking into Python's operational semantics. Even after extensive searching on the web, I have not found any formal model of Python. Therefore I am considering to write one myself. To make a more informed decision, I would like to ask

Re: Leopard and MySQL

2008-03-05 Thread arbo . newmedia
On 5 Mar, 13:40, [EMAIL PROTECTED] wrote: > There is a macpython list that you can consult > athttp://www.nabble.com/Python---pythonmac-sig-f2970.html. When you > search for your > problemhttp://www.nabble.com/forum/Search.jtp?forum=2970&local=y&query=mysqldb > > you have the > solutionhttp://ww

Python CGI & Webpage with an Image

2008-03-05 Thread rodmc
Hi, I have a set of CGI scripts set up and in one page (which is stored in an HTML file then printed via a python CGI) there is an image. However the image never displays, can anyone recommend a way round this problem? Kind regards, rod -- http://mail.python.org/mailman/listinfo/python-list

Better grammar.txt

2008-03-05 Thread MartinRinehart
I previously posted a link to an improved, HTML-based, hyperlinked grammar.txt. Discard that one. This one is much better. http://www.martinrinehart.com/articles/python-grammar.html If you find it useful, thank Gabriel Genellina for encouraging me to get it really right. It includes three correc

Re: draining pipes simultaneously

2008-03-05 Thread Dmitry Teslenko
On Wed, Mar 5, 2008 at 3:39 PM, <[EMAIL PROTECTED]> wrote: > time.sleep() pauses ony the thread that executes it, not the > others. And queue objects can hold large amount of data (if you have > the RAM), > so unless your subprocess is outputting data very fast, you should not > have data los

Why """, not '''?

2008-03-05 Thread MartinRinehart
Why is """ the preferred delimiter for multi-line strings? -- http://mail.python.org/mailman/listinfo/python-list

Re: Why """, not '''?

2008-03-05 Thread D'Arcy J.M. Cain
On Wed, 5 Mar 2008 06:56:24 -0800 (PST) [EMAIL PROTECTED] wrote: > Why is """ the preferred delimiter for multi-line strings? Where did you see that? The only place I saw it was the style guide and it was only talking about docstrings. Even there they used """ as an example but the text talked a

Re: Why """, not '''?

2008-03-05 Thread George Sakkis
On Mar 5, 9:56 am, [EMAIL PROTECTED] wrote: > Why is """ the preferred delimiter for multi-line strings? Is it ? FWIW, I use single quotes whenever I can and double whenever I have to (i.e. rarely). George -- http://mail.python.org/mailman/listinfo/python-list

Re: Protocol for thread communication

2008-03-05 Thread castironpi
On Mar 4, 11:12 pm, Michael Torrie <[EMAIL PROTECTED]> wrote: > Does anyone have any recommended ideas/ways of implementing a proper > control and status protocol for communicating with threads?  I have a > program that spawns a few worker threads, and I'd like a good, clean way > of communicating

Re: sympy: what's wrong with this picture?

2008-03-05 Thread Nanjundi
On Mar 4, 3:13 pm, Mensanator <[EMAIL PROTECTED]> wrote: > On Mar 4, 12:32 pm, Nanjundi <[EMAIL PROTECTED]> wrote: > > > > Does seeding ( random.seed ) random with time fix this? It should. > > I suppose that depends on how long it takes factorint() to > process a number. If the seed is reset befor

OT: Failed saving throw

2008-03-05 Thread Aahz
For anyone who hasn't heard, E. Gary Gygax died yesterday. Some people think we should build a tomb in his honor. ;-) -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "All problems in computer science can be solved by another level of indirection." --Butler La

Unit testing Web applications

2008-03-05 Thread Monica Leko
Hi! Does Python has some testing frameworks for testing Web applications (like Cactus and HttpUnit for Java), generating requests and checking if the response is correct? -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: Failed saving throw

2008-03-05 Thread Dan Upton
On 5 Mar 2008 07:36:37 -0800, Aahz <[EMAIL PROTECTED]> wrote: > For anyone who hasn't heard, E. Gary Gygax died yesterday. Some people > think we should build a tomb in his honor. ;-) Yeah, I just saw a tribute on Order of the Stick: http://www.giantitp.com/comics/oots0536.html -- http://mail

Re: Python CGI & Webpage with an Image

2008-03-05 Thread Miki
Hello Rod, > I have a set of CGI scripts set up and in one page (which is stored in > an HTML file then printed via a python CGI) there is an image. However > the image never displays, can anyone recommend a way round this > problem? We need more information, can you post a code snippet? error pag

Re: Unit testing Web applications

2008-03-05 Thread Diez B. Roggisch
Monica Leko wrote: > Hi! > > Does Python has some testing frameworks for testing Web applications > (like Cactus and HttpUnit for Java), generating requests and checking > if the response is correct? mechanize and webunit come to my mind. Yet the most powerful will be selenium together with sel

ActiveX in Webpage?

2008-03-05 Thread Michael Wieher
Hello, I'm trying to design a python-based web-app from scratch, based on a standalone MFC application. Obviously I'll be wrapping a lot of C++ functionality in custom extensions, but is anyone aware of any documentation/techniques that could help me "drop" an ActiveX control into a webpage, and j

Re: Talking to a usb device (serial terminal)

2008-03-05 Thread blaine
> Because it is NOT 0x10007... It is OCTAL 010007 -- which just > happens to map to hexadecimal 0x1007 > -- > WulfraedDennis Lee Bieber KD6MOG > [EMAIL PROTECTED] [EMAIL PROTECTED] > HTTP://wlfraed.home.netcom.com/ >

OT[1]: Re: SV: Polymorphism using constructors

2008-03-05 Thread Jeff Schwab
Dennis Lee Bieber wrote: > On Tue, 4 Mar 2008 20:06:38 -0500, Tommy Grav <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > >> SV = "Svar" is the Norwegian word for Reply. >> > Ah, good... In my working life, "SV" => "Space Vehicle", often used > to differentiate between th

Re: Why """, not '''?

2008-03-05 Thread MartinRinehart
D'Arcy J.M. Cain wrote: > Where did you see that? The only place I saw it was the style guide > and it was only talking about docstrings. PEP 8 and 257, and you're right, they are both about docstrings. Also, I'd never seen an example of the triple apostrophe form until I dove into the formal

Re: Better grammar.txt

2008-03-05 Thread MartinRinehart
[EMAIL PROTECTED] wrote: > It includes three corrections to grammar.txt (imagnumber, xor_expr and > and_expr) that I've reported. Make that four corrections. Add augop. -- http://mail.python.org/mailman/listinfo/python-list

Short confusing example with unicode, print, and __str__

2008-03-05 Thread Gerard Brunick
I really don't understand the following behavior: >>> class C(object): ... def __init__(self, s): self.s = s ... def __str__(self): return self.s ... >>> cafe = unicode("Caf\xe9", "Latin-1") >>> c = C(cafe) >>> print "Print using c.s:", c.s Print using c.s: Café >>> print "Print using

Re: Short confusing example with unicode, print, and __str__

2008-03-05 Thread Gary Herron
Gerard Brunick wrote: > I really don't understand the following behavior: > > >>> class C(object): > ... def __init__(self, s): self.s = s > ... def __str__(self): return self.s > ... > >>> cafe = unicode("Caf\xe9", "Latin-1") > >>> c = C(cafe) > >>> print "Print using c.s:", c.s > Prin

What is a class?

2008-03-05 Thread castironpi
What is a class that is not a module? -- http://mail.python.org/mailman/listinfo/python-list

Dual look-up on keys?

2008-03-05 Thread castironpi
I want to hash values to keys. How do the alternatives compare? -- http://mail.python.org/mailman/listinfo/python-list

Re: Using re module better

2008-03-05 Thread castironpi
On Mar 5, 6:12 am, Tim Chase <[EMAIL PROTECTED]> wrote: > > if (match = re.search('(\w+)\s*(\w+)', foo)): > > Caveat #1:  use a raw string here > Caveat #2:  inline assignment is verboten > >    match = re.search(r'(\w+)\s*(\w*+)', foo) >    if match: > > >     field1 = match.group(1) > >     field

Re: Dual look-up on keys?

2008-03-05 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I want to hash values to keys. How do the alternatives compare? http://catb.org/~esr/faqs/smart-questions.html -- http://mail.python.org/mailman/listinfo/python-list

change user-agent

2008-03-05 Thread davidj411
I came across this post on the net and wanted to know what was meant by down-level module. So, how can we change the User-Agent? If we don't want to change the headers using a lower-level module such as httplib, the solution is quite easy -- http://mail.python.org/mailman/listinfo/python-list

Re: documenting formal operational semantics of Python

2008-03-05 Thread davidj411
Python 3.0 might end up better, but converting all those scripts will be a chore. I'd be curious to know how that will be done. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why """, not '''?

2008-03-05 Thread Matthew Woodcraft
<[EMAIL PROTECTED]> wrote: > Why is """ the preferred delimiter for multi-line strings? One advantage is that a dumb syntax highlighter is more likely to cope well if the content includes an apostrophe. -M- -- http://mail.python.org/mailman/listinfo/python-list

Re: What is a class?

2008-03-05 Thread Paul McGuire
On Mar 5, 12:50 pm, [EMAIL PROTECTED] wrote: > What is a class that is not a module? Please stop posting these one-liner beginner questions. If you can type it in one line, you can enter it on the Google.com or Ask.com query page and get a wealth of *existing* information, from tutorials, documen

Embedding vs Configuring Python build

2008-03-05 Thread [EMAIL PROTECTED]
I am using Python in an application that cannot depend on an existing Python installation or require Python to be installed. The application itself should not have an install procedure, but rather should be runnable from any location in the file system. Ideally I would prefer not to embed at all,

Re: documenting formal operational semantics of Python

2008-03-05 Thread Paul Rubin
gideon <[EMAIL PROTECTED]> writes: > In the context of a master's thesis I'm currently looking into > Python's operational semantics. Even after extensive searching on the > web, I have not found any formal model of Python. Therefore I am > considering to write one myself. I doubt if anything ser

Re: What is a class?

2008-03-05 Thread castironpi
On Mar 5, 1:29 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Mar 5, 12:50 pm, [EMAIL PROTECTED] wrote: > > > What is a class that is not a module? > > Please stop posting these one-liner beginner questions.  If you can > type it in one line, you can enter it on the Google.com or Ask.com > query

Re: Dual look-up on keys?

2008-03-05 Thread castironpi
On Mar 5, 1:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > I want to hash values to keys.  How do the alternatives compare? > > http://catb.org/~esr/faqs/smart-questions.html ... without extending the whole way to a full relational database? -- http://mail

Def generating a function to be ran in another context

2008-03-05 Thread Marcelo de Moraes Serpa
I'd like a certain function to generate a method for another class and this new method to be called in the context of the "new" class. Is it possible with Python? Thanks, Marcelo. -- http://mail.python.org/mailman/listinfo/python-list

Bit twiddling floating point numbers

2008-03-05 Thread [EMAIL PROTECTED]
Hi All Is there a simple way to twiddle the bits of a float? In particular, I would like to round my float to the n most significant bits. For example - 0.123 in binary is 0.00011 Rounding to 4 bits I get 0.0001. I can pack and unpack a float into a long e.g. struct.unpack('I',struct.pack('f

Re: documenting formal operational semantics of Python

2008-03-05 Thread Matthew Woodcraft
gideon <[EMAIL PROTECTED]> wrote: > In the context of a master's thesis I'm currently looking into > Python's operational semantics. Even after extensive searching on the > web, I have not found any formal model of Python. Therefore I am > considering to write one myself. To make a more informed d

Re: sympy: what's wrong with this picture?

2008-03-05 Thread Mensanator
On Mar 5, 9:29 am, Nanjundi <[EMAIL PROTECTED]> wrote: > On Mar 4, 3:13 pm, Mensanator <[EMAIL PROTECTED]> wrote: > > > On Mar 4, 12:32 pm, Nanjundi <[EMAIL PROTECTED]> wrote: > > > > Does seeding ( random.seed ) random with time fix this? It should. > > > I suppose that depends on how long it take

Re: Bit twiddling floating point numbers

2008-03-05 Thread Grant Edwards
On 2008-03-05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Is there a simple way to twiddle the bits of a float? In particular, I > would like to round my float to the n most significant bits. > > For example - 0.123 in binary is 0.00011 > Rounding to 4 bits I get 0.0001. > > I can pack and

Re: Bit twiddling floating point numbers

2008-03-05 Thread Grant Edwards
On 2008-03-05, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-03-05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> Any suggestions? > > Just use the bitwise and/or/not operators: & | ~ Oh, I forgot to mention the shift operators << and >> -- Grant Edwards grante

Re: Bit twiddling floating point numbers

2008-03-05 Thread [EMAIL PROTECTED]
On Mar 5, 10:48 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-03-05, Grant Edwards <[EMAIL PROTECTED]> wrote: > > > On 2008-03-05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> Any suggestions? > > > Just use the bitwise and/or/not operators: & | ~ > > Oh, I forgot to mention the shift

Re: Bit twiddling floating point numbers

2008-03-05 Thread Grant Edwards
On 2008-03-05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > thanks for the reply but I'm still unsure as to how to > continue. Using the bitwise operators will help me deal with > integers but I really want to work with floats. In your original post, you said that you've got the values as integ

Re: Bit twiddling floating point numbers

2008-03-05 Thread Mark Dickinson
On Mar 5, 3:25 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I can pack and unpack a float into a long > e.g. > struct.unpack('I',struct.pack('f',0.123))[0] > but then I'm not sure how to work with the resulting long. > > Any suggestions? One alternative to using struct is to use math.ldexp

Re: What is a class?

2008-03-05 Thread Paul McGuire
On Mar 5, 2:04 pm, [EMAIL PROTECTED] wrote: > On Mar 5, 1:29 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > > > On Mar 5, 12:50 pm, [EMAIL PROTECTED] wrote: > > > > What is a class that is not a module? > > > Please stop posting these one-liner beginner questions.  If you can > > type it in one line

Re: Def generating a function to be ran in another context

2008-03-05 Thread Terry Reedy
"Marcelo de Moraes Serpa" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I'd like a certain function to generate a method for another class and this | new method to be called in the context of the "new" class. Is it possible | with Python? Yes. (Assuming I understand your questi

Re: Bit twiddling floating point numbers

2008-03-05 Thread Mensanator
On Mar 5, 2:25 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi All > > Is there a simple way to twiddle the bits of a float? In particular, I > would like to round my float to the n most significant bits. > > For example - 0.123 in binary is 0.00011 > Rounding to 4 bits I get 0.0001. >

Re: Dual look-up on keys?

2008-03-05 Thread Steven D'Aprano
On Wed, 05 Mar 2008 12:06:11 -0800, castironpi wrote: > On Mar 5, 1:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] schrieb: >> >> > I want to hash values to keys.  How do the alternatives compare? >> >> http://catb.org/~esr/faqs/smart-questions.html > > ... without exte

Re: What is a class?

2008-03-05 Thread Mike Driscoll
On Mar 5, 12:50 pm, [EMAIL PROTECTED] wrote: > What is a class that is not a module? Why is a raven like a writing desk? As for Python class information, I would recommend reading the following sites: http://docs.python.org/tut/node11.html http://www.diveintopython.org/object_oriented_framework/

Re: for-else

2008-03-05 Thread Troels Thomsen
> > The primary use case is searching a container: > > prep_tasks() > for item in container: > if predicate(item): > found_tasks() > break > else: > not_found_tasks() > follow_up_tasks > I've found myself mimicing this again and again in c, and was pleased

Re: What is a class?

2008-03-05 Thread castironpi
> > > > What is a class that is not a module? > > > I'm willing to address convention, in serial or parallel--- (change > > subject to 'what goes on newsgroups'?), but it's not clear from fact > > what assumption who has made. > > Since you did not elaborate on what your efforts were and the extent

Please keep the full address

2008-03-05 Thread D'Arcy J.M. Cain
On Wed, 5 Mar 2008 13:38:59 -0800 (PST) Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Mar 5, 12:50 pm, [EMAIL PROTECTED] wrote: I'm not sure why you change the address like this but could you please include the full address. Those of us who identify the time wasters would also like to drop the re

Re: Dual look-up on keys?

2008-03-05 Thread castironpi
On Mar 5, 3:38 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 05 Mar 2008 12:06:11 -0800, castironpi wrote: > > On Mar 5, 1:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > > >> > I want to hash values to keys.  How do the alternati

Re: What is a class?

2008-03-05 Thread Steven D'Aprano
On Wed, 05 Mar 2008 10:50:12 -0800, castironpi wrote: > What is a class that is not a module? Er, all of them? I'm curious what classes you think are modules. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Please keep the full address

2008-03-05 Thread Mike Driscoll
On Mar 5, 3:51 pm, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: > On Wed, 5 Mar 2008 13:38:59 -0800 (PST) > > Mike Driscoll <[EMAIL PROTECTED]> wrote: > > On Mar 5, 12:50 pm, [EMAIL PROTECTED] wrote: > > I'm not sure why you change the address like this but could you please > include the full addr

Re: Dual look-up on keys?

2008-03-05 Thread Grant Edwards
On 2008-03-05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I want to hash values to keys.  How do the alternatives compare? >> http://catb.org/~esr/faqs/smart-questions.html >> >>> ... without extending the whole way to a full relational database? >> >> You didn't bother following the l

Re: Using re module better

2008-03-05 Thread Steven D'Aprano
On Wed, 05 Mar 2008 11:09:28 -0800, castironpi wrote: > On another note, why do people X, Y, and Z, including me, all hate to > write a= b(); if a: a.something()? Is this a guessing game? You want us to guess why YOU hate to do something? Okay, I'm game for guessing games... You were traumatiz

Re: sympy: what's wrong with this picture?

2008-03-05 Thread Nanjundi
On Mar 5, 3:34 pm, Mensanator <[EMAIL PROTECTED]> wrote: > On Mar 5, 9:29 am, Nanjundi <[EMAIL PROTECTED]> wrote: > > > On Mar 4, 3:13 pm, Mensanator <[EMAIL PROTECTED]> wrote: > > > > On Mar 4, 12:32 pm, Nanjundi <[EMAIL PROTECTED]> wrote: > > > > > Does seeding ( random.seed ) random with time fi

Re: Dual look-up on keys?

2008-03-05 Thread castironpi
On Mar 5, 3:38 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 05 Mar 2008 12:06:11 -0800, castironpi wrote: > > On Mar 5, 1:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > > >> > I want to hash values to keys.  How do the alternati

re: What is a class?

2008-03-05 Thread Michael Wieher
You import classes from modules. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dual look-up on keys?

2008-03-05 Thread Steven D'Aprano
On Wed, 05 Mar 2008 13:52:38 -0800, castironpi wrote: > On Mar 5, 3:38 pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> On Wed, 05 Mar 2008 12:06:11 -0800, castironpi wrote: >> > On Mar 5, 1:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> >> [EMAIL PROTECTED] schrieb:

Re: What is a class?

2008-03-05 Thread Paul McGuire
On Mar 5, 3:49 pm, [EMAIL PROTECTED] wrote: > > Classes and modules are really similar.  In Python they're really > *really* similar. > > Actually, at this point, that observation may have more of a > subjective component than I'm used to asserting.  I pause here for > corroboration and others' per

Re: What is a class?

2008-03-05 Thread castironpi
On Mar 5, 3:58 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 05 Mar 2008 10:50:12 -0800, castironpi wrote: > > What is a class that is not a module? > > Er, all of them? > > I'm curious what classes you think are modules. > > -- > Steven Thank you for your time in ent

Re: Dual look-up on keys?

2008-03-05 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > On Mar 5, 3:38 pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> On Wed, 05 Mar 2008 12:06:11 -0800, castironpi wrote: >>> On Mar 5, 1:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] schrieb: > I want to hash values t

Re: What is a class?

2008-03-05 Thread Steven D'Aprano
On Wed, 05 Mar 2008 13:49:20 -0800, castironpi wrote: > Classes and modules are really similar. In Python they're really > *really* similar. Yes they are. Both are namespaces. The very last line of the Zen of Python says: >>> import this ... Namespaces are one honking great idea -- let's do mo

Re: Why """, not '''?

2008-03-05 Thread Steven D'Aprano
On Wed, 05 Mar 2008 19:19:08 +, Matthew Woodcraft wrote: > <[EMAIL PROTECTED]> wrote: >> Why is """ the preferred delimiter for multi-line strings? > > One advantage is that a dumb syntax highlighter is more likely to cope > well if the content includes an apostrophe. But if the content cont

Identifying messages in a thread (was: Please keep the full address)

2008-03-05 Thread Ben Finney
"D'Arcy J.M. Cain" <[EMAIL PROTECTED]> writes: > On Wed, 5 Mar 2008 13:38:59 -0800 (PST) > Mike Driscoll <[EMAIL PROTECTED]> wrote: > > On Mar 5, 12:50 pm, [EMAIL PROTECTED] wrote: > > I'm not sure why you change the address like this but could you > please include the full address. It's a misfe

Re: Dual look-up on keys?

2008-03-05 Thread castironpi
On Mar 5, 4:00 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-03-05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I want to hash values to keys.  How do the alternatives compare? > > http://catb.org/~esr/faqs/smart-questions.html > > >>> ... without extending the whole way to

system32 directory

2008-03-05 Thread Robert Dailey
Hi, Is there a way to get the System32 directory from windows through python? For example, in C++ you do this by calling GetSystemDirectory(). Is there an equivalent Python function for obtaining windows installation dependent paths? -- http://mail.python.org/mailman/listinfo/python-list

Re: Dual look-up on keys?

2008-03-05 Thread Vlastimil Brom
2008/3/5, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > ... > Anyway, if (a,b) is a key in dictionary d, can it guarantee that (b,a) > is also in it, and maps to the same object? > ... > Well, it's probably not the most effective way, but one can use something like: >>> d={frozenset(("a","b")):7} >>

Re: Dual look-up on keys?

2008-03-05 Thread Steven D'Aprano
On Wed, 05 Mar 2008 14:51:04 -0800, castironpi wrote: > Anyway, if (a,b) is a key in dictionary d, can it guarantee that (b,a) > is also in it, and maps to the same object? It would take you approximately five seconds to answer that question for yourself. >>> D = {(1,2): "x"} >>> D[(2,1)] Trace

Re: Dual look-up on keys?

2008-03-05 Thread Grant Edwards
On 2008-03-05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Are you vegetarian? Some days. > A little off topic. Ya think? > Anyway, if (a,b) is a key in dictionary d, can it guarantee > that (b,a) is also in it, and maps to the same object? Do you not know how to run the Python interpreter

Re: Why """, not '''?

2008-03-05 Thread Matthew Woodcraft
Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Wed, 05 Mar 2008 19:19:08 +, Matthew Woodcraft wrote: >> One advantage is that a dumb syntax highlighter is more likely to cope >> well if the content includes an apostrophe. > But if the content contains double-quote marks, the "dumb syntax > h

Re: Why """, not '''?

2008-03-05 Thread Steven D'Aprano
On Wed, 05 Mar 2008 23:27:21 +, Matthew Woodcraft wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: >>On Wed, 05 Mar 2008 19:19:08 +, Matthew Woodcraft wrote: >>> One advantage is that a dumb syntax highlighter is more likely to cope >>> well if the content includes an apostrophe. > >>

access to base class __init__

2008-03-05 Thread sambo q
I got myself in jam trying to be too fancy with threading.Thread Docs say / remind to call the base __init__ but I can't fighure out how. --- def main() . ls.listen(5) key = ' ' #while key != EXITCHARCTER: while stop_serving == False: cs, raddr

2nd CFP: DATICS 2008 - Design, Analysis and Tools for Integrated Circuits and Systems

2008-03-05 Thread ss . dtvcs
Apologies for any multiple copies received. We would appreciate it if you could distribute the following call for papers to any relevant mailing lists you know of. 2nd CALL FOR PAPERS === Special

Re: for-else

2008-03-05 Thread bearophileHUGS
On Mar 5, 10:44 pm, "Troels Thomsen" wrote: > > The primary use case is searching a container: > > > prep_tasks() > > for item in container: > > if predicate(item): > > found_tasks() > > break > > else: > > not_found_tasks() > > follow_up_tasks > > I've foun

Re: ActiveX in Webpage?

2008-03-05 Thread Andrew Warkentin
Michael Wieher wrote: > Hello, > > I'm trying to design a python-based web-app from scratch, based on a > standalone MFC application. > Obviously I'll be wrapping a lot of C++ functionality in custom > extensions, but is anyone aware of any documentation/techniques that > could help me "drop" a

Re: for-else

2008-03-05 Thread bearophileHUGS
Troels Thomsen: > The discussion of words is silly. My surprise about "else following a for > loop what the heck " lasted excactly as long as it takes to read > this sentence. Maybe I don't follow what you are saying, but well chosen words are a very important part of a well designed API.

Returning a byte buffer from C extension

2008-03-05 Thread forwardshortleg
Hello, I am new to Python programming. So, kindly excuse me if I don't use correct terminology here below. I am trying to write an extension function that returns an array of bytes as shown in the example below: static PyObject* GetByteBuffer(PyObject* self, PyObject* args) { char byteBuff

http://httpd.apache.org/docs/2.2/mod/mod_dbd.html

2008-03-05 Thread gert
Would anybody explain to me what needs to be done to have a DB-API 2.0 layer for this ? And how many lines of code we are talking ? http://httpd.apache.org/docs/2.2/mod/mod_dbd.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Please keep the full address

2008-03-05 Thread D'Arcy J.M. Cain
On Wed, 5 Mar 2008 14:00:17 -0800 (PST) Mike Driscoll <[EMAIL PROTECTED]> wrote: > What are you talking about? I didn't change the address at all. I'm > not even sure what you mean. Are you talking about the post subject > line (which I have never touched in any post)? If you're talking about > the

Re: Returning a byte buffer from C extension

2008-03-05 Thread forwardshortleg
I just realized that I could do this as follows: static PyObject* GetByteBuffer(PyObject* self, PyObject* args) { char byteBuffer[100]; // do something to fill byteBuffer with values. return Py_BuildValue("s#", byteBuffer, numberOfBytesToReturn); } Sorry for the unnecessary distract

Re: Identifying messages in a thread (was: Please keep the full address)

2008-03-05 Thread D'Arcy J.M. Cain
On Thu, 06 Mar 2008 09:36:29 +1100 Ben Finney <[EMAIL PROTECTED]> wrote: > > Those of us who identify the time wasters would also like to drop > > the responses to their posts and changing the address makes this > > impossible. > > Not at all. AFAIK the messages from Google mail correctly include

[OT] Re: Why """, not '''?

2008-03-05 Thread Matt Nordhoff
Steven D'Aprano wrote: > Surely it would depend on the type of text: pick up any random English > novel containing dialogue, and you're likely to find a couple of dozen > pairs of quotation marks per page, against a few apostrophes. That's an idea... Write a novel in Python docstrings. Someone

Classes and modules are singletons?

2008-03-05 Thread Steven D'Aprano
I recall that Python guarantees that module objects are singletons, and that this must hold for any implementation, not just CPython: you can only ever create one instance of a module via the import mechanism. But my google-foo is obviously weak today, I cannot find where the Python language re

RE: Unit testing Web applications

2008-03-05 Thread Ryan Ginstrom
> On Behalf Of Monica Leko > Does Python has some testing frameworks for testing Web > applications (like Cactus and HttpUnit for Java), generating > requests and checking if the response is correct? I have got a lot of traction using mechanize [1] with nose [2]. Of course that still leaves out

Re: Dual look-up on keys?

2008-03-05 Thread castironpi
On Mar 5, 5:31 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-03-05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Anyway, if (a,b) is a key in dictionary d, can it guarantee > > that (b,a) is also in it, and maps to the same object? Er... -specialized- dictionary d. > To solve that pr

  1   2   >