Re: choose value from custom distribution

2010-10-18 Thread Chris Rebert
On Mon, Oct 18, 2010 at 11:40 PM, Arnaud Delobelle wrote: > elsa writes: >> Hello, >> >> I'm trying to find a way to collect a set of values from real data, >> and then sample values randomly from this data - so, the data I'm >> collecting becomes a kind of probability distribution. For instance,

Re: choose value from custom distribution

2010-10-18 Thread Arnaud Delobelle
elsa writes: > Hello, > > I'm trying to find a way to collect a set of values from real data, > and then sample values randomly from this data - so, the data I'm > collecting becomes a kind of probability distribution. For instance, I > might have age data for some children. It's very easy to col

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread alex23
Steven D'Aprano wrote: > Avoiding namespace pollution and information hiding are two good reasons > for nesting classes. Python already has a great mechanism for regulating namespaces: modules & importing. Information hiding seems to go against the 'all consenting adults' ethos as well. > There'

Re: Deferring a function call

2010-10-18 Thread Cameron Simpson
On 19Oct2010 04:59, Steven D'Aprano wrote: | Chris Rebert has already mentioned the sched module. Otherwise, put the | function call in a thread, and have the thread use time.sleep to wait | until the right time to execute. There is also the Timer class from the threading module. Cheers, --

Re: Deferring a function call

2010-10-18 Thread Lawrence D'Oliveiro
In message <2010101821214168010-tomfsess...@gmailcom>, TomF wrote: > One way way to do this is to keep a list of entries of the form [[TIME, > FN, ARGS]...] and at simulated time TIME do: fn(*args) or fn(**kwargs) -- http://mail.python.org/mailman/listinfo/python-list

Re: Deferring a function call

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 21:21:41 -0700, TomF wrote: > I'm writing a simple simulator, and I want to schedule an action to > occur at a later time. Basically, at some later point I want to call a > function f(a, b, c). But the values of a, b and c are determined at the > current time. > > One way wa

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 20:37:34 -0700, alex23 wrote: > Steven D'Aprano wrote: >> I'll accept that nested classes are unusual, but unPythonic? Never! > > Not even if "flat is better than nested" ;) But "Namespaces are one honking great idea -- let's do more of those!" (classes are a good thing) an

Re: choose value from custom distribution

2010-10-18 Thread Chris Rebert
On Mon, Oct 18, 2010 at 8:27 PM, elsa wrote: > Hello, > > I'm trying to find a way to collect a set of values from real data, > and then sample values randomly from this data - so, the data I'm > collecting becomes a kind of probability distribution. For instance, I > might have age data for some

Re: Deferring a function call

2010-10-18 Thread Chris Rebert
On Mon, Oct 18, 2010 at 9:21 PM, TomF wrote: > I'm writing a simple simulator, and I want to schedule an action to occur at > a later time.  Basically, at some later point I want to call a function f(a, > b, c).  But the values of a, b and c are determined at the current time. See the `sched` std

Deferring a function call

2010-10-18 Thread TomF
I'm writing a simple simulator, and I want to schedule an action to occur at a later time. Basically, at some later point I want to call a function f(a, b, c). But the values of a, b and c are determined at the current time. One way way to do this is to keep a list of entries of the form [[T

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Chris Rebert
On Mon, Oct 18, 2010 at 3:24 PM, Steven D'Aprano wrote: > On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote: > >> Also, Python's scoping rules, particularly for class-level scopes, don't >> work the way programmers from languages where nested classes are common >> would expect: > [snip exampl

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Tue, 19 Oct 2010 13:54:32 +1000, James Mills wrote: > On Tue, Oct 19, 2010 at 1:37 PM, alex23 wrote: >> Given that there's little if anything gained from nesting classes >> (other than possible scoping confusion) is there ever a need? > > 15+ years of programming and I've never used nested cl

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread James Mills
On Tue, Oct 19, 2010 at 1:37 PM, alex23 wrote: > Given that there's little if anything gained from nesting classes > (other than possible scoping confusion) is there ever a need? 15+ years of programming and I've never used nested classes in any language :) cheers James -- -- James Mills -- --

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread alex23
Steven D'Aprano wrote: > I'll accept that nested classes are unusual, but unPythonic? Never! Not even if "flat is better than nested" ;) And are you the same Steven D'Aprano who once wrote: "Never nest classes, unless you need to, or to win a bet." Given that there's little if anything gained

