how to use variable to substitute class's variable?

2011-03-17 Thread Hans
I have things like: file1: class aaa: def __init__(self): self.variable1='a1' self.variable2='a2' self.varable3='a3' in main proc: import file1 b=file1.aaa() c={'variable1':'value1','variable2':'value2','variable3':'value3'} for key in c: b.key=c[key] >>>P

Re: how to use variable to substitute class's variable?

2011-03-17 Thread Benjamin Kaplan
On Thu, Mar 17, 2011 at 3:31 AM, Hans wrote: > I have things like: > file1: > class aaa: >    def __init__(self): >        self.variable1='a1' >        self.variable2='a2' >        self.varable3='a3' > > > in main proc: > import file1 > b=file1.aaa() > c={'variable1':'value1','variable2':'value2',

newbie question (latex Error in plotting)

2011-03-17 Thread Sachin Kumar Sharma
Hi, After computation of few array, when I am using plot(x,y) command I get following error 'latex' is not recognized as an internal or external command, operable program or batch file. ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid

Re: os.path.walk() to get full path of all files

2011-03-17 Thread Laurent Claessens
file_list = [] for root, _, filenames in os.walk(root_path): for filename in filenames: file_list.append(os.path.join(root, filename)) What does the notation "_" stands for ? Is it a sort of /dev/null ? I know that in the terminal it represents the last printed text. Laurent

Re: os.path.walk() to get full path of all files

2011-03-17 Thread Tim Golden
On 17/03/2011 08:58, Laurent Claessens wrote: file_list = [] for root, _, filenames in os.walk(root_path): for filename in filenames: file_list.append(os.path.join(root, filename)) What does the notation "_" stands for ? Is it a sort of /dev/null ? I know that in the terminal it represents

Re: os.path.walk() to get full path of all files

2011-03-17 Thread Jussi Piitulainen
Laurent Claessens writes: > > file_list = [] > > for root, _, filenames in os.walk(root_path): > > for filename in filenames: > > file_list.append(os.path.join(root, filename)) > > What does the notation "_" stands for ? Is it a sort of /dev/null ? >>> x, _, y = 1, "hukairs",

Re: organizing many python scripts, in a large corporate environment.

2011-03-17 Thread eryksun ()
On Wednesday, March 16, 2011 9:03:19 PM UTC-4, bukzor wrote: > > I finally understand. You mean something along the lines of `kde- > config`: an executable to help figure out the configuration at > runtime. This requires either installation or control of the $PATH > environment variable to work wel

PDF To Postscript

2011-03-17 Thread Adam Tauno Williams
PyPDF (and others) provide a very nice mechanism for creating and manipulating PDF documents. Is there any *Python* module or technique to turn a PDF document into Postscript [to print, for example]? -- http://mail.python.org/mailman/listinfo/python-list

Coding and Decoding in Python

2011-03-17 Thread Wanderer
I have a dll that to communicate with I need to send numeric codes. So I created a dictionary. It works in one direction in that I can address the key and get the value. But when the program returns the value I can't get the key. This code is very simple and I could use a list and the index except

Re: Coding and Decoding in Python

2011-03-17 Thread Mel
Wanderer wrote: > I have a dll that to communicate with I need to send numeric codes. So > I created a dictionary. It works in one direction in that I can > address the key and get the value. But when the program returns the > value I can't get the key. This code is very simple and I could use a >

Re: PEP for module naming conventions

2011-03-17 Thread Mel
Tim Johnson wrote: > I need to be better informed on naming conventions for modules. For > instance, I need to create a new module and I want to make sure that > the module name will not conflict with any future or current python > system module names. COBOL in its golden years had a practice th

Re: enhanced map function

2011-03-17 Thread Patrick
Steven, Thanks for the info of itertools. It is a great start for me. Overall, I agree with you that it is really the user data needs to be sorted out. However, novice users may need help on certain patterns such as "a=[1,[2,3],4], b=[5,[6,7,8],9,10]". We could just draw our line saying that simil

Re: Coding and Decoding in Python

2011-03-17 Thread John Gordon
In <2f4a08df-55ea-4a4e-9cc0-24e6b9f81...@f15g2000pro.googlegroups.com> Wanderer writes: > But when the program returns the value I can't get the key. What happens when two keys have the same value? How would you know which key to return? In your sample code all the values are different, but s

Re: PDF To Postscript

2011-03-17 Thread Chris Rebert
On Thu, Mar 17, 2011 at 6:55 AM, Adam Tauno Williams wrote: > PyPDF (and others) provide a very nice mechanism for creating and > manipulating PDF documents.  Is there any *Python* module or technique > to turn a PDF document into Postscript [to print, for example]? Considering your post is curre

Re: Coding and Decoding in Python

2011-03-17 Thread Wanderer
On Mar 17, 11:44 am, John Gordon wrote: > In <2f4a08df-55ea-4a4e-9cc0-24e6b9f81...@f15g2000pro.googlegroups.com> > Wanderer writes: > > > But when the program returns the value I can't get the key. > > What happens when two keys have the same value?  How would you know which > key to return? > >

Re: Coding and Decoding in Python

2011-03-17 Thread John Gordon
In <7546e476-d10f-46e5-8b20-5d9b42345...@r6g2000vbo.googlegroups.com> Wanderer writes: > I guess two keys having the same value is why dictionaries don't > return keys for values, but this is a code. Each value has a unique > meaning to both sender and receiver. The text part is for making the >

Re: PEP for module naming conventions

2011-03-17 Thread eryksun ()
On Friday, March 11, 2011 4:52:57 PM UTC-5, Tim Johnson wrote: > I need to be better informed on naming conventions for modules. For > instance, I need to create a new module and I want to make sure that > the module name will not conflict with any future or current python > system module names.

value of pi and 22/7

2011-03-17 Thread kracekumar ramaraju
I tried the following >>> 22/7.0 3.1428571428571428 >>> import math >>> math.pi 3.1415926535897931 >>> Why is the difference is so much ?is pi =22/7 or something ? -- winning regards kracekumar -- http://mail.python.org/mailman/listinfo/python-list

Re: value of pi and 22/7

2011-03-17 Thread Wolfgang Rohdewald
On Donnerstag 17 März 2011, kracekumar ramaraju wrote: > >>> 22/7.0 > > 3.1428571428571428 > > >>> import math > >>> math.pi > > 3.1415926535897931 > > Why is the difference is so much ?is pi =22/7 or something ? https://secure.wikimedia.org/wikipedia/en/wiki/Pi -- Wolfgang -- http://mail.

Re: value of pi and 22/7

2011-03-17 Thread Ian Kelly
On Thu, Mar 17, 2011 at 10:46 AM, kracekumar ramaraju wrote: > I tried the following 22/7.0 > 3.1428571428571428 import math math.pi > 3.1415926535897931 > > > Why is the difference is so much ?is pi =22/7 or something ? Pi is not 22/7. That is just a commonly-used approximat

Re: value of pi and 22/7

2011-03-17 Thread Ian Kelly
On Thu, Mar 17, 2011 at 10:57 AM, Ian Kelly wrote: > On Thu, Mar 17, 2011 at 10:46 AM, kracekumar ramaraju > wrote: >> I tried the following > 22/7.0 >> 3.1428571428571428 > import math > math.pi >> 3.1415926535897931 > >> >> >> Why is the difference is so much ?is pi =22/7 or som

Re: PDF To Postscript

2011-03-17 Thread Adam Tauno Williams
On Thu, 2011-03-17 at 08:53 -0700, Chris Rebert wrote: > On Thu, Mar 17, 2011 at 6:55 AM, Adam Tauno Williams > wrote: > > PyPDF (and others) provide a very nice mechanism for creating and > > manipulating PDF documents. Is there any *Python* module or technique > > to turn a PDF document into Po

Re: value of pi and 22/7

2011-03-17 Thread Kee Nethery
My favorite approximation is: 355/113 (visualize 113355 split into two 113 355 and then do the division). The first 6 decimal places are the same. 3.141592920353982 = 355/113 vs 3.1415926535897931 Kee Nethery -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP for module naming conventions

2011-03-17 Thread Jonathan Gossage
I have found this approach problematic if you have packages separately developed and maintained in different directory trees, resulting in more than one PYTHONPATH entry with the same root metapackage name. What happens is that only the first entry in the PYTHONPATH containing the metapackage name

Re: value of pi and 22/7

2011-03-17 Thread Jeffrey Gaynor
(pulls out doctorate in Math.) Take a circle and measure its diameter, then circumference (coffee cans and string are helpful). Then pi = Circumference/diameter approximating that is hard. It turns out that even though it *looks* like a nice fraction, the value that results is not (fractions of

Re: value of pi and 22/7

2011-03-17 Thread Ian Kelly
On Thu, Mar 17, 2011 at 11:36 AM, Jeffrey Gaynor wrote: > There are fun math questions, for instance, is there a run of a million 1's > someplace in the decimal expansion of pi? Maybe so, but we just don't know, > since we've only computed the first trillion or so digits. Since pi is irrational

Re: value of pi and 22/7

2011-03-17 Thread Jeffrey Gaynor
There are a few long strings, but have fun yourself with the pi digit searcher: http://www.angio.net/pi/bigpi.cgi Longest string I heard of was nine 6's in a row, so search for 6 and see what you get. - Original Message - From: "Ian Kelly" To: "Jeffrey Gaynor" Cc: python-list@

Re: value of pi and 22/7

2011-03-17 Thread Rotwang
On 17/03/2011 18:49, Ian Kelly wrote: On Thu, Mar 17, 2011 at 11:36 AM, Jeffrey Gaynor wrote: There are fun math questions, for instance, is there a run of a million 1's someplace in the decimal expansion of pi? Maybe so, but we just don't know, since we've only computed the first trillion or

Re: value of pi and 22/7

2011-03-17 Thread Erik Max Francis
Jeffrey Gaynor wrote: It is the simple "fractional" look about pi vs. how hard it is to compute that drives most of the confusion about pi. The digits of pi are in effectively random order (each digit occur roughly 10% of the time), ... This is equivalent to stating that pi is normal, somethin

Re: value of pi and 22/7

2011-03-17 Thread Jabba Laci
> My favorite approximation is: 355/113  (visualize 113355 split into two 113 > 355 and then do the division). The first 6 decimal places are the same. > > 3.141592920353982 = 355/113 > vs > 3.1415926535897931 Another, rather funny, approximation of the first 15 digits of pi is to take the length

Re: ttk styles

2011-03-17 Thread Peter
No responses? Nobody with knowledge of modifying styles etc? On Mar 14, 2:08 pm, Peter wrote: > Hi I'm struggling to get a good understanding of styles as used in > ttk. I have read the tutorial section on using styles but haven't been > able to solve this problem. > > I am attempting to crea

Re: ttk styles

2011-03-17 Thread python
Peter, Sorry I can't be of much help, but I share the same interest as you. There may be some teaser info here although I can't claim to understand the technique. http://www.java2s.com/Open-Source/Python/3.1.2-Python/Demo/Demo/tkinter/ttk/notebook_closebtn.py.htm If you have any links/documentat

Re: reimport module every n seconds

2011-03-17 Thread Aahz
In article <753e9884-60eb-43cf-a647-12b29ed28...@y31g2000prd.googlegroups.com>, Santiago Caracol wrote: >>> Don't do that. =A0;-) =A0I suggest using exec instead. =A0However, I wo= >uld be >>> surprised if import worked faster than, say, JSON (more precisely, I >>> doubt that it's enough faster t

Re: ttk styles

2011-03-17 Thread Peter
Thanks for the link Malcolm, I'll have a look at it. What is particularly interesting (at first glance), is that the author has "mixed" Tkinter with ttk as it suited i.e. look at this line: f1 = tkinter.Frame(nb, background="red") If ttk was being used purely (from tkinter import *; from ttk impo

Re: ttk styles

2011-03-17 Thread Ethan Furman
Peter wrote: Thanks for the link Malcolm, I'll have a look at it. What is particularly interesting (at first glance), is that the author has "mixed" Tkinter with ttk as it suited i.e. look at this line: f1 = tkinter.Frame(nb, background="red") If ttk was being used purely (from tkinter import *

Python 3.2 Debug build

2011-03-17 Thread Willis Cheung
Hi all, I'm trying to build the debug version of Python 3.2. I downloaded the py3k folder from the python SVN. Then I opened the pcbuild.sln and tried to build the "python" project. However the build failed when I got an error from the project "pythoncore" which I think "python" depends on? The er

Re: Python 3.2 Debug build

2011-03-17 Thread Terry Reedy
On 3/17/2011 6:54 PM, Willis Cheung wrote: Hi all, I'm trying to build the debug version of Python 3.2. I downloaded the py3k folder from the python SVN. Just so you know, Python SVN is now a read-only historical arifact. Development now happens in the hg repository. If you build x.y docs, yo

Re: Coding and Decoding in Python

2011-03-17 Thread Steven D'Aprano
On Thu, 17 Mar 2011 08:07:28 -0700, Wanderer wrote: > I have a dll that to communicate with I need to send numeric codes. So I > created a dictionary. It works in one direction in that I can address > the key and get the value. But when the program returns the value I > can't get the key. If you

Re: ttk styles

2011-03-17 Thread Ned Deily
In article , Peter wrote: > No responses? Nobody with knowledge of modifying styles etc? You might also want to ask on the tkinter mailing list: http://mail.python.org/pipermail/tkinter-discuss/ -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Announce: WHIFF 1.1 Release

2011-03-17 Thread Aaron Watters
WHIFF 1.1 RELEASED WHIFF [WSGI HTTP Integrated Filesystem Frames] is a collection of support services for Python/WSGI Web applications which allows applications to be composed by "dropping" dynamic pages into container directories. This mode of development will be familiar to developers who have

Abend with cls.__repr__ = cls.__str__ on Windows.

2011-03-17 Thread J Peyret
This gives a particularly nasty abend in Windows - "Python.exe has stopped working", rather than a regular exception stack error. I've fixed it, after I figured out the cause, which took a while, but maybe someone will benefit from this. Python 2.6.5 on Windows 7. class Foo(object): pass

Re: enhanced map function

2011-03-17 Thread Steven D'Aprano
On Thu, 17 Mar 2011 08:31:28 -0700, Patrick wrote: > Steven, > > Thanks for the info of itertools. It is a great start for me. Overall, I > agree with you that it is really the user data needs to be sorted out. > However, novice users may need help on certain patterns such as > "a=[1,[2,3],4], b=

Re: how to use variable to substitute class's variable?

2011-03-17 Thread Hans
On Mar 17, 12:47 am, Benjamin Kaplan wrote: > On Thu, Mar 17, 2011 at 3:31 AM, Hans wrote: > > I have things like: > > file1: > > class aaa: > >    def __init__(self): > >        self.variable1='a1' > >        self.variable2='a2' > >        self.varable3='a3' > > > in main proc: > > import file1

Re: Fitting polynomial curve

2011-03-17 Thread Astan Chee
On Thu, Mar 17, 2011 at 5:09 PM, Terry Reedy wrote: > Look at scipy. > > -- > Thanks for the info. I realized I made some mistakes. Anyway, what I'm trying to do is in maya (python), fit selected vertices on a curve. Here is what I have so far: import maya.cmds as cmds import numpy def run_mai

Re: Python 3.2 Debug build

2011-03-17 Thread Santoso Wijaya
Looks like something tripped over whitespaces in path names for svn tools. Try checking out a working copy from the hg repository? ~/santa On Thu, Mar 17, 2011 at 3:54 PM, Willis Cheung wrote: > Hi all, > > I'm trying to build the debug version of Python 3.2. I downloaded the py3k > folder fro

Re: PostgreSQL vs MySQL

2011-03-17 Thread Aahz
In article <87bp1a3g59@benfinney.id.au>, Ben Finney wrote: >a...@pythoncraft.com (Aahz) writes: > >>>(I always recommend people to use PostgreSQL, though; which is >>>superior in almost every way, especially the C client library and the >>>wire protocol.) >> >> Can you point at a reference fo

Re: Fitting polynomial curve

2011-03-17 Thread Dan Stromberg
On Thu, Mar 17, 2011 at 5:44 PM, Astan Chee wrote: > > On Thu, Mar 17, 2011 at 5:09 PM, Terry Reedy wrote: > >> Look at scipy. >> > > Thanks for the info. I realized I made some mistakes. Anyway, what I'm > trying to do is in maya (python), fit selected vertices on a curve. Here is > what I have

Re: creating RAW sockets

2011-03-17 Thread Nobody
On Wed, 16 Mar 2011 23:50:03 -0700, moijes12 wrote: > Now,please can someone guide(as in what should I read and NOT as in > give me the code) me in decoding the IP header of packets using python > 3.0.1. The "struct" module is the usual approach for decoding binary data structures. Fields which a

Re: Abend with cls.__repr__ = cls.__str__ on Windows.

2011-03-17 Thread Terry Reedy
On 3/17/2011 8:24 PM, J Peyret wrote: This gives a particularly nasty abend in Windows - "Python.exe has stopped working", rather than a regular exception stack error. I've fixed it, after I figured out the cause, which took a while, but maybe someone will benefit from this. Python 2.6.5 on Win

Re: Abend with cls.__repr__ = cls.__str__ on Windows.

2011-03-17 Thread Steven D'Aprano
On Thu, 17 Mar 2011 17:24:36 -0700, J Peyret wrote: > This gives a particularly nasty abend in Windows - "Python.exe has > stopped working", rather than a regular exception stack error. I've > fixed it, after I figured out the cause, which took a while, but maybe > someone will benefit from this.

Re: Abend with cls.__repr__ = cls.__str__ on Windows.

2011-03-17 Thread Terry Reedy
On 3/17/2011 10:00 PM, Terry Reedy wrote: On 3/17/2011 8:24 PM, J Peyret wrote: This gives a particularly nasty abend in Windows - "Python.exe has stopped working", rather than a regular exception stack error. I've fixed it, after I figured out the cause, which took a while, but maybe someone wi

Re: Abend with cls.__repr__ = cls.__str__ on Windows.

2011-03-17 Thread J Peyret
On Mar 17, 9:37 pm, Terry Reedy wrote: > On 3/17/2011 10:00 PM, Terry Reedy wrote: > > > On 3/17/2011 8:24 PM, J Peyret wrote: > >> This gives a particularly nasty abend in Windows - "Python.exe has > >> stopped working", rather than a regular exception stack error. I've > >> fixed it, after I fig

Re: creating RAW sockets

2011-03-17 Thread moijes12
On Mar 18, 6:20 am, Nobody wrote: > On Wed, 16 Mar 2011 23:50:03 -0700, moijes12 wrote: > > Now,please can someone guide(as in what should I read and NOT as in > > give me the code) me in decoding the IP header of packets using python > > 3.0.1. > > The "struct" module is the usual approach for de

Re: PostgreSQL vs MySQL (was Re: How to handle sockets - easily?)

2011-03-17 Thread J Peyret
On Mar 16, 10:19 am, a...@pythoncraft.com (Aahz) wrote: > In article , > >always recommend people to use PostgreSQL, though; which is superior in > >almost every way, especially the C client library and the wire protocol.) > > Can you point at a reference for the latter?  I have been trying to > c