Re: Chaos Theory [was Re: Benefit and belief]

2011-10-03 Thread rantingrick
On Oct 3, 11:27 am, Chris Angelico wrote: > PhysicsExpert: Super-speed wouldn't work, the acceleration required to > achieve it would burn up his surroundings! For some definition of "super-speed" i suppose. Since we're bouncing around the "relatives" here we need to consider this one also -> Su

Re: Question: How to Prevent Tkinter Menu from Taking Keyboard Focus

2011-10-03 Thread rantingrick
On Oct 3, 2:55 pm, galyle wrote: > Hello, I'm trying to build a menu which provides suggestions to a user > based on input to an entry.  I have done something like this before > using Tcl/Tk, so I expected that it would work without much difficulty > with Tkinter.  I was wrong. Why not just use

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-03 Thread rantingrick
On Oct 3, 2:14 pm, Dave Angel wrote: > Like it or not, there are plenty of globals already there, one of them > being __name__ .  All the built-ins are effectively global, and so >   is any function they define at top-level. I keep wondering if that was another PyWart? I believe (and hindsight i

Re: Chaos Theory [was Re: Benefit and belief]

2011-10-03 Thread rantingrick
On Oct 2, 4:43 pm, Steven D'Aprano wrote: > In all cases, we can be sure that the contradiction between the pair of > statements are genuine contradictions and not mere apparent > contradictions caused by "narrow perspective" or incomplete or erroneous > knowledge. Observer: Why is it that Clark

Re: lower-case names for builtin types

2011-10-03 Thread rantingrick
On Oct 1, 10:41 pm, Eric Snow wrote: > Anyone know the story behind the lower-case names for the > non-exception built-in types (like list and type)?  I am guessing that > they were originally factory functions that, at some point, graduated > to full types; and the names were kept lower-case for

Re: Replacing spreadsheets by Python and the browser

2011-10-02 Thread rantingrick
On Oct 2, 12:36 pm, markolopa wrote: > Examples of information I would store in such a tree/table system > (which are now in spreasheets): > - My dvd, avi collection: The tree would be the directory tree of the > file system where I store my movies. For each directory containing the > avis or the

Re: Benefit and belief

2011-09-30 Thread rantingrick
On Sep 30, 11:36 am, Westley Martínez wrote: > On Fri, Sep 30, 2011 at 09:22:59AM -0700, rusi wrote: > > On Sep 30, 8:58�pm, Neil Cerutti wrote: > > > On 2011-09-30, DevPlayer wrote: > > > > > I still assert that contradiction is caused by narrow perspective. > > > > > By that I mean: just bec

Re: Suggested coding style

2011-09-30 Thread rantingrick
Note: I am quoting "Passiday" to get this thread back on subject however my reply is for "alex23" the philosopher" On Sep 29, 9:50 pm, alex23 wrote: > On Sep 29, 10:23 pm, rantingrick wrote: > > > What is so bad about breaking code in obscure places? >

Re: Suggested coding style

2011-09-30 Thread rantingrick
On Sep 29, 11:49 pm, Ian Kelly wrote: > Nope, that doesn't work. > > >>> "{0:0>10}".format("-1234") > > '0-1234' > > The whole point of zfill is that it handles signs correctly. py> "{0:-010d}".format(-1234) '-01234' My point was: Use the {char}{repeat}d format for integers and the {char

Re: Benefit and belief

2011-09-30 Thread rantingrick
On Sep 29, 10:05 pm, alex23 wrote: > On Sep 30, 9:37 am, MRAB wrote: > > alex23: > > """And like the Bible, the Zen was created by humans as a joke. If you're > > taking it too seriously, that's your problem.""" > > Strangely, calling the bible self-contradictory wasn't seen as > inflammatory...

Re: Benefit and belief

2011-09-29 Thread rantingrick
On Sep 29, 6:40 pm, Ethan Furman wrote: > Okay, that's what I get for skimming -- it was alex23, not rr.  My > apologies, rr, for the misattribution. Oh don't worry Ethan, this is not the first time I've been falsely accused, misquoted, and kicked in the testicles, and i'm quite sure with this fi

Re: Suggested coding style

2011-09-29 Thread rantingrick
On Sep 29, 5:12 pm, Ian Kelly wrote: > On Thu, Sep 29, 2011 at 6:23 AM, rantingrick wrote: > > A specific method for padding a string with ONLY zeros is ludicrous > > and exposes the narrow mindedness of the creator. The only thing worse > > than "zfill" as a str

Re: Suggested coding style

2011-09-29 Thread rantingrick
On Sep 29, 6:07 pm, Devin Jeanpierre wrote: > > However, as you use the new format method you will come to appreciate > > it. It's an adult beverage with an acquired taste. ;-) > > Yeah. It's a much more difficult to read thing, but once you learn how > to write it it flows faster. > > Of course,

Re: Suggested coding style

2011-09-29 Thread rantingrick
On Sep 29, 5:12 pm, Ian Kelly wrote: > On Thu, Sep 29, 2011 at 6:23 AM, rantingrick wrote: > > A specific method for padding a string with ONLY zeros is ludicrous > > and exposes the narrow mindedness of the creator. The only thing worse > > than "zfill" as a str

Re: Suggested coding style

2011-09-29 Thread rantingrick
On Sep 29, 7:23 am, rantingrick wrote: > A specific method for padding a string with ONLY zeros is ludicrous > and exposes the narrow mindedness of the creator. The only thing worse > than "zfill" as a string method is making zfill into built-in > function! The ONLY proper

Re: Suggested coding style

2011-09-29 Thread rantingrick
On Sep 29, 5:37 am, Passiday wrote: > Here's a summary of what I take from this longwinded thread: > Read the Zen of Pthon for some fun:http://www.python.org/dev/peps/pep-0020 > Read the PEP-8 for some good > guidelines:http://www.python.org/dev/peps/pep-0008 That's the point of all this, yes.

Re: Suggested coding style

2011-09-28 Thread rantingrick
On Sep 28, 6:26 pm, Tim Johnson wrote: > * DevPlayer [110928 04:31]: > > On Sep 27, 10:25 pm, alex23 wrote: > > > rantingrick wrote: > > > > Since, like the bible > > > > the zen is self contradicting, any argument utilizing the zen can be > >

Re: Installing Python 2.6.7 on Windows

2011-09-28 Thread rantingrick
On Sep 27, 11:25 pm, Steven D'Aprano wrote: > The Python development team is relatively small and chronically busy: too > much to do and not enough time to do it. If that is the case then why do they snub their noses at anyone who wishes to help? What kind of people would chase off good help jus

Re: Suggested coding style

2011-09-27 Thread rantingrick
On Sep 27, 1:51 am, DevPlayer wrote: > By the way OP Passiday the title of the topic is "Suggested coding > style". > > Are you suggesting a coding style or asking for a Python coding style > or are you asking what IS the Python coding style. > > If you are asking what is the Python coding style.

Re: Why is the shutil module called shutil?

2011-09-25 Thread rantingrick
Oh the creative juices are flowing now!!! class Path: def __init__(self, path): def __coerce__(self) => File or Dir # # Properties about the path: drive => str directory => str filename => str extension => str ##uncshare[1]=> ??? # # Mutations. def

Re: Why is the shutil module called shutil?

2011-09-25 Thread rantingrick
Here is a *very* rough outline of my ideas. There are probably a few mistakes in there. I've decided on three main main objects. A File object, a Path object, and a Dir object. ## START ENLIGHTENMENT ## class Path: def __init__(self, path): # # Properties about the path: drive =>

Re: Why is the shutil module called shutil?

2011-09-25 Thread rantingrick
On Sep 24, 11:56 pm, Matt Joiner wrote: > Please continue Well specifically we should have a look over the Ruby API's of "File", "Dir", and "IO". I don't believe we should copy them verbatim --as the Ruby API is not Pythonic-- however, it may be a good starting point for something that has been d

Re: Python Mixins

2011-09-24 Thread rantingrick
On Sep 24, 3:57 am, Steven D'Aprano wrote: > class StandardTestMixin: >     def test_requires_one_argument(self): >         self.assertRaises(TypeError, self.func) >     def test_has_docstring(self): >         self.assertTrue(self.func.__doc__) And this is another example of why we need doc-stri

Re: Why is the shutil module called shutil?

2011-09-24 Thread rantingrick
On Sep 23, 10:36 pm, Fletcher Johnson wrote: > The topic says it all: > Why is shutil named shutil? What does it stand for? This is just a > mild curiosity of mine. > The shutil module for > reference:http://docs.python.org/library/shutil.html#module-shutil Because even after 20 freaking years o

Re: Python Mixins

2011-09-24 Thread rantingrick
On Sep 22, 4:14 pm, Matt wrote: > I'm curious about what people's opinions are about using mixins in > Python. I really like, for example, the way that class based views > were implemented in Django 1.3 using mixins. It makes everything > extremely customizable and reusable. I think this is a very

Re: Python Mixins

2011-09-22 Thread rantingrick
On Sep 22, 4:14 pm, Matt wrote: > (although having only a single parent doesn't > make much sense either, I believe there are very few actual documented > cases of that happening). There is nothing wrong with an object having only one parent. Most times the reasons are for maintainability. I mig

Re: PyWart: Itertools module needs attention

2011-09-13 Thread rantingrick
On Sep 13, 10:45 am, Ian Kelly wrote: > Have you looked at the online itertools documentation at all? > > http://docs.python.org/library/itertools.html Yes the online docs are much better. I really like the source code showing the inner workings of the methods. However i always get upset when i

PyWart: Itertools module needs attention

2011-09-12 Thread rantingrick
# Quote # # The itertools module is great HOWEVER i believe most # # people are recreating the functionalities due to the

Re: How to structure packages

2011-09-07 Thread rantingrick
On Sep 7, 10:56 am, bclark76 wrote: > I'm learning python, and was playing with structuring packages. > > Basically I want to have a package called mypackage that defines a > number of classes and functions. > > so I create: > > mypackage >     __init__.py >     myfunc.py >     MyClass.py Don't t

Re: Tkinter label height to fit content

2011-09-06 Thread rantingrick
On Sep 6, 5:40 pm, rantingrick wrote: > On Sep 6, 5:00 pm, Bart Kastermans wrote: > Take your input data and replace ALL single newlines with null strings CORRECTION: Take your input data and replace ALL single newlines with A SINGLE SPACE -- http://mail.python.org/mailman/listinfo/

Re: Tkinter label height to fit content

2011-09-06 Thread rantingrick
On Sep 6, 5:00 pm, Bart Kastermans wrote: > rantingrick writes: > > Hmm, i can replace all that code with this... > > Because I stupidly forgot to repeat the original problem I had, and my > code doesn't show it (and doesn't show the correct use of the function I &

Re: Advice on how to get started with 2D-plotting ?

2011-09-06 Thread rantingrick
On Sep 6, 1:27 pm, Fred Pacquier wrote: > I'm a Python long-timer, but I've never had to use tools like Matplotlib & > others before. > > Now, for my work, I would need to learn the basics fast, for a one-time > quick-n-dirty job. ## ## START SCRIPT ## ## # # Easy_

Re: Tkinter label height to fit content

2011-09-06 Thread rantingrick
Or if you prefer the alternating background approach... ## # Easy_as.py ## import Tkinter as tk from ScrolledText import ScrolledText import tkFont import random END = 'end' INSERT = 'insert' # # Create some puesdo data. data = [ '{0}.{1}'.format(x, 'blah'*rand

Re: Tkinter label height to fit content

2011-09-06 Thread rantingrick
Hmm, i can replace all that code with this... # # Easy_as.py # import Tkinter as tk from ScrolledText import ScrolledText import tkFont import random # Create some puesdo data. data = [ '{0}.{1}'.format(x, 'blah'*random.randint(4, 50)) for x in range(100) ] ##print data # Create the ma

Re: Why do class methods always need 'self' as the first parameter?

2011-09-05 Thread rantingrick
On Aug 31, 9:35 am, "T. Goodchild" wrote: > I’m new to Python, and I love it.  The philosophy of the language (and > of the community as a whole) is beautiful to me. Welcome aboard mate! > But one of the things that bugs me Oh here we go! :-) > is the requirement that all class > methods have

Re: Best way to print a module?

2011-09-05 Thread rantingrick
On Sep 5, 10:06 am, Martin De Kauwe wrote: > Hi, > > If I wanted to print an entire module, skipping the attributes > starting with "__" is there an *optimal* way? Currently I am doing > something like this. Note I am just using sys here to make the point > > import sys > > data = [] > for attr in

Re: Tkinter label height to fit content

2011-09-04 Thread rantingrick
On Sep 4, 2:39 pm, Bart Kastermans wrote: > Thx.  That function should allow for a bit of robustness. Correction. The function is actually "tkFont.metrics(arg)" which takes "linespace" as an optional argument. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter label height to fit content

2011-09-04 Thread rantingrick
On Sep 4, 2:39 pm, Bart Kastermans wrote: > I get bits of information over RSS, these are of varying length.  I > want to show 10 at a time, and scroll through them.  Now when I > scroll the window grows and shrinks depending on their size, I want > to right from the start make it high enough to

Re: allow line break at operators

2011-09-04 Thread rantingrick
On Sep 4, 10:22 am, ron3200 wrote: > I think this is one of those areas where computers and people differ, > but it may also depend on the persons native language as to what works > better for them. Yes but what works better for "them" is not always a better way of doing things! People do foolis

Re: allow line break at operators

2011-09-04 Thread rantingrick
On Sep 3, 11:50 am, Stephen Hansen wrote: > Freedom is not and never has been, IMHO, a virtue or goal or even desire > in Python. Exactly! > Where it occurs, it is at best a happy coincidence, Exactly! > and even > if that happy coincidence happens often, it is not a design feature, IMHO. Ex

Re: Tkinter label height to fit content

2011-09-03 Thread rantingrick
On Sep 3, 5:15 pm, Bart Kastermans wrote: > Any suggestions? Yeah, have you considered using the "linespace()" method of tk.Font objects to calculate the height? Although i must say it "feels" as if your doing something you should not need to do, however i cannot be sure without knowing more abo

Re: is there any principle when writing python function

2011-08-27 Thread rantingrick
On Aug 27, 5:21 pm, Emile van Sebille wrote: > On 8/27/2011 2:57 PM Ben Finney said... > > > Emile van Sebille  writes: > > >> Code is first and foremost written to be executed. > > >      “Programs must be written for people to read, and only incidentally for > >      machines to execute.” > >  

Re: is there any principle when writing python function

2011-08-26 Thread rantingrick
On Aug 26, 1:16 pm, Steven D'Aprano wrote: > (3) Fault isolation. If you have a 100 line function that fails on line 73, > that failure may have been introduced way back in line 16. By splitting the > function up into smaller functions, you can more easily isolate where the > failure comes from,

Re: is there any principle when writing python function

2011-08-26 Thread rantingrick
On Aug 26, 4:45 pm, Chris Angelico wrote: > On Sat, Aug 27, 2011 at 4:05 AM, rantingrick wrote: > > Now take a look at MY simple ONE module solution. It has JUST enough > > methods and NOT a single more! > > I disagree - create_widgets() is completely unnecessary in t

Re: is there any principle when writing python function

2011-08-26 Thread rantingrick
On Aug 26, 10:40 am, John Gordon wrote: > In <7b47ca17-d3f1-4d91-91d1-98421e870...@ea4g2000vbb.googlegroups.com> > rantingrick writes: > > > Furthermore: If you are moving code out of one function to ONLY be > > called by that ONE function then you are a bad programm

Re: is there any principle when writing python function

2011-08-26 Thread rantingrick
On Aug 26, 6:15 am, Roy Smith wrote: > Maybe.  In general, it's certainly true that a bunch of smallish > functions, each of which performs exactly one job, is easier to work > with than a huge ball of spaghetti code.   Obviously you need to google the definition of "spaghetti code". When you mo

Re: I think I found 2 undocumented string format codes.

2011-08-24 Thread rantingrick
On Aug 24, 3:45 pm, Bill wrote: > My google-fu has failed me in finding info on %h and %l string > formatting codes. Did it ever occur to you to peruse the docs? http://docs.python.org/library/stdtypes.html#string-formatting-operations Stop using the limited deprecated string interpolation and u

Re: there is a problem, holp someone could help me,thanks

2011-08-24 Thread rantingrick
On Aug 24, 10:59 am, kangshu...@hotmail.com wrote: > Now I have a problem and I holp someone can help me. > > def fib(x): >     if x==0 or x==1: return 1 >     else: return fib(x-1) + fib(x-2) This must be from "How not to program". Was this a personal pick or recommendation? -- http://mail.pyt

Re: is there any principle when writing python function

2011-08-23 Thread rantingrick
On Aug 23, 1:29 pm, Terry Reedy wrote: > In terms of different functions performed (see my previous post), I see >    attribute lookup >    assignment >    enumerate >    sequence unpacking >    for-looping >    if-conditioning >    lower >    startswith >    return > That is 9,  which is enough.

Re: is there any principle when writing python function

2011-08-23 Thread rantingrick
On Aug 23, 6:59 am, smith jack wrote: > i have heard that function invocation in python is expensive, but make > lots of functions are a good design habit in many other languages, so > is there any principle when writing python function? > for example, how many lines should form a function? Every

Re: List spam

2011-08-18 Thread rantingrick
On Aug 18, 8:39 am, "Jason Staudenmayer" wrote: > > [snip irony] > > Adventure Aquarium is America's Most Touchable Aquarium! > Featuring the ALL NEW Stingray Beach Club > Where you can touch and hand feed the gentle stingrays > > To buy and print your tickets at home visit  www.AdventureAquarium.

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread rantingrick
On Aug 16, 7:33 pm, John Gordon wrote: > In > rantingrick writes: > > > > "wore" means you have worn them in the past. > > > > "used to wear" means you have worn them in the past AND don't intend > > > to do so again. > > Ac

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread rantingrick
On Aug 16, 6:25 pm, John Gordon wrote: > In > rantingrick writes: > > > > >  ORIGINAL1: "I used to wear wooden shoes" > > > >

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread rantingrick
On Aug 16, 4:55 pm, David Monaghan wrote: > On Tue, 16 Aug 2011 13:13:10 -0700 (PDT), rantingrick > > wrote: > >If conciseness is all you seek then perhaps you prefer the following? > > >ORIGINAL: "I used to wear wooden shoes" > >CONCISE:  "I wore w

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread rantingrick
On Aug 16, 1:37 pm, "Martin P. Hellwig" wrote: > Well admittedly English isn't my native language, But indeed all > sentences seem correct to me. > > With the first sentence meaning: in the past I wore wooden shoes, but > presently I do not. > > With the second sentence meaning: in the past I was

Re: allow line break at operators

2011-08-16 Thread rantingrick
On Aug 16, 1:49 am, alex23 wrote: > On Aug 16, 2:37 pm, rantingrick wrote: > > > The reading proceeds naturally from right to left. > > Well, "naturally" if you're coding in Hebrew or Japanese perhaps :) Yes :). I typo-ed that one. It was getting late when

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread rantingrick
On Aug 16, 9:13 am, Philip Semanchuk wrote: > "Sometimes X is safe and sometimes it isn't" can be said > of many, many things, from taking a walk down the street > to juggling with knives. But it has little to do with > whether or not Python should issue a warning in the > specific case we're tal

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread rantingrick
On Aug 16, 2:07 am, alex23 wrote: > All the way down indeed. Can you pick who said these? Obviously your grep skills are superb however you need to brush up on those reading and comprehension skills a bit. > "There are noobs watching and we to provide code that can be used to > teach!" Yes i s

Re: Ten rules to becoming a Python community member.

2011-08-15 Thread rantingrick
On Aug 15, 7:48 pm, Gregory Ewing wrote: > rantingrick wrote: > > "Used to" and "supposed to" is the verbiage of children > > and idiots. > > So when we reach a certain age we're meant to abandon > short, concise and idomatic ways of speaking

Re: allow line break at operators

2011-08-15 Thread rantingrick
On Aug 15, 11:13 pm, alex23 wrote: > Steven D'Aprano wrote: > > I think I would be less skeptical about fluent interfaces if they were > > written more like Unix shell script pipelines instead of using attribute > > access notation: > > > foo.array_of_things | sort | map block | join ", " > > I'v

Re: Why no warnings when re-assigning builtin names?

2011-08-15 Thread rantingrick
On Aug 15, 5:13 pm, Philip Semanchuk wrote: > On Aug 15, 2011, at 5:52 PM, Gerrat Rickert wrote: > > > With surprising regularity, I see program postings (eg. on > > StackOverflow) from inexperienced Python users  accidentally > > re-assigning built-in names. > > > For example, they'll innocently

Re: allow line break at operators

2011-08-15 Thread rantingrick
On Aug 15, 2:31 am, Terry Reedy wrote: > On 8/15/2011 12:28 AM, Seebs wrote: > > To repeat again: you are free to put in explicit dedent markers that > will let you re-indent code should all indents be removed. As Terry has been trying to say for a while now, use the following methods to quell y

Re: Ten rules to becoming a Python community member.

2011-08-14 Thread rantingrick
On Aug 14, 7:56 pm, Steven D'Aprano wrote: > Chris Angelico wrote: > > I think you need to start a blog, Rick. > > You'd be easier to ignore. > > And yet, here you are, engaging him in conversation and feeding him the > attention he craves :( Yes, Steven loves rule # 2. Second only to the strawme

Re: Ten rules to becoming a Python community member.

2011-08-14 Thread rantingrick
On Aug 14, 5:01 pm, Dave Angel wrote: > Interesting that when you complain about other's grammatical typos, > you're so careless with your own. > > know -> now > i -> I > accustom -> accustomed > the this -> this > > I'm inclined to ignore typos in emails except in the case where the > intent is

Re: Ten rules to becoming a Python community member.

2011-08-14 Thread rantingrick
On Aug 14, 12:57 am, rantingrick wrote: > 9. Never use the word "previously" or the phrase "in the past"; just > dumb it down with "used to". I had forgot to mention one other usage of "used to": WRONG: "I used to not like indention but know

Ten rules to becoming a Python community member.

2011-08-13 Thread rantingrick
Follow these simply rules to become an accepted member of the Python community. 1. Bash rantingrick and Xah Lee every chance you get. 2. Bash people who bash rick or xah because their basing made rick's or xah's words pa

Re: allow line break at operators

2011-08-13 Thread rantingrick
On Aug 12, 4:06 pm, Seebs wrote: > On 2011-08-12, Chris Angelico wrote: > > > Why is left-to-right inherently more logical than > > multiplication-before-addition? > > I'd say it's certainly "more Pythonic in a vacuum". > Multiplication-before-addition, and all the related rules, require > you to

Re: allow line break at operators

2011-08-13 Thread rantingrick
On Aug 12, 7:39 pm, Seebs wrote: > Consider the hypothetical array syntax: > >         a = [ >             1, >             2 >         b = [ >             3, >             4 > > This *bugs* me.  It's perfectly legible, and if you define it that way, it's > unambiguous and everything, but... It b

Re: allow line break at operators

2011-08-13 Thread rantingrick
On Aug 12, 7:39 pm, Seebs wrote: > I was overjoyed when I saw that Ruby would let me write 1_048_576. I'll have to admit that Ruby has a few very interesting ideas, this being one of them. We all know how impossible it can be to eyeball parse a very long number like this. Having the interpretor

Re: allow line break at operators

2011-08-13 Thread rantingrick
On Aug 12, 7:39 pm, Seebs wrote: > Well, that's the thing. > > In a case like: > >         if foo: >                 if bar: >                         blah >         blah > > I notice that *NOTHING* lines up with "if bar:".  And that affects me > about the way unmatched brackets do. For me, i be

Re: allow line break at operators

2011-08-13 Thread rantingrick
On Aug 12, 5:03 pm, Steven D'Aprano wrote: > Responding to Rick's standard {EDIT} posts > is like wrestling with a {EDIT} > [...] > Save yourself a lot of aggravation and kill-file him now. Kindly allow Walter E. Kurtz to shine some light on this situation: """ Pig after pig, cow after cow, vil

Re: allow line break at operators

2011-08-12 Thread rantingrick
On Aug 12, 11:33 am, Seebs wrote: > > My brain has quirks.  Some people call them defects, some don't, but it > really doesn't matter; there are things about which my brain is just plain > unreliable and I rely moderately heavily on extra visual cues to reduce > the frequency with which I get thin

Re: allow line break at operators

2011-08-12 Thread rantingrick
On Aug 12, 2:20 am, Chris Angelico wrote: > Pike is very [snip] > Pike's purpose is [snip] > you go to Pike[snip] > > I hope I make myself clear, Josephine? The only thing that is clear to me is that you have a hidden agenda to incorporate pike's functionality into Python -- and this is not the

Re: allow line break at operators

2011-08-12 Thread rantingrick
On Aug 12, 1:34 am, Seebs wrote: > > And part of this really is personal taste.  I *LIKE* having a matching outdent > for everything.  I like to look at code and see >         blah >                 blah >                         blah >                 blah >         blah > > because then I know i

Re: PyWart: os.path needs immediate attention!

2011-08-02 Thread rantingrick
On Aug 1, 3:19 am, Teemu Likonen wrote: > * 2011-07-30T10:57:29+10:00 * Steven D'Aprano wrote: > > > Teemu Likonen wrote: > >> Pathnames and the separator for pathname components should be > >> abstracted away, to a pathname object. > > > Been there, done that, floundered on the inability of peopl

PyWart: os.path needs immediate attention!

2011-07-29 Thread rantingrick
-- Overview of Problems: -- * Too many methods exported. * Poor choice of method names. * Non public classes/methods exported! * Duplicated functionality.

PyWart: PEP8: a seething cauldron of inconsistencies.

2011-07-28 Thread rantingrick
I believe the current Python style guide is inconsistent. The author again allowed his emotion to get in the way of logic. I will be posting blocks of text from the PEP8 and commenting below them. > -- > One of Guido's key insights is that c

Re: @PyNoobs: The Fundamental Five Built-in Functions, and Beyond!

2011-07-28 Thread rantingrick
On Jul 26, 9:53 pm, Terry Reedy wrote: > On 7/26/2011 8:01 PM, rantingrick wrote: > > > Most new user think that printing an object to stdout is all they'll > > ever need. However when you call print -- or sys.stdout.write(object) > > -- you are only seeing a &qu

PyWart: PEP8: A cauldron of inconsistencies.

2011-07-27 Thread rantingrick
I believe the current Python style guide is inconsistent. The author again allowed hie emotion to get in the way of logic. I will be posting blocks of text from the PEP8 and commenting below them. > -- > One of Guido's key insights is that c

Re: How do I access IDLE in Win7

2011-07-27 Thread rantingrick
On Jul 27, 10:06 am, "W. eWatson" wrote: > It's been many months since I played with Python, and have forgotten how > to bring up IDLE. If I simply click on a py file, I see what may be a > dos window appear and quickly disappear. "Double-clicking" a [py|pyw] file in windows will auto run the fil

Re: Strings show as brackets with a 'u'.

2011-07-26 Thread rantingrick
On Jul 25, 3:00 am, Ulrich Eckhardt wrote: > Chris Angelico wrote: > > > [snip] > > You just gave the OP a fish, he provided a > valuable advise on fishing itself. I always believed the best way to teach someone is not to give them a direct answer. No. Instead i like to offer clues so that the pe

@PyNoobs: The Fundamental Five Built-in Functions, and Beyond!

2011-07-26 Thread rantingrick
The "Fundamental Five" built-in functions There are quite a few helpful built in functions provided to the python programmer however in my mind five of them are the most impo

Re: Validating Entry in tkinter

2011-07-25 Thread rantingrick
On Jul 25, 2:08 pm, Peter Otten <__pete...@web.de> wrote: > Terry Reedy wrote: > > On 7/25/2011 8:31 AM, Peter Otten wrote: > >> Saul Spatz wrote: > > is it possible to set an onkey handler, that will pass on > > valid keys? > > With validatecommand you can have tkinter provide the string that is b

Re: Validating Entry in tkinter

2011-07-24 Thread rantingrick
On Jul 24, 7:11 pm, Saul Spatz wrote: > > Can one do something like this in tkinter? ‡ (1) First of all what exactly do you wish return? * an integer * a float * something else? (2) Is this input part of a modal or non-modal interface? For me, input validation should happen in *real* time an

Re: Strings show as brackets with a 'u'.

2011-07-23 Thread rantingrick
On Jul 23, 7:33 pm, goldtech wrote: > > >>> n > [u'174'] > > Probably newbie question but not sure how suppress the brackets and > the 'u' ? I assume pyhon is telling me it's a unicode string in the n > variable. Try type(n) and see what happens. Then report back. :) -- http://mail.python.org/ma

Re: Is there a way to customise math.sqrt(x) for some x?

2011-07-23 Thread rantingrick
On Jul 16, 3:35 am, Steven D'Aprano wrote: > I have a custom object that customises the usual maths functions and > operators, such as addition, multiplication, math.ceil etc. > > Is there a way to also customise math.sqrt? I don't think there is, but I > may have missed something. Hmm, this ques

Re: Convert '165.0' to int

2011-07-23 Thread rantingrick
On Jul 23, 1:53 am, Frank Millman wrote: >-- > The problem with that is that it will silently ignore any non-zero > digits after the point. Of course int(float(x)) does the same, which I > had overlooked. >---

Re: Can someone help please

2011-07-22 Thread rantingrick
On Jul 21, 12:02 pm, Gary wrote: -- > total = ' ' > os.chdir('/home/woodygar/Desktop/Docs') > for i in os.listdir('.'): -- "i" was a bad local var choice here! i and x are typically reserved to represe

Re: Use self.vars in class.method(parameters, self.vars)

2011-07-22 Thread rantingrick
On Jul 22, 2:00 pm, John Gordon wrote: > Why did you say he (Bruno) was wrong? I'll admit my yelling the word "WRONG" may have been interpreted as me suggesting that bruno was completely wrong. Bruno is correct about all class identifiers starting with a capital letter HOWEVER if he just stops

Re: Convert '165.0' to int

2011-07-22 Thread rantingrick
On Jul 22, 2:32 pm, rantingrick wrote: > >>> '{0:,.0f}'.format(2**53) > '9,007,199,254,740,992' Would have been better to say >>> '{0:,}'.format(2**53) '9,007,199,254,740,992' -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert '165.0' to int

2011-07-22 Thread rantingrick
On Jul 22, 7:42 am, Hrvoje Niksic wrote: > Frank Millman writes: > > int(float(x)) does the job, and I am happy with that. I was just > > asking if there were any alternatives. > > int(float(s)) will corrupt integers larger than 2**53, should you ever > need them.  int(decimal.Decimal(s)) works w

Re: Use self.vars in class.method(parameters, self.vars)

2011-07-22 Thread rantingrick
On Jul 22, 10:43 am, "bruno.desthuilli...@gmail.com" wrote: > > class names should start with an uppercase letter: WRONG! Class identifiers should use the capwords convention * class Foo * class FooBar * class FooBarBaz -- PEP8.Naming_Conventi

Re: Inconsistencies between zipfile and tarfile APIs

2011-07-22 Thread rantingrick
On Jul 22, 3:49 am, Lars Gustäbel wrote: > One could get the impression that you are leading a grass-roots movement > fighting a big faceless corporation. Instead, what you're dealing with is this > warm and friendly Python community you could as well be a part of if you are a > reasonable guy an

Re: Inconsistencies between zipfile and tarfile APIs

2011-07-22 Thread rantingrick
On Jul 22, 3:26 am, Lars Gustäbel wrote: > There is a reason why these two APIs are different. When I wrote tarfile > zipfile had already been existing for maybe 8 years and I didn't like its > interface very much. So, I came up with a different one for tarfile that in my > opinion was more gener

Re: Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread rantingrick
On Jul 22, 12:45 am, Terry Reedy wrote: > On 7/22/2011 12:48 AM, rantingrick wrote: > > On Jul 21, 11:13 pm, Corey Richardson  wrote: > Hmm. Archives are more like directories than files. Windows, at least, > seems to partly treat zipfiles as more or less as such. Yes but a zi

Re: Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread rantingrick
On Jul 22, 12:05 am, Corey Richardson wrote: > > >>> from archive import ZipFile, TarFile > > >>> zf = ZipFile(path, *args) > > >>> tf = TarFile(path, *args) > > I have nothing to do this weekend, I might as well either write my own or > twist around the existing implementations in the hg repo.

Re: Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread rantingrick
On Jul 21, 11:13 pm, Corey Richardson wrote: > Excerpts from rantingrick's message of Thu Jul 21 23:46:05 -0400 2011: > > > I may have found the mother of all inconsitency warts when comparing > > the zipfile and tarfile modules. Not only are the API's different, but > > the entry and exits are di

[PyWart 1001] Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread rantingrick
I may have found the mother of all inconsitency warts when comparing the zipfile and tarfile modules. Not only are the API's different, but the entry and exits are differnet AND zipfile/tarfile do not behave like proper file objects should. >>> import zipfile, tarfile >>> import os >>> os.path.ex

[PyWart 1001] Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread rantingrick
I may have found the mother of all inconsitency warts when comparing the zipfile and tarfile modules. Not only are the API's different, but the entry and exits are differnet AND zipfile/tarfile do not behave like proper file objects should. >>> import zipfile, tarfile >>> import os >>> os.path.ex

[PyWart 1001] Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread rantingrick
I may have found the mother of all inconsitency warts when comparing the zipfile and tarfile modules. Not only are the API's different, but the entry and exits are differnet AND zipfile/tarfile do not behave like proper file objects should. >>> import zipfile, tarfile >>> import os >>> os.path.ex

  1   2   3   4   5   6   7   8   >