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

2010-06-17 Thread Gabriel Genellina
En Wed, 16 Jun 2010 19:56:39 -0300, Ian Kelly escribió: On Wed, Jun 16, 2010 at 3:38 PM, John Nagle wrote: That just leaves things in a state where even "sys" and "import" are undefined. Say what? It works fine for me. import proxy_mod proxy_mod.f() 1 proxy_mod.a = 2 setting a=2 pr

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

2010-06-17 Thread Alf P. Steinbach
* Gabriel Genellina, on 17.06.2010 09:25: En Wed, 16 Jun 2010 19:56:39 -0300, Ian Kelly escribió: On Wed, Jun 16, 2010 at 3:38 PM, John Nagle wrote: That just leaves things in a state where even "sys" and "import" are undefined. Say what? It works fine for me. import proxy_mod proxy_mod.

Re: basic doubt

2010-06-17 Thread Gabriel Genellina
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() han1 = open("mycorna.fasta","wU") han1.close()

Communicating with a program using subprocess

2010-06-17 Thread Laurent Verweijen
I have a file called increment.py as follows: #!/usr/bin/python n = 0 while True: n = int(raw_input(n)) + 1 This is easy to understand, but I want to pipe it's input/output by another python program. (I will show what I

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

2010-06-17 Thread Gabriel Genellina
En Thu, 17 Jun 2010 04:52:48 -0300, Alf P. Steinbach escribió: * Gabriel Genellina, on 17.06.2010 09:25: En Wed, 16 Jun 2010 19:56:39 -0300, Ian Kelly escribió: On Wed, Jun 16, 2010 at 3:38 PM, John Nagle wrote: That just leaves things in a state where even "sys" and "import" are undefi

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

2010-06-17 Thread Fuzzyman
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 statement in 2.x   > bypasses sys.stdout.write; Wha

List of lists surprising behaviour

2010-06-17 Thread candide
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 ? So I suppose all the subarrays reférence the same array : >>> id(t[0]), id(t[1]), id(t[2]) (3077445996L, 3077445996L, 3077445996L) >>> So what

Re: How do I fix this test so it runs on Windows? (it uses tzset)

2010-06-17 Thread Chris Withers
Nobody wrote: On Wed, 16 Jun 2010 16:30:02 +0100, Chris Withers wrote: I'd like to make test_non_gmt_timezone at the bottom of https://... run on Windows, any suggestions? MSVCRT has _tzset(), which understands the TZ environment variable. http://msdn.microsoft.com/en-us/library/90s5c885%28

Re: List of lists surprising behaviour

2010-06-17 Thread Lie Ryan
On 06/17/10 20:21, candide wrote: > 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 ? So I suppose all the subarrays reférence > the same array : > id(t[0]), id(t[1]), id(t[2]) >

Re: List of lists surprising behaviour

2010-06-17 Thread Matteo Landi
Yes you are. List comprehension makes you create list of lists without reference-sharing. You should also find a recipe about that on the python cookbook. On Thu, Jun 17, 2010 at 12:21 PM, candide wrote: > Let's the following code : > t=[[0]*2]*3 t > [[0, 0], [0, 0], [0, 0]] t[0][0

Could not import external source folder in Pydev

2010-06-17 Thread Narendran
Env info: Python version: '2.6.5 (r265:79063, Apr 16 2010, 13:57:41) \n[GCC 4.4.3]' Eclipse version: Version: 3.5.2 Build id: M20100211-1343 PyDev version: PyDev for Eclipse 1.5.7.2010050621 org.python.pydev.feature.feature.group OS: Ubuntu 10.04 Problem: I am trying to develop a module us

Serializing functions

2010-06-17 Thread Matteo Landi
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 So, I tried to figure out how to

Re: a +b ?

2010-06-17 Thread David Robinow
On Wed, Jun 16, 2010 at 11:34 PM, Aahz wrote: > In article , > James Mills   wrote: ... >>What in particular do you _not_ enjoy about using map/reduce (and >>possibly other functional features of the Python programing language) ? > > map() never felt particularly Pythonic, especially the way it wo

Re: GUIs - A Modest Proposal

2010-06-17 Thread Grant Edwards
On 2010-06-16, Matt wrote: > On 06/05/2010 09:22 PM, ant wrote: > >> PyQt is tied to one platform. > > > Several posters have asked for support for or clarification of this > claim of yours. Let me guess... The one platform it's tied to is Qt? -- Grant Edwards grant.b.edwards

Re: List of lists surprising behaviour

2010-06-17 Thread Boris Borcic
candide wrote: So what is the right way to initialize to 0 a 2D array ? Is that way correct : >>> t=[[0 for _ in range(2)] for _ in range(3)] That's overkill :) You can skip the inner loop by using a list display, eg t=[[0,0] for _ in range(3)] It seems there is no more trouble now :