choose value from custom distribution

2010-10-18 Thread elsa
Hello, I'm trying to find a way to collect a set of values from real data, and then sample values randomly from this data - so, the data I'm collecting becomes a kind of probability distribution. For instance, I might have age data for some children. It's very easy to collect this data using a lis

Learning with Open Source Applications.

2010-10-18 Thread Jorge Biquez
Hello all. I am sorry for the cross posting but I really would like to hear comments from experience people in Python. I am new to Python, not new in programming. I am leaving the PHP path and moving to Python. When I was learning PHP it was very useful to learn to install OpenSource solutio

Re: Spreadsheet-style dependency tracking

2010-10-18 Thread Carl Banks
On Oct 18, 4:15 pm, Lawrence D'Oliveiro wrote: > In message > <42d82f8a-4ee6-44a7-914d-86dfc21f1...@a36g2000yqc.googlegroups.com>, > > Fuzzyman wrote: > > Allowing calculations to complete even in the presence of cycles can be > > very useful. > > But then the answer is no longer completely determ

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-18 Thread Steven D'Aprano
On Tue, 19 Oct 2010 11:53:40 +1100, Ben Finney wrote: > Steven D'Aprano writes: > >> On Mon, 18 Oct 2010 11:56:39 +0200, Jean-Michel Pichavant wrote: >> >> > I already have a stats module: >> > /usr/lib/python2.5/site-packages/stats.py >> >> The name of my module is not set in stone. >> >> I can

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 16:05:04 -0700, Aahz wrote: > In article <4cbcca47$0$29979$c3e8da3$54964...@news.astraweb.com>, Steven > D'Aprano wrote: >> >>I'm sorry, I don't see that "language Foo programmers will be surprised >>that Python is not language Foo" is an argument against Python >>programmers

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-18 Thread Ben Finney
Steven D'Aprano writes: > On Mon, 18 Oct 2010 11:56:39 +0200, Jean-Michel Pichavant wrote: > > > I already have a stats module: > > /usr/lib/python2.5/site-packages/stats.py > > The name of my module is not set in stone. > > I can't help what site-packages you have, but the above is not on > PyPI

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Seebs
On 2010-10-18, Aahz wrote: > In article <4cbcca47$0$29979$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: >>[duplicate post] > Maybe, but there's no reason for posting that ten times! ;-) I would guess that there is almost certainly a reason. My first candidate would be "buggy

Getting returncode of a command executed with Popen through xterm

2010-10-18 Thread AmFreak
Hi, i have a program that have to execute linux commands. I do it like this: retcode = Popen(["xterm", "-e", command],stdin=PIPE, stdout=PIPE, stderr=PIPE) I have to use xterm because some commands need further input from the user after they are executed. But when i use xterm i can't get t

surprise: cheap wholesale Gucci jackets by payal all products are free shipping

2010-10-18 Thread honst-trade
welcome to http://www.jialiuonline.com/FOOTWEAR/ or feel All the products are listed as following: Footwear: NikeAF1,Airmax,Shox,Adidas,Timberland,Puma,Gucci,Prada,LV,Chanel,Lacoste,Lebron,Kobe,Rift, Dunk SB, Nike Women Shoes, Nike Children Shoes, Hogan, Obama, Coogi, Bape Star, Adicolor, Ice Cr

Re: Simple logging example doesn't work!

2010-10-18 Thread Vinay Sajip
On Oct 18, 10:45 pm, "robinsieb...@gmail.com" wrote: > If I setlogging.basicConfig() call tologging.INFO, then I see info > messages in the logfile. I only want to see error messages in the > logfile. What you need to do is, 1. Set the root logger's level to INFO. That's because you want at leas

Re: Help with paths

2010-10-18 Thread Devin M
On Oct 18, 2:43 pm, Alexander Kapps wrote: > On 18.10.2010 23:24, Devin M wrote: > > > Hello, I am using os.path to get the absolute paths of a few > > directories that some python files are in. > > FIlePath = os.path.dirname(os.path.realpath(__file__)) > > which returns a path similar to /home/de

