To make a method or attribute private

2013-01-20 Thread iMath
To make a method or attribute private (inaccessible from the outside), simply start its name with two underscores 《Beginning Python From Novice to Professional》 but there is another saying goes: Beginning a variable name with a single underscore indicates that the variable should be treated

Re: To make a method or attribute private

2013-01-20 Thread Chris Angelico
On Sun, Jan 20, 2013 at 8:17 PM, iMath wrote: > so what is your opinion about single leading underscore and private methods > or attributes? Didn't this get discussed recently? http://mail.python.org/pipermail/python-list/2013-January/638687.html ChrisA -- http://mail.python.org/mailman/listi

Re: Parent module adsite.adsiteviews.mainhanlder does not exist

2013-01-20 Thread Jason Friedman
> I created a django project using django 1.4.2. There is one 'app'(adsite) in > this project. And It works. But when I copied some 'py' files into the 'app' > folder, I got "Parent module adsite.adsiteviews.mainhanlder does not exist." > Should I register the new files to __init__ in the 'app'?

Re: To make a method or attribute private

2013-01-20 Thread iMath
在 2013年1月17日星期四UTC+8上午9时04分00秒,alex23写道: > On Jan 17, 10:34 am, "iMath" <2281570...@qq.com> wrote: > > > To make a method or attribute private (inaccessible from the outside), > > simply start its > > > name with two underscores > > > > > > but there is another saying goes: > > > Beginning a

Re: To make a method or attribute private

2013-01-20 Thread Steven D'Aprano
On Sun, 20 Jan 2013 06:52:32 -0800, iMath wrote: [snip many dozens of lines of irrelevant text] > what's the meaning of 'object' in > class A(object) > and > class B(object) ? Please trim your replies. We don't need to scroll past page after page of irrelevant text which we have already read.

Re: PyWart: Exception error paths far too verbose

2013-01-20 Thread Terry Reedy
On 1/20/2013 1:08 AM, Steven D'Aprano wrote: On Sat, 19 Jan 2013 19:15:55 -0800, Ramchandra Apte wrote: [snip dozens of irrelevant quoted lines] Right-click the file in the traceback and there is an "Go to file/line" option. Please trim your replies so that the reader doesn't have to scroll

Re: ANN: Python training "text movies"

2013-01-20 Thread Franck Ditter
In article , Mitya Sirenef wrote: > On 01/19/2013 04:32 AM, Franck Ditter wrote: > > In article , > > Mitya Sirenef wrote: > > > >> On 01/14/2013 01:34 AM, Franck Ditter wrote: > >>> In article , > >>>Jason Friedman wrote: > >>> > > That is right; I would also add that it may be over

Re: ANN: Python training "text movies"

2013-01-20 Thread Franck Ditter
In article , Franck Ditter wrote: > In article , > Mitya Sirenef wrote: > > > On 01/19/2013 04:32 AM, Franck Ditter wrote: > > > In article , > > > Mitya Sirenef wrote: > > > > > >> On 01/14/2013 01:34 AM, Franck Ditter wrote: > > >>> In article , > > >>>Jason Friedman wrote: > > >>>

Re: ANN: Python training "text movies"

2013-01-20 Thread Franck Ditter
In article , Franck Ditter wrote: > In article , > Franck Ditter wrote: > > > In article , > > Mitya Sirenef wrote: > > > > > On 01/19/2013 04:32 AM, Franck Ditter wrote: > > > > In article , > > > > Mitya Sirenef wrote: > > > > > > > >> On 01/14/2013 01:34 AM, Franck Ditter wrote: > >

Re: ANN: Python training "text movies"

2013-01-20 Thread Mitya Sirenef
On 01/20/2013 12:54 PM, Franck Ditter wrote: In article , > Franck Ditter wrote: > >> In article , >> Franck Ditter wrote: >> >>> In article , >>> Mitya Sirenef wrote: >>> On 01/19/2013 04:32 AM, Franck Ditter wrote: > In article , > Mitya Sirenef wrote: > >> On 01/14/2