Re: Serializing functions

2010-06-17 Thread Bruno Desthuilliers
Matteo Landi a écrit : 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 So, I tried to f

Goals,watch the World Cup .. mondial 2010 Online

2010-06-17 Thread mondial worldcup2010
Goals,watch the World Cup .. mondial 2010 Online http://www.echance.info/fifa2010 http://www.echance.info/sopcast-en http://www.echance.info/sopcast-ar -- http://mail.python.org/mailman/listinfo/python-list

كيف تحصل على لاب توب جائزة

2010-06-17 Thread mondial worldcup2010
How to get a laptop gift http://echance.info/laptop.htm -- http://mail.python.org/mailman/listinfo/python-list

Re: Serializing functions

2010-06-17 Thread Paul Rubin
Matteo Landi writes: > If you try and pickle a function, it is not pickled as a whole, > indeed, once you unpickle it, it will raise an exception telling you > that the target function was not found in the current module. > > So I'm here, with nothing in my hands; how would you implement this? Us

Re: gui doubt

2010-06-17 Thread Tim Chase
On 06/17/2010 01:04 AM, Stephen Hansen wrote: On 6/16/10 10:40 PM, madhuri vio wrote: if i want to create a button which performs the transcription of dna to rna using tkinter in a gui... can u give me the method... You can not possibly be serious. Oh, it's not that bad [dna2rna

Re: Serializing functions

2010-06-17 Thread Matteo Landi
On Thu, 2010-06-17 at 07:37 -0700, Paul Rubin wrote: > Matteo Landi writes: > > If you try and pickle a function, it is not pickled as a whole, > > indeed, once you unpickle it, it will raise an exception telling you > > that the target function was not found in the current module. > > > > So I'm

RE: gui doubt

2010-06-17 Thread Andreas Tawn
> On 06/17/2010 01:04 AM, Stephen Hansen wrote: > > On 6/16/10 10:40 PM, madhuri vio wrote: > >> if i want to create a button > >> which performs the transcription of dna to rna > >> using tkinter in a gui... > >> can u give me the method... > > > > You can not possibly be serious. > > Oh, it's no

Re: Serializing functions

2010-06-17 Thread 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 I've used marshal and I forgot how it works. You might be able to concoct

Re: Serializing functions

2010-06-17 Thread Matteo Landi
On Thu, 2010-06-17 at 07:37 -0700, Paul Rubin wrote: > Matteo Landi writes: > > If you try and pickle a function, it is not pickled as a whole, > > indeed, once you unpickle it, it will raise an exception telling you > > that the target function was not found in the current module. > > > > So I'm

Re: gui doubt

2010-06-17 Thread Bruno Desthuilliers
Andreas Tawn a écrit : On 06/17/2010 01:04 AM, Stephen Hansen wrote: On 6/16/10 10:40 PM, madhuri vio wrote: if i want to create a button which performs the transcription of dna to rna (snip the GUI part) Seems like a simple problem... or am I missing something? def translate(): return

Re: Serializing functions

2010-06-17 Thread Stephen Hansen
On 6/17/10 6:23 AM, Matteo Landi wrote: > itself. If you try and pickle a function, it is not pickled as a whole, > indeed, once you unpickle it, it will raise an exception telling you > that the target function was not found in the current module. You can pickle functions-- and classes, instances

Re: gui doubt

2010-06-17 Thread Tim Chase
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 understand people in bioinformatics g

Re: gui doubt

2010-06-17 Thread Steven W. Orr
On 06/17/10 01:40, quoth madhuri vio: > if i want to create a button > which performs the transcription of dna to rna > using tkinter in a gui... > can u give me the method... > > -- > madhuri :) > Dear Madasahatter. You need to read the description below on how to properly implement and use th

Re: Serializing functions

2010-06-17 Thread Matteo Landi
On Thu, 2010-06-17 at 08:31 -0700, Stephen Hansen wrote: > On 6/17/10 6:23 AM, Matteo Landi wrote: > > itself. If you try and pickle a function, it is not pickled as a whole, > > indeed, once you unpickle it, it will raise an exception telling you > > that the target function was not found in the c

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

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

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: 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

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: 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: 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

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 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

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 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: 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 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: 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
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 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: 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: 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_

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: 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

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 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: 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: 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: 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: 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 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

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: 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

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

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

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

* 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

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.

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 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: 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: 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:

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: 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

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: 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 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: 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 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: 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: 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: 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: 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

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: 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

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: 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: 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: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: 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: 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: 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: 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: 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: 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 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

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 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

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: 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

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: 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

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 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: 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

  1   2   >