Re: Spreadsheet-style dependency tracking

2010-10-18 Thread Lawrence D'Oliveiro
In message <42d82f8a-4ee6-44a7-914d-86dfc21f1...@a36g2000yqc.googlegroups.com>, Fuzzyman wrote: > Allowing calculations to complete even in the presence of cycles can be > very useful. But then the answer is no longer completely deterministic. -- http://mail.python.org/mailman/listinfo/python-

Re: Starting Python in XP Pro

2010-10-18 Thread Lawrence D'Oliveiro
In message , Dave Angel wrote: > As you've noticed, many times a program started from the start menu > doesn't leave its command window open long enough to read the messages. Windows needs an equivalent to ~/.xsession-errors. -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 11:56:39 +0200, Jean-Michel Pichavant wrote: > I already have a stats module: > /usr/lib/python2.5/site-packages/stats.py The name of my module is not set in stone. I can't help what site-packages you have, but the above is not on PyPI, and it's certainly not part of the sta

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Aahz
In article <4cbcca47$0$29979$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > >I'm sorry, I don't see that "language Foo programmers will be surprised >that Python is not language Foo" is an argument against Python >programmers using nested classes. Surely it's an argument against >w

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote: > Also, Python's scoping rules, particularly for class-level scopes, don't > work the way programmers from languages where nested classes are common > would expect: [snip example] I'm sorry, I don't see that "language Foo programmers will b

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote: > Also, Python's scoping rules, particularly for class-level scopes, don't > work the way programmers from languages where nested classes are common > would expect: [snip example] I'm sorry, I don't see that "language Foo programmers will b

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote: > Also, Python's scoping rules, particularly for class-level scopes, don't > work the way programmers from languages where nested classes are common > would expect: [snip example] I'm sorry, I don't see that "language Foo programmers will b

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote: > Also, Python's scoping rules, particularly for class-level scopes, don't > work the way programmers from languages where nested classes are common > would expect: [snip example] I'm sorry, I don't see that "language Foo programmers will b

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote: > Also, Python's scoping rules, particularly for class-level scopes, don't > work the way programmers from languages where nested classes are common > would expect: [snip example] I'm sorry, I don't see that "language Foo programmers will b

Re: Help with paths

2010-10-18 Thread Alexander Kapps
On 18.10.2010 23:24, Devin M wrote: Hello, I am using os.path to get the absolute paths of a few directories that some python files are in. FIlePath = os.path.dirname(os.path.realpath(__file__)) which returns a path similar to /home/devinm/project/files Now I want to get the directory above this

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote: > Also, Python's scoping rules, particularly for class-level scopes, don't > work the way programmers from languages where nested classes are common > would expect: [snip example] I'm sorry, I don't see that "language Foo programmers will b

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote: > Also, Python's scoping rules, particularly for class-level scopes, don't > work the way programmers from languages where nested classes are common > would expect: [snip example] I'm sorry, I don't see that "language Foo programmers will b

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote: > Also, Python's scoping rules, particularly for class-level scopes, don't > work the way programmers from languages where nested classes are common > would expect: [snip example] I'm sorry, I don't see that "language Foo programmers will b

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote: > Also, Python's scoping rules, particularly for class-level scopes, don't > work the way programmers from languages where nested classes are common > would expect: [snip example] I'm sorry, I don't see that "language Foo programmers will b

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote: > Also, Python's scoping rules, particularly for class-level scopes, don't > work the way programmers from languages where nested classes are common > would expect: [snip example] I'm sorry, I don't see that "language Foo programmers will b

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Steven D'Aprano
On Mon, 18 Oct 2010 17:17:52 +0200, Christian Heimes wrote: > Don't nest classes. Just don't. This might be a valid and good approach > in some programming languages but it's not Pythonic. Your code can > easily be implemented without nested classes. I'll accept that nested classes are unusual, b

Re: Simple logging example doesn't work!

2010-10-18 Thread robinsieb...@gmail.com
If I set logging.basicConfig() call to logging.INFO, then I see info messages in the logfile. I only want to see error messages in the logfile. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with paths

