Re: Python GUI questions

2013-03-19 Thread Ranting Rick
On Mar 19, 8:25 pm, maiden129 wrote: > Here is my try to answer some of questions: > > [snip code] I don't understand why you are wrapping this code into a class. Are you trying to create something reuseable? > I'm just struggling with only how to create an object that > will hold a single chara

Re: [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-26 Thread Ranting Rick
On Dec 26, 11:02 pm, Steven D'Aprano wrote: > On Wed, 26 Dec 2012 20:07:53 -0800, Rick Johnson wrote: > > My specific point is that the English word "variable" is unambiguous > > I'm sorry, do you mean "variable" the noun, or "variable" the adjective? > [snip: sliding down the rabbit hole of a pol

Re: [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-24 Thread Ranting Rick
On Dec 24, 9:48 am, Dave Angel wrote: > Pep8 recommends a particular style within a function name, separating > 'words of a name by underscore.  I happen to loathe that style, so I'm > clearly not the one who would critique someone for not following the > guideline.  I say getFile(), the pep says

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Ranting Rick
On Jul 15, 11:20 pm, Steven D'Aprano wrote: > (It's not like explicit and implicit are distinct -- everything depends > on something implicit, if only the meaning of the words you use to > describe it.) > > It certainly doesn't mean that the semantics of Python the language must > be written out

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Ranting Rick
On Jul 15, 11:03 pm, Steven D'Aprano wrote: > On Sun, 15 Jul 2012 22:15:13 -0400, Devin Jeanpierre wrote: > It boggles my mind that people who are perfectly happy to program to an > interface or protocol when it comes to (say) iterables, numbers or even > big complex classes with dozens of method

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Ranting Rick
On Jul 15, 9:58 pm, Steven D'Aprano wrote: > On Sun, 15 Jul 2012 18:21:06 -0700, Ranting Rick wrote: > > If HOWEVER we want to "truth test" an object (as in: "if obj") we should > > be FORCED to use the bool! Why? Because explicit is better than implici

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Ranting Rick
On Jul 15, 9:15 pm, Devin Jeanpierre wrote: > For example, instead of "if stack:" or "if bool(stack):", we could use > "if stack.isempty():". This line tells us explicitly that stack is a > container. Or instead of "if dist:" or "if bool(dist):" we could use > "if dist == 0:". This tells us expli

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Ranting Rick
On Jul 15, 9:13 pm, Steven D'Aprano wrote: > I have just written a bunch of code with about two dozen examples similar > to this: > > for item in (seq or []): >     do_something_with(item) > > iterates over seq if it is non-empty, or the empty list. Writing it like > this would be more painful, m

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Ranting Rick
On Jul 15, 8:51 pm, Chris Angelico wrote: > On Mon, Jul 16, 2012 at 11:21 AM, Ranting Rick > > wrote: > > If HOWEVER we want to "truth test" an object (as in: "if obj") we > > should be FORCED to use the bool! Why? Because explicit is better than > >

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Ranting Rick
On Jul 15, 4:53 pm, Chris Angelico wrote: > Then the construct "if bool(some_condition):" is redundant. Wrong again, pay attention Chris! It's ONLY redundant IF "some_condition" is a rich comparison: like "(a==b)" OR a boolean function: like "callable(a)". If HOWEVER we want to "truth test" an