Re: List of lists surprising behaviour

2010-06-17 Thread Steven D'Aprano
On Fri, 18 Jun 2010 00:20:30 +0100, bart.c wrote: > The code is clearly trying to set only t[0][0] to 1, not t[1][0] and > t[2][0] as well. Trying to guess the motivation of the person writing code is tricky, but in this case, that's a reasonable assumption. I can't think of any reason why some

Re: The inverse of .join

2010-06-17 Thread Steven D'Aprano
On Thu, 17 Jun 2010 20:03:42 +, Neil Cerutti wrote: > I'm currently using the following without problems, while reading a data > file. One of the fields is a comma separated list, and may be empty. > > f = rec['codes'] > if f == "": > f = [] > else: > f = f.split(",") > > I jus

Re: The inverse of .join

2010-06-17 Thread Steven D'Aprano
On Thu, 17 Jun 2010 20:44:41 +0100, MRAB wrote: > Should .split grow an addition keyword argument to specify the desired > behaviour? Please no. > (Although it's simple enough to define your own function.) Exactly. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Overriding "__setattr__" of a module - possible?

2010-06-17 Thread Gabriel Genellina
En Thu, 17 Jun 2010 14:09:38 -0300, John Nagle escribió: I'm trying out a proof of concept implementation for a new approach to safe threading. It's somewhat similar in concept to Alan Olsen's scheme. The basic difference is that once the program goes multi-thread, code objects and some o

Re: Different byte-code in same major version (2.6.x)?

2010-06-17 Thread Aahz
In article <7xfx0ot9ul@ruckus.brouhaha.com>, Paul Rubin wrote: >Hartmut Goebel writes: >> >> I'm facing a curious problem: 2.6, 2.6.1 and 2.6.4 are generating >> different byte-code for the same source. I can not find the reason for. > >Why should they generate the same bytecode? All that y

Re: Overriding "__setattr__" of a module - possible?

2010-06-17 Thread Gabriel Genellina
En Thu, 17 Jun 2010 07:12:23 -0300, Fuzzyman escribió: On Jun 17, 10:29 am, "Gabriel Genellina" wrote: En Thu, 17 Jun 2010 04:52:48 -0300, Alf P. Steinbach escribió: > But who would have thunk that Python *isn't dynamic enough*? :-) Yep... There are other examples too (e.g. the print stat

shelve / pickle error

2010-06-17 Thread Vineet
Hi ! I am using python ver 2.6.5 Trying to use shelve to save an object on the disc. = In the code # There are 'Person' & 'Manager' classes. # I created instance objects a,b,c from these classes. from person import Person, Manager a = Person('A A') b = Person('B

Re: Jewish Pirates of the Mediteranean

2010-06-17 Thread small Pox
Excellent Video, VERRRY RARE !!! http://www.youtube.com/watch?v=r-72jGkGbsg On Jun 16, 2:25 am, nanothermite911fbibustards wrote: > Jewish Pirates of the > Caribbeanhttp://www.youtube.com/watch?v=cFSjKaiN47I&feature=related > > Python > Jewish Pirates of the Caribbean > Lisp > (Jewish-Pirates

Re: The inverse of .join

2010-06-17 Thread Steven D'Aprano
On Thu, 17 Jun 2010 17:45:41 +, Neil Cerutti wrote: > What's the best way to do the inverse operation of the .join function? str.join is a many-to-one function, and so it doesn't have an inverse. You can't always get the input back unchanged: >>> L = ["a", "b", "c|d", "e"] >>> s = '|'.join(

Re: Serializing functions

2010-06-17 Thread Chris Rebert
2010/6/17 Andreas Löscher : > Am Donnerstag, den 17.06.2010, 18:03 +0200 schrieb Andreas Löscher: >> Am Donnerstag, den 17.06.2010, 08:18 -0700 schrieb Paul Rubin: >> > Matteo Landi writes: >> > > I could be wrong, but it seems functions are not marshable objects, is >> > > it right? >> > >> > Hmm

Re: Printing forms and labels in Python

2010-06-17 Thread Gregory Ewing
Monte Milanuk wrote: Opening Adobe Reader as a sort of 'print preview' might be a workable solution. Or if you think Acrobat Reader sucks too much, Foxit Reader is a nice, lightweight alternative: http://www.foxitsoftware.com/pdf/reader/reader3.php -- Greg -- http://mail.python.org/mailman/l

Re: List of lists surprising behaviour

2010-06-17 Thread Lie Ryan
On 06/18/10 09:20, bart.c wrote: > > "J Kenneth King" wrote in message > news:87wrtxh0dq@agentultra.com... >> candide writes: >> >>> Let's the following code : >>> >> t=[[0]*2]*3 >> t >>> [[0, 0], [0, 0], [0, 0]] >> t[0][0]=1 >> t >>> [[1, 0], [1, 0], [1, 0]] >>> >>> Rather s

Re: Socket error 98 "Address already in use"

2010-06-17 Thread AK
On 06/17/2010 08:59 PM, Grant Edwards wrote: > On 2010-06-18, AK wrote: > >> Here it is: >> >> Traceback (most recent call last): >> File "./vimp3_player.py", line 112, in >> Player().main() >> File "./vimp3_player.py", line 35, in main >> self.listen() >> File "./vimp3_player.py",

Re: Import fails (newbie)

2010-06-17 Thread Albert Hopkins
On Thu, 2010-06-17 at 12:04 -0700, mhorlick wrote: > Hello, > > I'm a newbie and I have a small problem. After invoking IDLE --> > > Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit > (Intel)] on win32 > Type "copyright", "credits" or "license()" for more information. > >>> imp

Re: Socket error 98 "Address already in use"

2010-06-17 Thread Grant Edwards
On 2010-06-18, AK wrote: > Here it is: > > Traceback (most recent call last): > File "./vimp3_player.py", line 112, in > Player().main() > File "./vimp3_player.py", line 35, in main > self.listen() > File "./vimp3_player.py", line 41, in listen > s.bind((HOST, PORT)) > File "

Re: List of lists surprising behaviour

2010-06-17 Thread rantingrick
On Jun 17, 6:44 pm, Benjamin Kaplan wrote: > It's the recursively duplicating each element that's the problem. How > do you know when to stop? Thats easy, stack overflow! ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Socket error 98 "Address already in use"

2010-06-17 Thread AK
On 06/17/2010 08:19 PM, Grant Edwards wrote: > On 2010-06-17, AK wrote: >> Hi, I'm trying to make a little mp3 server / client and I'm running into >> a problem with the Socket error 98 "Address already in use". The error >> doesn't happen right away, I can send 3-4 commands, disconnecting and >>

Re: Socket error 98 "Address already in use"

2010-06-17 Thread Grant Edwards
On 2010-06-17, AK wrote: > Hi, I'm trying to make a little mp3 server / client and I'm running into > a problem with the Socket error 98 "Address already in use". The error > doesn't happen right away, I can send 3-4 commands, disconnecting and > reconnecting and they work fine and then I get this

Re: Possible to reach back in stack and grab calling function's locals()?

2010-06-17 Thread Ryan Kelly
On Thu, 2010-06-17 at 16:02 -0400, pyt...@bdurham.com wrote: > Is there an elegant way to reach back in the stack and grab the > calling function's copy of locals()? You can do it using my favourite function, sys._getframe: >>> import sys >>> >>> def outer(): ... a = 1 ... inner() ... >

[suds] how to convert a sudsobject into its representative XML?

2010-06-17 Thread Phlip
[The SUDS mailing list is clogged with spam. F'k'n arms race.] I'm trying to write a unit test on a view that will respond to SOAPist commands. To get there, the test must pass XML as if a SOAP client had cooked it up and sent it over the wire. So I have a auth object, like this: wsdl =

Re: List of lists surprising behaviour

2010-06-17 Thread Benjamin Kaplan
On Thu, Jun 17, 2010 at 4:20 PM, bart.c wrote: > > "J Kenneth King" wrote in message > news:87wrtxh0dq@agentultra.com... >> >> candide writes: >> >>> Let's the following code : >>> >> t=[[0]*2]*3 >> t >>> >>> [[0, 0], [0, 0], [0, 0]] >> >> t[0][0]=1 >> t >>> >>> [[1, 0],

Re: Socket error 98 "Address already in use"

2010-06-17 Thread AK
On 06/17/2010 07:21 PM, AK wrote: > Hi, I'm trying to make a little mp3 server / client and I'm running into > a problem with the Socket error 98 "Address already in use". The error > doesn't happen right away, I can send 3-4 commands, disconnecting and > reconnecting and they work fine and then I

Socket error 98 "Address already in use"

2010-06-17 Thread AK
Hi, I'm trying to make a little mp3 server / client and I'm running into a problem with the Socket error 98 "Address already in use". The error doesn't happen right away, I can send 3-4 commands, disconnecting and reconnecting and they work fine and then I get this error and the client can no longe

Re: basic doubt

2010-06-17 Thread Cameron Simpson
On 17Jun2010 05:11, Gabriel Genellina wrote: | En Thu, 17 Jun 2010 02:06:54 -0300, madhuri vio | escribió: | | >def h(self,event): | >handle = open("myco.fasta","r") | >for seq_record in SeqIO.parse(handle, "fasta"): | > messenger_rna = coding_myco.fasta.transcribe() | >

Re: List of lists surprising behaviour

2010-06-17 Thread bart.c
"J Kenneth King" wrote in message news:87wrtxh0dq@agentultra.com... candide writes: Let's the following code : t=[[0]*2]*3 t [[0, 0], [0, 0], [0, 0]] t[0][0]=1 t [[1, 0], [1, 0], [1, 0]] Rather surprising, isn't it ? Not at all, actually. The code is clearly trying to set only

Re: Py_single_input and the side-effects...

2010-06-17 Thread Mark Lawrence
On 17/06/2010 22:51, Stephen Hansen wrote: On 6/17/10 2:32 PM, Mark Lawrence wrote: Where is the use of _ in a script documented, I've searched all over and can't find it, guess I don't have the Midas touch with google? :) Its purely a convention, and one that crosses language-bounds, and isn'

Re: How to print SRE_Pattern (regexp object) text for debugging purposes?

2010-06-17 Thread MRAB
dmtr wrote: On Jun 17, 3:35 pm, MRAB wrote: >>> import re >>> r = re.compile('^abc$', re.I) >>> r.pattern '^abc$' >>> r.flags 2 Hey, thanks. It works. Couldn't find it in a reference somehow. And it's not in the inspect.getmembers(r). Must be doing something wrong. Occasionally you

Re: max time threads

2010-06-17 Thread MRAB
pacopyc wrote: Hi, I'm trying to work with threads and I need your help. This is code: from threading import Thread from Queue import Queue import time import random def test_fun (k,q,t): time.sleep(t) print "hello world from thread " + str(q.get()) + " (sleep time = " + str(t) + " sec.

Re: How to print SRE_Pattern (regexp object) text for debugging purposes?

2010-06-17 Thread dmtr
On Jun 17, 3:35 pm, MRAB wrote: > >  >>> import re >  >>> r = re.compile('^abc$', re.I) >  >>> r.pattern > '^abc$' >  >>> r.flags > 2 Hey, thanks. It works. Couldn't find it in a reference somehow. And it's not in the inspect.getmembers(r). Must be doing something wrong. -- Cheers, Dmitry

Re: How to print SRE_Pattern (regexp object) text for debugging purposes?

2010-06-17 Thread MRAB
dmtr wrote: I need to print the regexp pattern text (SRE_Pattern object ) for debugging purposes, is there any way to do it gracefully? I've came up with the following hack, but it is rather crude... Is there an official way to get the regexp pattern text? import re, pickle r = re.compile('^abc

Re: Running a program from another program.

2010-06-17 Thread Stephen Hansen
On 6/17/10 3:06 PM, Laurent Verweijen wrote: >> >> In your other thread you include an actual traceback: >> >> Traceback (most recent call last): >> File "subchronous_test.py", line 5, in >> send_all(str(p), n) >> File "/home/Somelauw/asynchronous.py", line 145, in send_all >> while le

Re: Convert .doc to .pdf

2010-06-17 Thread Aahz
In article <29a7823f-a3b1-466b-9876-553cb62c0...@w12g2000yqj.googlegroups.com>, Thales wrote: > >I need to convert some files from .doc to .pdf. I've googled it a >little bit and all the solutions I've found used the OpenOffice API, >but I can't use it. > >Anybody knows a library that I can use t

Re: Running a program from another program.

2010-06-17 Thread Laurent Verweijen
Op donderdag 17-06-2010 om 14:48 uur [tijdzone -0700], schreef Stephen Hansen: > On 6/17/10 2:40 PM, Laurent Verweijen wrote: > > Op donderdag 17-06-2010 om 14:36 uur [tijdzone -0700], schreef Stephen > > Hansen: > >> On 6/17/10 2:09 PM, Laurent Verweijen wrote: > >>> It just gives me an empty st

max time threads

2010-06-17 Thread pacopyc
Hi, I'm trying to work with threads and I need your help. This is code: from threading import Thread from Queue import Queue import time import random def test_fun (k,q,t): time.sleep(t) print "hello world from thread " + str(q.get()) + " (sleep time = " + str(t) + " sec.)" q.task_don

Re: Py_single_input and the side-effects...

2010-06-17 Thread Stephen Hansen
On 6/17/10 2:32 PM, Mark Lawrence wrote: > Where is the use of _ in a script documented, I've searched all over and > can't find it, guess I don't have the Midas touch with google? :) Its purely a convention, and one that crosses language-bounds, and isn't entirely universal even given that. It j

Re: Processing HTML form

2010-06-17 Thread Grant Edwards
On 2010-06-17, Bradley Hintze wrote: > I am on Mac OSX 10.6, server is apache. If I do get this working we > will move it to the main server which also serves apache, i believe.I > dont think I want a whole new server, I'd like to serve from the > apache framework if possible. There are a couple

Re: Running a program from another program.

2010-06-17 Thread Stephen Hansen
On 6/17/10 2:40 PM, Laurent Verweijen wrote: > Op donderdag 17-06-2010 om 14:36 uur [tijdzone -0700], schreef Stephen > Hansen: >> On 6/17/10 2:09 PM, Laurent Verweijen wrote: >>> It just gives me an empty string. >>> >>> Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) >>> [GCC 4.4.3] on linux2