2010-10-18 Thread Emile van Sebille
On 10/18/2010 2:24 PM Devin M said... Hello, I am using os.path to get the absolute paths of a few directories that some python files are in. FIlePath = os.path.dirname(os.path.realpath(__file__)) which returns a path similar to /home/devinm/project/files Now I want to get the directory above thi

Re: Help with paths

2010-10-18 Thread Chris Rebert
On Mon, Oct 18, 2010 at 2:24 PM, Devin M wrote: > Hello, I am using os.path to get the absolute paths of a few > directories that some python files are in. > FIlePath = os.path.dirname(os.path.realpath(__file__)) > which returns a path similar to /home/devinm/project/files > Now I want to get the

Re: Help with paths

2010-10-18 Thread Andreas Waldenburger
On Mon, 18 Oct 2010 17:29:11 -0400 Andreas Waldenburger wrote: > On Mon, 18 Oct 2010 14:24:39 -0700 (PDT) Devin M > wrote: > [snip] > > Maybe os.relpath("..", FilePath) ? Python > 2.6 only. > Gah! I should learn to copy&paste more. Obviously it's the second one (os.path.relpath), not the first

Re: Help with paths

2010-10-18 Thread Andreas Waldenburger
On Mon, 18 Oct 2010 14:24:39 -0700 (PDT) Devin M wrote: > Hello, I am using os.path to get the absolute paths of a few > directories that some python files are in. > FIlePath = os.path.dirname(os.path.realpath(__file__)) > which returns a path similar to /home/devinm/project/files > Now I want to

pyqt4 Table Widget deleting c/c++ object

2010-10-18 Thread Andrew
I have two issues dealing with the table widget, though they may be interconnected. I'm not sure. Both delete the cell widgets off of my table but leave the rows, and then when I have the table update, it complains the c++ object has been deleted. # self.tableData.setCellWidget(rowCount, 0, trackI

Re: Simple logging example doesn't work!

2010-10-18 Thread Kev Dwyer
On Mon, 18 Oct 2010 11:52:36 -0700, robinsieb...@gmail.com wrote: > Here is an example straight out of the help, and for some reason, it is > not working. I get the error messages in the log, but I do not get the > info messages in the console. > Hello, I don't see this code in the help; nevert

Help with paths

2010-10-18 Thread Devin M
Hello, I am using os.path to get the absolute paths of a few directories that some python files are in. FIlePath = os.path.dirname(os.path.realpath(__file__)) which returns a path similar to /home/devinm/project/files Now I want to get the directory above this one. (/home/devinm/ project/) Is there

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-18 Thread Vlastimil Brom
2010/10/17 Steven D'Aprano : > I am pleased to announce the first public release of stats for Python. > > http://pypi.python.org/pypi/stats > > stats is a pure-Python module providing basic statistics functions > similar to those found on scientific calculators. It currently includes: > > Univariat

Simple logging example doesn't work!

2010-10-18 Thread robinsieb...@gmail.com
Here is an example straight out of the help, and for some reason, it is not working. I get the error messages in the log, but I do not get the info messages in the console. import datetime, logging def main(): timestamp = datetime.datetime.now().strftime("%Y%m%d-%I%M%S") #set up logging

Re: OO and game design questions

2010-10-18 Thread Carl Banks
On Oct 18, 6:50 am, dex wrote: > > You're aware Python can collect reference cycles, correct?  You don't > > have to delete references; Python will get them eventually.   > > I'm not sure I understand this part? If I don't delete all strong > references, the object will not be deleted. > It will p

Re: tkMessageBox

2010-10-18 Thread Chris Rebert
On Mon, Oct 18, 2010 at 11:32 AM, richard wrote: > When I do   import tkMessageBox  the Python Shell tells me that this > does not exist.  Where do I find it? What OS are you using? How did you install Python? Can you `import Tkinter`? Cheers, Chris -- http://blog.rebertia.com -- http://mail.py

tkMessageBox

2010-10-18 Thread richard
When I do import tkMessageBox the Python Shell tells me that this does not exist. Where do I find it? You may reply to my academic email: rdrie...@nps.edu -- http://mail.python.org/mailman/listinfo/python-list

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread John Nagle
On 10/18/2010 8:17 AM, Christian Heimes wrote: Am 18.10.2010 16:35, schrieb f...@slick.airforce-one.org: So my way of coding it is the following: class zone(GtkDrawingArea): class systemOfCoordinates: self.xmin = -5 self.xmax = 5 self.ymin = -5 self.ymax = 5 class Cu