Re: Messing with the GC

2013-01-20 Thread Jens Thoms Toerring
Hi, thank you for the explanations. I had overlooked the cyclic nature of what I had produced here and, of course, the GC can't be blamed for not collecting objects that are part of a cycle. The other question about the last refe- rence to an object vanishing within a method call (which, as I

RE Help splitting CVS data

2013-01-20 Thread Garry
I'm trying to manipulate family tree data using Python. I'm using linux and Python 2.7.3 and have data files saved as Linux formatted cvs files The data appears in this format: Marriage,Husband,Wife,Date,Place,Source,Note0x0a Note: the Source field or the Note field can contain quoted data (same

Re: RE Help splitting CVS data

2013-01-20 Thread Mitya Sirenef
On 01/20/2013 05:04 PM, Garry wrote: I'm trying to manipulate family tree data using Python. I'm using linux and Python 2.7.3 and have data files saved as Linux formatted cvs files The data appears in this format: Marriage,Husband,Wife,Date,Place,Source,Note0x0a Note: the Source field or the No

Re: Messing with the GC

2013-01-20 Thread Terry Reedy
On 1/20/2013 3:09 PM, Jens Thoms Toerring wrote: thank you for the explanations. I had overlooked the cyclic nature of what I had produced here and, of course, the GC can't be blamed for not collecting objects that are part of a cycle. The other question about the last refe- rence to an obj

Re: RE Help splitting CVS data

2013-01-20 Thread Terry Reedy
On 1/20/2013 5:04 PM, Garry wrote: I'm trying to manipulate family tree data using Python. I'm using linux and Python 2.7.3 and have data files saved as Linux formatted cvs files ... I'm stuck, comments and solutions greatly appreciated. Why are you not using the cvs module? -- Terry Jan Re

Re: Help splitting CVS data

2013-01-20 Thread Dave Angel
On 01/20/2013 05:04 PM, Garry wrote: I'm trying to manipulate family tree data using Python. I'm using linux and Python 2.7.3 and have data files saved as Linux formatted cvs files The data appears in this format: Marriage,Husband,Wife,Date,Place,Source,Note0x0a Note: the Source field or the No

Re: To make a method or attribute private

2013-01-20 Thread alex23
On Jan 20, 7:23 pm, Chris Angelico wrote: > On Sun, Jan 20, 2013 at 8:17 PM, iMath wrote: > > so what is your opinion about single leading underscore and private methods > > or attributes? > > Didn't this get discussed recently? > > http://mail.python.org/pipermail/python-list/2013-January/63868

Re: To make a method or attribute private

2013-01-20 Thread Dave Angel
On 01/20/2013 06:14 PM, alex23 wrote: On Jan 20, 7:23 pm, Chris Angelico wrote: On Sun, Jan 20, 2013 at 8:17 PM, iMath wrote: so what is your opinion about single leading underscore and private methods or attributes? Didn't this get discussed recently? http://mail.python.org/pipermail/pyt

Re: RE Help splitting CVS data

2013-01-20 Thread Tim Chase
On 01/20/13 16:16, Terry Reedy wrote: On 1/20/2013 5:04 PM, Garry wrote: I'm trying to manipulate family tree data using Python. I'm using linux and Python 2.7.3 and have data files saved as Linux formatted cvs files ... I'm stuck, comments and solutions greatly appreciated. Why are you not

Re: ANN: Python training "text movies"

2013-01-20 Thread Steven D'Aprano
On Sun, 20 Jan 2013 18:54:03 +0100, Franck Ditter wrote: [snip quoting NINE levels deep] > When executing jstmovie.py, it complains : 'template.html' not found in > tmovies... Please trim unnecessary quoted text out of your replies. We don't need to read page after page of irrelevant comments t

Re: RE Help splitting CVS data

2013-01-20 Thread Garry
On Sunday, January 20, 2013 3:04:39 PM UTC-7, Garry wrote: > I'm trying to manipulate family tree data using Python. > > I'm using linux and Python 2.7.3 and have data files saved as Linux formatted > cvs files > > The data appears in this format: > > > > Marriage,Husband,Wife,Date,Place,Sour

Re: How do functions get access to builtins?

2013-01-20 Thread Rouslan Korneychuk
On 01/19/2013 09:59 PM, Steven D'Aprano wrote: I've been playing around with ChainedMap in Python 3.3, and run into something which perplexes me. Let's start with an ordinary function that accesses one global and one builtin. x = 42 def f(): print(x) If you call f(), it works as expected

Re: Messing with the GC

2013-01-20 Thread Jens Thoms Toerring
Terry Reedy wrote: > On 1/20/2013 3:09 PM, Jens Thoms Toerring wrote: > > thank you for the explanations. I had overlooked the > > cyclic nature of what I had produced here and, of course, > > the GC can't be blamed for not collecting objects that are > > part of a cycle. The other question

Re: To make a method or attribute private

2013-01-20 Thread iMath
在 2013年1月17日星期四UTC+8上午8时34分22秒,iMath写道: > To make a method or attribute private (inaccessible from the outside), simply > start its  > name with two underscores > > > 《Beginning Python From Novice to Professional》 > > > but there is another saying goes: > Beginning a variable name with a s

Re: To make a method or attribute private

2013-01-20 Thread Chris Angelico
On Mon, Jan 21, 2013 at 12:14 PM, iMath wrote: > so there is no REAL private variable in Python but conversion exists in it > that python programmer should follow and recognize .right ? That's about it. If you think about C++ public members as the "interface" and private/protected members as the

Re: RE Help splitting CVS data

2013-01-20 Thread Chris Angelico
On Mon, Jan 21, 2013 at 11:41 AM, Garry wrote: > Thanks everyone for your comments. I'm new to Python, but can get around in > Perl and regular expressions. I sure was taking the long way trying to get > the cvs data parsed. As has been hinted by Tim, you're actually talking about csv data -

Re: To make a method or attribute private

2013-01-20 Thread alex23
On Jan 21, 9:32 am, Dave Angel wrote: > On 01/20/2013 06:14 PM, alex23 wrote: > > > On Jan 20, 7:23 pm, Chris Angelico wrote: > >> On Sun, Jan 20, 2013 at 8:17 PM, iMath wrote: > >>> so what is your opinion about single leading underscore and private > >>> methods or attributes? > > >> Didn't t

Re: To make a method or attribute private

2013-01-20 Thread Mitya Sirenef
On 01/20/2013 09:24 PM, alex23 wrote: On Jan 21, 9:32 am, Dave Angel wrote: >> On 01/20/2013 06:14 PM, alex23 wrote: >> >>> On Jan 20, 7:23 pm, Chris Angelico wrote: On Sun, Jan 20, 2013 at 8:17 PM, iMath wrote: > so what is your opinion about single leading underscore and private

Re: To make a method or attribute private

2013-01-20 Thread Steven D'Aprano
On Sun, 20 Jan 2013 17:14:36 -0800, iMath wrote: [...] > so there is no REAL private variable in Python but conversion exists in > it that python programmer should follow and recognize .right ? There are no "REAL private variables" in most languages. Consider the C++ trick "#define private publi

Else statement executing when it shouldnt

2013-01-20 Thread eli m
an else statement is running when it shouldnt be. It is on the last line. Whenever i am in the math or game function, when i type in main, it goes back to the start of the program, but it also says not a valid function. I am stumped! Here is my code: #Cmd #Created By Eli M. #import modules impo

Re: To make a method or attribute private

2013-01-20 Thread Chris Angelico
On Mon, Jan 21, 2013 at 2:27 PM, Steven D'Aprano wrote: > On Sun, 20 Jan 2013 17:14:36 -0800, iMath wrote: > > [...] >> so there is no REAL private variable in Python but conversion exists in >> it that python programmer should follow and recognize .right ? > > There are no "REAL private variables

Re: Else statement executing when it shouldnt

2013-01-20 Thread Roy Smith
In article <2cc6791f-ba56-406c-a5b0-b23023caf...@googlegroups.com>, eli m wrote: > an else statement is running when it shouldnt be. It is on the last line. > Whenever i am in the math or game function, when i type in main, it goes back > to the start of the program, but it also says not a val

Re: Else statement executing when it shouldnt

2013-01-20 Thread Chris Angelico
On Mon, Jan 21, 2013 at 3:40 PM, eli m wrote: > an else statement is running when it shouldnt be. It is on the last line. > Whenever i am in the math or game function, when i type in main, it goes back > to the start of the program, but it also says not a valid function. I am > stumped! Check

Re: Else statement executing when it shouldnt

2013-01-20 Thread eli m
On Sunday, January 20, 2013 8:54:13 PM UTC-8, René Klačan wrote: > You have to break while loop not to execute else branch > > > Rene > > > Can you explain in more detail please. -- http://mail.python.org/mailman/listinfo/python-list

Re: Else statement executing when it shouldnt

2013-01-20 Thread René Klačan
You have to break while loop not to execute else branch Rene On Mon, Jan 21, 2013 at 5:40 AM, eli m wrote: > an else statement is running when it shouldnt be. It is on the last line. > Whenever i am in the math or game function, when i type in main, it goes > back to the start of the program, b

Re: Else statement executing when it shouldnt

2013-01-20 Thread eli m
> > > > Your else is lined up with while, not with if. > > > > -m > > > > > > -- > > Lark's Tongue Guide to Python: http://lightbird.net/larks/ > > > > When a friend succeeds, I die a little. Gore Vidal Its lined up. It got messed up when i copied the code into the post. -- ht

Re: Else statement executing when it shouldnt

2013-01-20 Thread eli m
On Sunday, January 20, 2013 8:40:47 PM UTC-8, eli m wrote: hint: Use the comments in the code to find out where my error is. > > Here is my code: > > #Cmd > > #Created By Eli M. > > #import modules > > import random > > import math > > gtn = 0 > > print ("Type in help for a list of cmd fun

Re: Else statement executing when it shouldnt

2013-01-20 Thread eli m
On Sunday, January 20, 2013 8:52:12 PM UTC-8, Chris Angelico wrote: > On Mon, Jan 21, 2013 at 3:40 PM, eli m wrote: > > > an else statement is running when it shouldnt be. It is on the last line. > > Whenever i am in the math or game function, when i type in main, it goes > > back to the start

Re: Else statement executing when it shouldnt

2013-01-20 Thread Mitya Sirenef
On 01/20/2013 11:40 PM, eli m wrote: an else statement is running when it shouldnt be. It is on the last line. Whenever i am in the math or game function, when i type in main, it goes back to the start of the program, but it also says not a valid function. I am stumped! > Here is my code: > #C

Re: Else statement executing when it shouldnt

2013-01-20 Thread René Klačan
Examples: # else branch will be executed i = 0 while i < 5: i += 1 else: print('loop is over') # else branch will be executed i = 0 while i < 5: i += 1 if i == 7: print('i == 7') break else: print('loop is over') # else branch wont be executed i = 0 while i

Re: Else statement executing when it shouldnt

2013-01-20 Thread René Klačan
Examples: # else branch will be executed i = 0 while i < 5: i += 1 else: print('loop is over') # else branch will be executed i = 0 while i < 5: i += 1 if i == 7: print('i == 7') break else: print('loop is over') # else branch wont be executed i = 0 while i

Re: To make a method or attribute private

2013-01-20 Thread alex23
On Jan 21, 2:46 pm, Chris Angelico wrote: > These aren't proofs that something doesn't exist, they're proofs that > trying to enforce privacy is bound to fail But if you can't enforce it, can you really say it exists? Semantics, they are fun! I feel another PyWart post coming on... -- http://ma

Re: Else statement executing when it shouldnt

2013-01-20 Thread alex23
On Jan 21, 2:59 pm, eli m wrote: > Its lined up. It got messed up when i copied the code into the post. Sorry, we're not going to take your word for it. Reduce it to the minimal amount of code that reproduces your error and post that. -- http://mail.python.org/mailman/listinfo/python-list

Re: Else statement executing when it shouldnt

2013-01-20 Thread alex23
On Jan 21, 2:40 pm, eli m wrote: > an else statement is running when it shouldnt be. It is > on the last line. Whenever i am in the math or game > function, when i type in main, it goes back to the start > of the program, but it also says not a valid function. > I am stumped! Here is your code wi

Re: Else statement executing when it shouldnt

2013-01-20 Thread alex23
On Jan 21, 2:54 pm, eli m wrote: > hint: Use the comments in the code to find out where my error is. Pro-tip: when people you're asking for help tell you how you can make it easier for them to help you, a snide response isn't the correct approach. -- http://mail.python.org/mailman/listinfo/pytho

Re: Else statement executing when it shouldnt

2013-01-20 Thread Mitya Sirenef
On 01/20/2013 11:59 PM, eli m wrote: >> >> >> >> Your else is lined up with while, not with if. >> >> >> >> -m >> >> >> >> >> >> -- >> >> Lark's Tongue Guide to Python: http://lightbird.net/larks/ >> >> >> >> When a friend succeeds, I die a little. Gore Vidal > Its lined up. It got messed up wh

Re: Forcing Python to detect DocumentRoot

2013-01-20 Thread Ferrous Cranus
Τη Σάββατο, 19 Ιανουαρίου 2013 10:01:15 μ.μ. UTC+2, ο χρήστης Piet van Oostrum έγραψε: > Ferrous Cranus writes: > > > > > This is addon domain's counter.py snippet tried to load an image mail.png > > and failed because it cant see past its document root > > > > > > =

Re: Uniquely identifying each & every html template

2013-01-20 Thread Ferrous Cranus
Τη Σάββατο, 19 Ιανουαρίου 2013 11:32:41 μ.μ. UTC+2, ο χρήστης Dennis Lee Bieber έγραψε: > On Sat, 19 Jan 2013 00:39:44 -0800 (PST), Ferrous Cranus > > declaimed the following in > > gmane.comp.python.general: > > > We need to find a way so even IF: > > > > > > (filepath gets modified && fil

Re: Uniquely identifying each & every html template

2013-01-20 Thread Ferrous Cranus
Τη Σάββατο, 19 Ιανουαρίου 2013 11:00:15 π.μ. UTC+2, ο χρήστης Dave Angel έγραψε: > On 01/19/2013 03:39 AM, Ferrous Cranus wrote: > > > Τη Σάββατο, 19 Ιανουαρίου 2013 12:09:28 π.μ. UTC+2, ο χρήστης Dave Angel > > έγραψε: > > > > > >> I don't understand the problem. A trivial Python script could

Re: Uniquely identifying each & every html template

2013-01-20 Thread Chris Angelico
On Mon, Jan 21, 2013 at 6:08 PM, Ferrous Cranus wrote: > An .html page must retain its database counter value even if its: > > (renamed && moved && contents altered) Then you either need to tag them in some external way, or have some kind of tracking operation - for instance, if you require that

Re: ANN: Python training "text movies"

2013-01-20 Thread rusi
On Jan 13, 12:08 pm, Mitya Sirenef wrote: > Sure: they play back a list of instructions on use of string methods and > list comprehensions along with demonstration in a mock-up of the > interpreter with a different display effect for commands typed into (and > printed out by) the interpeter. The s