How to print SRE_Pattern (regexp object) text for debugging purposes?

2010-06-17 Thread dmtr
I need to print the regexp pattern text (SRE_Pattern object ) for debugging purposes, is there any way to do it gracefully? I've came up with the following hack, but it is rather crude... Is there an official way to get the regexp pattern text? >>> import re, pickle >>> r = re.compile('^abc$', re.

Re: Running a program from another program.

2010-06-17 Thread Laurent Verweijen
Op donderdag 17-06-2010 om 14:36 uur [tijdzone -0700], schreef Stephen Hansen: > On 6/17/10 2:09 PM, Laurent Verweijen wrote: > > It just gives me an empty string. > > > > Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) > > [GCC 4.4.3] on linux2 > > Type "help", "copyright", "credits" or "licen

Re: how to get bit info

2010-06-17 Thread Stephen Hansen
On 6/17/10 1:29 PM, Grant Edwards wrote: > On 2010-06-17, Stephen Hansen wrote: > > BIT_1 = 1 << 0 > BIT_2 = 1 << 1 > > ... > >> Basically, those BIT_X lines are creating numbers which have *only* the >> specified bit set. Then you do "byte & BIT_X", and that will return 0 if >> the byt

Re: Running a program from another program.

2010-06-17 Thread Laurent Verweijen
Op donderdag 17-06-2010 om 23:09 uur [tijdzone +0200], schreef Laurent Verweijen: > Op donderdag 17-06-2010 om 13:48 uur [tijdzone -0700], schreef Stephen > Hansen: > > On 6/17/10 1:42 PM, Laurent Verweijen wrote: > > > I tried putting what Ian Kelly said in my code, by it doesn't work for > > >