Re: Reading Outlook .msg file using Python

2010-10-18 Thread John Henry
On Oct 18, 4:09 am, Tim Golden wrote: > On 17/10/2010 20:25, John Henry wrote: > > > Not knowing anything about MAPI, I tried a number of the MAPI flags, > > the only one that works appears to be PR_SUBJECT. > > PR_CLIENT_SUBMIT_TIME, PR_CREATION_TIME and so forth doesn't work. > > I'll try to fis

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-18 Thread Felipe Bastos Nunes
Printable in the screen, all of them are, except for blank spaces ehhehehe 2010/10/18, Tim Chase : > On 10/18/10 09:28, Grant Edwards wrote: >> There's no easy way to even define what "printable" means. Ask three >> different people, and you'll get at least four different answers >> answers. > >

Re: error in loading data into the code

2010-10-18 Thread Peter Otten
Diez B. Roggisch wrote: > nakisa writes: > >> hello , I have started python last week,so maybe my question is a bit >> stupid. >> I got this error in my simple python code while trying to load data >> into the code. I have added this libaraies >> from pylab import * >> from scipy import * >> imp

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Jean-Michel Pichavant
f...@slick.airforce-one.org wrote: Jean-Michel Pichavant wrote: Always post working code, or at least something we can paste in the python interpreter (even if it's buggy) Ok, noted. class A: class B: x=2 class C: def __init__(self): print A.B.x c

Re: How to get key values when iterating a mailbox?

2010-10-18 Thread Chris Rebert
On Mon, Oct 18, 2010 at 8:42 AM, wrote: > I'm trying to delete some messages from a mailbox when they are older > than a certain number of days. > > If I iterate through the mailbox and find a message that needs > deleting how do I get its key so I can do "remove(key)"? > > The trouble is that, a

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Chris Rebert
On Mon, Oct 18, 2010 at 8:58 AM, Andreas Waldenburger wrote: > On Mon, 18 Oct 2010 17:17:52 +0200 Christian Heimes > wrote: > >> [snip] >> Don't nest classes. Just don't. This might be a valid and good >> approach in some programming languages but it's not Pythonic. > > Explain! "Private" classe

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Jean-Michel Pichavant
f...@slick.airforce-one.org wrote: Christian Heimes wrote: Don't nest classes. Just don't. This might be a valid and good approach in some programming languages but it's not Pythonic. Your code can easily be implemented without nested classes. I think you're right. It would have been

Re: error in loading data into the code

2010-10-18 Thread nakisa
On Oct 18, 5:02 pm, de...@web.de (Diez B. Roggisch) wrote: > nakisa writes: > > hello , I have started python last week,so maybe my question is a bit > > stupid. > > I got this error in my simple python code while trying to load data > > into the code. I have added this libaraies > > from pylab im

Re: error in loading data into the code

2010-10-18 Thread Diez B. Roggisch
nakisa writes: > hello , I have started python last week,so maybe my question is a bit > stupid. > I got this error in my simple python code while trying to load data > into the code. I have added this libaraies > from pylab import * > from scipy import * > import matplotlib.mlab as mlab > from n

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-18 Thread Tim Chase
On 10/18/10 09:28, Grant Edwards wrote: There's no easy way to even define what "printable" means. Ask three different people, and you'll get at least four different answers answers. I don't have a printer...that makes *all* characters unprintable, right? Now I can convert the algorithm to O

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Andreas Waldenburger
On Mon, 18 Oct 2010 17:17:52 +0200 Christian Heimes wrote: > [snip] > Don't nest classes. Just don't. This might be a valid and good > approach in some programming languages but it's not Pythonic. Explain! /W -- To reach me via email, replace INVALID with the country code of my home country

How to get key values when iterating a mailbox?

2010-10-18 Thread tinnews
I'm trying to delete some messages from a mailbox when they are older than a certain number of days. If I iterate through the mailbox and find a message that needs deleting how do I get its key so I can do "remove(key)"? The trouble is that, as the documentation says: "The default Mailbox iterat

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread fab
Christian Heimes wrote: > Don't nest classes. Just don't. This might be a valid and good approach > in some programming languages but it's not Pythonic. Your code can > easily be implemented without nested classes. I think you're right. It would have been more aesthetically pleasant to me (a Hand

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Christian Heimes
Am 18.10.2010 16:35, schrieb f...@slick.airforce-one.org: > So my way of coding it is the following: > > class zone(GtkDrawingArea): > > class systemOfCoordinates: > self.xmin = -5 > self.xmax = 5 > self.ymin = -5 > self.ymax = 5 > > class Curve: > self.listOfPoints = ()

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Nobody
On Mon, 18 Oct 2010 14:35:58 +, fab wrote: > So my way of coding it is the following: > > class zone(GtkDrawingArea): > > class systemOfCoordinates: > self.xmin = -5 > self.xmax = 5 > self.ymin = -5 > self.ymax = 5 "self" isn't meaningful within a class definition. It's f

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread fab
Jean-Michel Pichavant wrote: > Always post working code, or at least something we can paste in the > python interpreter (even if it's buggy) Ok, noted. > class A: >class B: >x=2 >class C: >def __init__(self): >print A.B.x > > c = A.C() > > >2 Good, thanks.

Re: OO and game design questions

2010-10-18 Thread Benjamin Kaplan
On Mon, Oct 18, 2010 at 9:50 AM, dex wrote: >> You're aware Python can collect reference cycles, correct?  You don't >> have to delete references; Python will get them eventually. > > I'm not sure I understand this part? If I don't delete all strong > references, the object will not be deleted. >

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Jean-Michel Pichavant
f...@slick.airforce-one.org wrote: Neil Cerutti wrote: I have a class A that contains two classes B and C: class A: class B: self.x = 2 class C: I only wanted to show the structure of the code, not the actual instructions. Always post working code, or at least some

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread fab
Gary Herron wrote: > Well, your code still doesn't make sense, but the generic answers are: I'll clarify what I need then: I'm drawing Bézier curves. I draw them on a zone that is defined as a subclass of GtkDrawingArea. In a zone, I define a system of coordinates by 4 values: xmin, xmax, ymin,

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-18 Thread Grant Edwards
On 2010-10-18, Steven D'Aprano wrote: > Neither is accurate. all_ascii would be: > > all(ord(c) <= 127 for c in string for string in L) Definitely. > all_printable would be considerably harder. As far as I can tell, there's > no simple way to tell if a character is printable. There's no easy

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Gary Herron
On 10/18/2010 06:45 AM, f...@slick.airforce-one.org wrote: Neil Cerutti wrote: I have a class A that contains two classes B and C: class A: class B: self.x = 2 class C: I only wanted to show the structure of the code, not the actual instructions. That's not valid Python code. D

Re: OO and game design questions

2010-10-18 Thread dex
> You're aware Python can collect reference cycles, correct?  You don't > have to delete references; Python will get them eventually.   I'm not sure I understand this part? If I don't delete all strong references, the object will not be deleted. It will persist and occupy memory as long as there's

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread fab
Neil Cerutti wrote: >> I have a class A that contains two classes B and C: >> >> class A: >> class B: >> self.x = 2 >> >> class C: I only wanted to show the structure of the code, not the actual instructions. > That's not valid Python code. Do you mean: > > Class A: > Class B: >

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Neil Cerutti
On 2010-10-18, Neil Cerutti wrote: > On 2010-10-18, > wrote: >> Hello. >> >> I have a class A that contains two classes B and C: >> >> class A: >> class B: >> self.x = 2 >> >> class C: >> >> Is there a way to access the x defined in B in class C? > > That's not valid Python code. Do

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Neil Cerutti
On 2010-10-18, wrote: > Hello. > > I have a class A that contains two classes B and C: > > class A: > class B: > self.x = 2 > > class C: > > Is there a way to access the x defined in B in class C? That's not valid Python code. Do you mean: Class A: Class B: x = 2 or Class A

Classes in a class: how to access variables from one in another

2010-10-18 Thread fab
Hello. I have a class A that contains two classes B and C: class A: class B: self.x = 2 class C: Is there a way to access the x defined in B in class C? Thanks. -- F. Delente -- http://mail.python.org/mailman/listinfo/python-list

error in loading data into the code

2010-10-18 Thread nakisa
hello , I have started python last week,so maybe my question is a bit stupid. I got this error in my simple python code while trying to load data into the code. I have added this libaraies from pylab import * from scipy import * import matplotlib.mlab as mlab from numpy import * from scipy import o

Re: Spreadsheet-style dependency tracking

2010-10-18 Thread Fuzzyman
On Oct 17, 12:35 pm, Florian Weimer wrote: > * Chris Torek: > > > In article <87y69xbz6h@mid.deneb.enyo.de> > > Florian Weimer   wrote: > >>Are there libraries which implement some form of spreadsheet-style > >>dependency tracking?  The idea is to enable incremental updates to > >>some fairly

Re: Reading Outlook .msg file using Python

2010-10-18 Thread Tim Golden
On 17/10/2010 20:25, John Henry wrote: Not knowing anything about MAPI, I tried a number of the MAPI flags, the only one that works appears to be PR_SUBJECT. PR_CLIENT_SUBMIT_TIME, PR_CREATION_TIME and so forth doesn't work. I'll try to fish out some of the code we use, but for most of the fiel

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-18 Thread Tim Wintle
On Sun, 2010-10-17 at 17:10 +, Steven D'Aprano wrote: > I am pleased to announce the first public release of stats for Python. > > http://pypi.python.org/pypi/stats Quick comment on your sum() function: http://docs.python.org/library/math.html#math.fsum (in 2.6 and above) should do the sa

Re: OO and game design questions

2010-10-18 Thread Jean-Michel Pichavant
dex wrote: In each object's __init__() that object is added to game_object list, and in each __del__() they are removed from game_object list. This mechanism keeps them safe from garbage collector. How pythonic is this design? You don't have to manage memory with python, I don't know if you w

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-18 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: I am pleased to announce the first public release of stats for Python. http://pypi.python.org/pypi/stats stats is a pure-Python module providing basic statistics functions similar to those found on scientific calculators. It currently includes: Univariate statistics in

Re: OO and game design questions

2010-10-18 Thread Carl Banks
On Oct 18, 12:28 am, dex wrote: > Every item/character/room is a separate object. Items/characters need > to have references to room they are in, and room needs to have a list > of references to items/characters that are contained within. I decided > to use weak references. That way I can destroy

Re: what difference does redirection make?

2010-10-18 Thread Nikola Skoric
Dana Sun, 17 Oct 2010 15:36:13 -0400, Benjamin Kaplan kaze: > On Sun, Oct 17, 2010 at 3:04 PM, Nikola Skoric wrote: > You're trying to write Unicode to a file. But there's no such thing as /snip > .encode("cp1252") or whatever encoding you want to use to the end of > the mytemplate.render_unicod

Re: Deditor -- pythonic text-editor

2010-10-18 Thread Jean-Michel Pichavant
Kruptein wrote: on steven, peter and eliasf: Well okay I'm new to the world of developing programs, if I encounter problems I directly post a bug on the relevant page, that's maybe why I was a bit frustrated :) but what you three say is indeed true.. Hi, It does not work with python 2.5 (w

Print to an IPP printer (pkipplib?)

2010-10-18 Thread Adam Tauno Williams
I've found the module pkipplib which seems to work well for things like interrogating an IPP (CUPS) server. But is there a way to send a print job to an IPP print queue? [and no, the local system knows nothing about the print architecture so popenlp is not an option]. I just want to send the

Print to an IPP printer (pkipplib?)

2010-10-18 Thread Adam Tauno Williams
I've found the module pkipplib which seems to work well for things like interrogating an IPP (CUPS) server. But is there a way to send a print job to an IPP print queue? [and no, the local system knows nothing about the print architecture so popenlp is not an option]. I just want to send the

OO and game design questions

2010-10-18 Thread dex
I'm building a turn based RPG game as a hobby. The design is becoming increasingly complicated and confusing, and I think I may have tendency to over-engineer simple things. Can anybody please check my problems-solutions and point me to more elegant solution? Every item/character/room is a separat