Re: Running a program from another program.

2010-06-17 Thread Stephen Hansen
On 6/17/10 2:09 PM, Laurent Verweijen wrote: > It just gives me an empty string. > > Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) > [GCC 4.4.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. from asynchronous import * p = Popen(["python", "increme

Re: Py_single_input and the side-effects...

2010-06-17 Thread Mark Lawrence
On 05/06/2010 11:11, Gabriel Genellina wrote: On 31 mayo, 08:11, moerchendiser2k3 wrote: you are right, Python still holds the last reference. I just set a dummy and thats it :) Can you tell me where did you get the information from? Do you mean the _ variable? It's in the tutorial: http://

Re: Processing HTML form

2010-06-17 Thread Benjamin Kaplan
On Thu, Jun 17, 2010 at 1:15 PM, Bradley Hintze wrote: > I apologize in advance for my lack of knowledge, I really do not know. > I would guess server but I quite honestly I am not clear what an 'HTTP > client' or 'HTTP server' refers to. I am running a webpage and am > serving it locally for the

Re: Processing HTML form

2010-06-17 Thread Bradley Hintze
I am on Mac OSX 10.6, server is apache. If I do get this working we will move it to the main server which also serves apache, i believe.I dont think I want a whole new server, I'd like to serve from the apache framework if possible. On Thu, Jun 17, 2010 at 4:34 PM, Grant Edwards wrote: > On 2010-

Re: Running a program from another program.

2010-06-17 Thread Laurent Verweijen
Op donderdag 17-06-2010 om 13:48 uur [tijdzone -0700], schreef Stephen Hansen: > On 6/17/10 1:42 PM, Laurent Verweijen wrote: > > I tried putting what Ian Kelly said in my code, by it doesn't work for > > me. > > > > Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) > > [GCC 4.4.3] on linux2 > >

Re: Running a program from another program.

2010-06-17 Thread Stephen Hansen
On 6/17/10 1:42 PM, Laurent Verweijen wrote: > I tried putting what Ian Kelly said in my code, by it doesn't work for > me. > > Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) > [GCC 4.4.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. import os imp

Re: Running a program from another program.

2010-06-17 Thread Laurent Verweijen
Op donderdag 17-06-2010 om 13:01 uur [tijdzone -0700], schreef Stephen Hansen: > On 6/17/10 12:13 PM, Laurent Verweijen wrote: > > How do I make sure the inputstream stays open after the first call to > > communicate? > > This was just asked a few days ago in different words-- check out the > thr

Re: The inverse of .join

2010-06-17 Thread Robert Kern
On 6/17/10 3:03 PM, Neil Cerutti wrote: On 2010-06-17, Robert Kern wrote: On 6/17/10 2:08 PM, Neil Cerutti wrote: On 2010-06-17, Ian Kelly wrote: On Thu, Jun 17, 2010 at 11:45 AM, Neil Cerutti wrote: What's the best way to do the inverse operation of the .join function? Use the str.sp

Re: Processing HTML form

2010-06-17 Thread Grant Edwards
On 2010-06-17, Bradley Hintze wrote: > I apologize in advance for my lack of knowledge, I really do not know. > I would guess server but I quite honestly I am not clear what an 'HTTP > client' or 'HTTP server' refers to. I am running a webpage and am > serving it locally for the moment. I have a

Python distributing localization files

2010-06-17 Thread Gabriele Lanaro
Hi, I want to localize my application (a pygtk gui app), what's the best way to distribute and install localization files? I'm currently using `distribute` to package it. Any suggestion? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get bit info

2010-06-17 Thread Grant Edwards
On 2010-06-17, Stephen Hansen wrote: BIT_1 = 1 << 0 BIT_2 = 1 << 1 ... > Basically, those BIT_X lines are creating numbers which have *only* the > specified bit set. Then you do "byte & BIT_X", and that will return 0 if > the byte doesn't have the specified bit in it. You can then set

Re: List of lists surprising behaviour

2010-06-17 Thread J Kenneth King
candide writes: > Let's the following code : > t=[[0]*2]*3 t > [[0, 0], [0, 0], [0, 0]] t[0][0]=1 t > [[1, 0], [1, 0], [1, 0]] > > Rather surprising, isn't it ? Not at all, actually. I'd be surprised if the multiplication operator was aware of object constructors. Even arr

Re: Processing HTML form

2010-06-17 Thread Marco Nawijn
On 17 jun, 21:11, Bradley Hintze wrote: > Hi, > > I am a newbie to anything web related, I know a bit  of HTML though. > I've been programing in python for a year or so so I know the language > at an intermediate level. I am wondering if its possible to get info > from an HTML form and pass it to

Re: Processing HTML form

2010-06-17 Thread Bradley Hintze
I apologize in advance for my lack of knowledge, I really do not know. I would guess server but I quite honestly I am not clear what an 'HTTP client' or 'HTTP server' refers to. I am running a webpage and am serving it locally for the moment. I have a program that is already written in Python. I wa

Re: how to get bit info

2010-06-17 Thread Irmen de Jong
On 17-6-2010 21:51, Back9 wrote: Hi, I have one byte data and want to know each bit info, I mean how I can know each bit is set or not? TIA Use bitwise and, for instance, to see if the third bit is set: byte = 0b if byte & 0b0100: print "bit is set" -irmen -- http://mail

Re: how to get bit info

2010-06-17 Thread Stephen Hansen
On 6/17/10 12:51 PM, Back9 wrote: > I have one byte data and want to know each bit info, > I mean how I can know each bit is set or not? >>> BIT_1 = 1 << 0 >>> BIT_2 = 1 << 1 >>> BIT_3 = 1 << 2 >>> BIT_4 = 1 << 3 >>> BIT_5 = 1 << 4 >>> BIT_6 = 1 << 5 >>> BIT_7 = 1 << 6 >>> BIT_8 = 1 << 7 >>> byte

Re: how to get bit info

2010-06-17 Thread Tim Lesher
On Jun 17, 3:51 pm, Back9 wrote: > Hi, > > I have one byte data and want to know each bit info, > I mean how I can know each bit is set or not? You want the bitwise-and operator, &. For example, to check the least significant bit, bitwise-and with 1: >>> 3 & 1 1 >>> 2 & 1 0 -- http://mail.pyth

Re: Serializing functions

2010-06-17 Thread Aaron Staley
I am one of the developer's of PiCloud. To answer your question, we wrote a custom subclass of Pickler to pickle functions. As Robert pointed out, the library is LGPL, so you can see (and use) the source code. I also presented the details on a poster at PyCon 2010. You can see it here: http://b

Re: how to get bit info

2010-06-17 Thread Laurent Verweijen
Op donderdag 17-06-2010 om 12:51 uur [tijdzone -0700], schreef Back9: > Hi, > > I have one byte data and want to know each bit info, > I mean how I can know each bit is set or not? > > TIA def bitset(x, n): """Return whether nth bit of x was set""" return bool(x & (1 << n)) -- http://mail.pyt

Re: The inverse of .join

2010-06-17 Thread Neil Cerutti
On 2010-06-17, Robert Kern wrote: > On 6/17/10 2:08 PM, Neil Cerutti wrote: >> On 2010-06-17, Ian Kelly wrote: >>> On Thu, Jun 17, 2010 at 11:45 AM, Neil Cerutti >>> wrote: What's the best way to do the inverse operation of the .join function? >>> >>> Use the str.split method? >> >> s

Possible to reach back in stack and grab calling function's locals()?

2010-06-17 Thread python
Is there an elegant way to reach back in the stack and grab the calling function's copy of locals()? I'm working on a library that does lots of textmerge operations and am looking for a way to eliminate the need for many of the calls to our library to have to explictly pass locals() to our formatt

Re: Running a program from another program.

2010-06-17 Thread Stephen Hansen
On 6/17/10 12:13 PM, Laurent Verweijen wrote: > How do I make sure the inputstream stays open after the first call to > communicate? This was just asked a few days ago in different words-- check out the thread, a couple solutions are offered. In short, you need to make stdin/stdout non-blocking:

Re: The inverse of .join

2010-06-17 Thread Stephen Hansen
On 6/17/10 12:44 PM, MRAB wrote: > Neil Cerutti wrote: >> On 2010-06-17, Ian Kelly wrote: >>> On Thu, Jun 17, 2010 at 11:45 AM, Neil Cerutti >>> wrote: What's the best way to do the inverse operation of the .join function? >>> Use the str.split method? >> >> split is perfect except for

Re: The inverse of .join

2010-06-17 Thread Robert Kern
On 6/17/10 2:08 PM, Neil Cerutti wrote: On 2010-06-17, Ian Kelly wrote: On Thu, Jun 17, 2010 at 11:45 AM, Neil Cerutti wrote: What's the best way to do the inverse operation of the .join function? Use the str.split method? split is perfect except for what happens with an empty string.

Re: Processing HTML form

2010-06-17 Thread Grant Edwards
On 2010-06-17, Bradley Hintze wrote: > I am a newbie to anything web related, I know a bit of HTML though. > I've been programing in python for a year or so so I know the language > at an intermediate level. I am wondering if its possible to get info > from an HTML form and pass it to my python

Re: The inverse of .join

2010-06-17 Thread MRAB
Neil Cerutti wrote: On 2010-06-17, Ian Kelly wrote: On Thu, Jun 17, 2010 at 11:45 AM, Neil Cerutti wrote: What's the best way to do the inverse operation of the .join function? Use the str.split method? split is perfect except for what happens with an empty string. I see what you mean.

* Black-Jewish History FAQ - Is The Secret Relations hip between blacks and jews a “hate literature”? *

2010-06-17 Thread nanothermite911fbibustards
http://www.blacksandjews.com/JewsBlackHolocaust.html Jews and the Black Holocaust - What are the Issues? Blacks and Jews have been involved in a re-evaluation of their current and historical relationship. Events of the past several years have raised both tensions and the level of rhetoric coming

Black-Jewish History FAQ - Is The Secret Relationshi p between blacks and jews a “hate literature”?

2010-06-17 Thread nanothermite911fbibustards
http://www.blacksandjews.com/JewsBlackHolocaust.html Blacks and Jews have been involved in a re-evaluation of their current and historical relationship. Events of the past several years have raised both tensions and the level of rhetoric coming from all sides. The Secret Relationship Between Black

Running a program from another program.

2010-06-17 Thread Laurent Verweijen
I have a program called increment.py as follows: #!/usr/bin/python n = 0 while True: n = int(raw_input(n)) + 1 This is probably very easy to understand, but I want to run this program from another python program. Below is an attempt

Processing HTML form

2010-06-17 Thread Bradley Hintze
Hi, I am a newbie to anything web related, I know a bit of HTML though. I've been programing in python for a year or so so I know the language at an intermediate level. I am wondering if its possible to get info from an HTML form and pass it to my python code and return a page based on the code

Re: The inverse of .join

2010-06-17 Thread Neil Cerutti
On 2010-06-17, Ian Kelly wrote: > On Thu, Jun 17, 2010 at 11:45 AM, Neil Cerutti > wrote: >> What's the best way to do the inverse operation of the .join >> function? > > Use the str.split method? split is perfect except for what happens with an empty string. -- Neil Cerutti -- http://mail.py

Import fails (newbie)

2010-06-17 Thread mhorlick
Hello, I'm a newbie and I have a small problem. After invoking IDLE --> Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import os,glob >>> os.chdir('D:/Python_Programs') >>> print(os.getcwd(

Re: super() woes (n00b)

2010-06-17 Thread Ethan Furman
Deadly Dirk wrote: On Thu, 17 Jun 2010 13:48:45 -0400, J. Cliff Dyer wrote: super gives you an instantiated version of the super class, which means that you don't have to explicitly send self to any methods you call on it. So use `super().__init__()` instead. Thanks. Interestingly enough, it

Re: Python OpenSSL library

2010-06-17 Thread geremy condra
On Thu, Jun 17, 2010 at 10:49 AM, Antoine Pitrou wrote: > On Tue, 15 Jun 2010 19:56:46 -0700 > John Nagle wrote: >> >>      http://bugs.python.org/issue1589 > [...] >> >> The typical Python user will expect SSL checking for URL opening >> to behave like a browser does. They won't be up to speed o

Re: super() woes (n00b)

2010-06-17 Thread Benjamin Kaplan
On Thu, Jun 17, 2010 at 10:51 AM, Matteo Landi wrote: > I found few error in your code: > 1 the constructor of P class seems to be wrong: > class P(object): > ...    def __init__(self): > ...        print("I am a member of class P") > ... > > 2 super() works with new style classes, i.e.  the

Re: super() woes (n00b)

2010-06-17 Thread Deadly Dirk
On Thu, 17 Jun 2010 13:48:45 -0400, J. Cliff Dyer wrote: > super gives you an instantiated version of the super class, which means > that you don't have to explicitly send self to any methods you call on > it. > > So use `super().__init__()` instead. Thanks. Interestingly enough, it works in Pyt

Re: The inverse of .join

2010-06-17 Thread Ian Kelly
On Thu, Jun 17, 2010 at 11:45 AM, Neil Cerutti wrote: > What's the best way to do the inverse operation of the .join > function? Use the str.split method? -- http://mail.python.org/mailman/listinfo/python-list

Re: The inverse of .join

2010-06-17 Thread MRAB
Neil Cerutti wrote: What's the best way to do the inverse operation of the .join function? .split, possibly, although there will be problems if the string contains other occurrences of the separator. -- http://mail.python.org/mailman/listinfo/python-list

Re: super() woes (n00b)

2010-06-17 Thread Matteo Landi
I found few error in your code: 1 the constructor of P class seems to be wrong: >>> class P(object): ...def __init__(self): ...print("I am a member of class P") ... 2 super() works with new style classes, i.e. the ones which inherit from 'object' >>> class P: ...def __init__(__c

Re: The inverse of .join

2010-06-17 Thread nn
Neil Cerutti wrote: > What's the best way to do the inverse operation of the .join > function? > > -- > Neil Cerutti split -- http://mail.python.org/mailman/listinfo/python-list

The inverse of .join

2010-06-17 Thread Neil Cerutti
What's the best way to do the inverse operation of the .join function? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: super() woes (n00b)

2010-06-17 Thread J. Cliff Dyer
On Thu, 2010-06-17 at 16:36 +, Deadly Dirk wrote: > I cannot get right the super() function: > Python 3.1.1+ (r311:74480, Nov 2 2009, 14:49:22) > [GCC 4.4.1] on linux2 > Type "copyright", "credits" or "license()" for more information. > No Subprocess > >>> class P: > def __init_

Re: Python OpenSSL library

2010-06-17 Thread Antoine Pitrou
On Tue, 15 Jun 2010 19:56:46 -0700 John Nagle wrote: > > http://bugs.python.org/issue1589 [...] > > The typical Python user will expect SSL checking for URL opening > to behave like a browser does. They won't be up to speed on the > internal mechanics of X.509 certificates. The default cas

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Stephen Hansen
On 6/17/10 10:22 AM, Jack Diederich wrote: > On Thu, Jun 17, 2010 at 12:58 PM, Stephen Hansen >> It explicitly states later its entirely OK to import classes. It never >> says anything else directly, except in the example given, it shows you >> importing a constant. So, its giving implicit approval

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Ethan Furman
Jack Diederich wrote: You want to import a name that is itself a namespace; preferably a module or package and sometimes a class. Importing constants can lead to trouble. ex/ from settings import DEBUG if DEBUG: log('debug is on!') The value of the flag gets fetched at import time. If code i

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Jack Diederich
On Thu, Jun 17, 2010 at 12:58 PM, Stephen Hansen wrote: > On 6/17/10 10:01 AM, Ethan Furman wrote: >> Stephen Hansen wrote: >>> On 6/17/10 9:12 AM, pyt...@bdurham.com wrote: >>> >>> Now, this is all IMHO: the style guide does not define any 'guidelines' >>> on this, except that its okay to use "fr

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Ethan Furman
Stephen Hansen wrote: On 6/17/10 10:01 AM, Ethan Furman wrote: Stephen Hansen wrote: On 6/17/10 9:12 AM, pyt...@bdurham.com wrote: Now, this is all IMHO: the style guide does not define any 'guidelines' on this, except that its okay to use "from ... import ..." to pull in classes and (implicit

Re: Overriding "__setattr__" of a module - possible?

2010-06-17 Thread John Nagle
On 6/17/2010 12:25 AM, Gabriel Genellina wrote: Note the fake.g(8) call: __setattr__ wasn't called. If the OP wants to trace assignments to global variables, this becomes a problem. A function defined in a module holds a reference to the module's __dict__ in its func_globals attribute. Getting a

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Stephen Hansen
On 6/17/10 10:01 AM, Ethan Furman wrote: > Stephen Hansen wrote: >> On 6/17/10 9:12 AM, pyt...@bdurham.com wrote: >> >> Now, this is all IMHO: the style guide does not define any 'guidelines' >> on this, except that its okay to use "from ... import ..." to pull in >> classes and (implicitly) consta

Re: super() woes (n00b)

2010-06-17 Thread Deadly Dirk
On Thu, 17 Jun 2010 16:36:10 +, Deadly Dirk wrote: > I cannot get right the super() function: Python 3.1.1+ (r311:74480, Nov > 2 2009, 14:49:22) [GCC 4.4.1] on linux2 > Type "copyright", "credits" or "license()" for more information. No > Subprocess class P: > def __init__(

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Ethan Furman
Stephen Hansen wrote: On 6/17/10 9:12 AM, pyt...@bdurham.com wrote: Now, this is all IMHO: the style guide does not define any 'guidelines' on this, except that its okay to use "from ... import ..." to pull in classes and (implicitly) constants, and despite how the rules say 'one module per line

super() woes (n00b)

2010-06-17 Thread Deadly Dirk
I cannot get right the super() function: Python 3.1.1+ (r311:74480, Nov 2 2009, 14:49:22) [GCC 4.4.1] on linux2 Type "copyright", "credits" or "license()" for more information. No Subprocess >>> class P: def __init__(__class__,self): print("I am a member of class P")

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Stephen Hansen
On 6/17/10 9:12 AM, pyt...@bdurham.com wrote: > Are there any efficiency or style guidelines regarding the choice > of "import " vs. "from import , ..."? There are no legitimate efficiency issues. In theory, module.blah is slightly slower then blah, but that "slightly" is largely irrelevant in gl

Re: Serializing functions

2010-06-17 Thread Robert Kern
On 6/17/10 8:23 AM, Matteo Landi wrote: Some weeks ago, here on the mailing list I read about picloud[1], a python library used for cloud-computing; I was impressed by its simplicity, here is an example: import cloud def square(x): ... return x * x cloud.call(square, 10) cloud.result() 100

Re: gui doubt

2010-06-17 Thread Robert Kern
On 6/17/10 10:38 AM, Tim Chase wrote: On 06/17/2010 10:07 AM, Andreas Tawn wrote: On 6/16/10 10:40 PM, madhuri vio wrote: which performs the transcription of dna to rna [snip] Seems like a simple problem... or am I missing something? def translate(): return "dna".replace("d", "r") And I un

Re: Upgrading from Python 2.6.5 w.r.t. matplotlib/numpy?

2010-06-17 Thread Robert Kern
On 6/17/10 12:24 AM, Stephen Hansen wrote: On 6/16/10 10:18 PM, Mark Lawrence wrote: I'm like to go direct to Python 3.1 if possible, but if necessary I'll happily use Python 2.7 as an interim measure. However I'm uncertain as to the status of matplotlib and its dependency on numpy. I've tried

Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread python
Are there any efficiency or style guidelines regarding the choice of "import " vs. "from import , ..."? If one only needs to import a few names from a module, are there specific benefits to explictly importing these names? My understanding is that both forms of the import command require the ent

Re: Serializing functions

2010-06-17 Thread Andreas Löscher
Am Donnerstag, den 17.06.2010, 18:03 +0200 schrieb Andreas Löscher: > Am Donnerstag, den 17.06.2010, 08:18 -0700 schrieb Paul Rubin: > > Matteo Landi writes: > > > I could be wrong, but it seems functions are not marshable objects, is > > > it right? > > > > Hmm, you're right, you can marshal cod

Re: Serializing functions

2010-06-17 Thread Andreas Löscher
Am Donnerstag, den 17.06.2010, 08:18 -0700 schrieb Paul Rubin: > Matteo Landi writes: > > I could be wrong, but it seems functions are not marshable objects, is > > it right? > > Hmm, you're right, you can marshal code objects, but you can't marshal a > function directly. It's been a while since

  1   2   >