PyWart: Packages (oh how thou art lacking!)

2013-11-10 Thread Rick Johnson
The Pros of Python Packages: Python packages require no special syntax to declare which modules are members of the package. Instead, Python simply allows the

PyWart: Python modules are not so modular after all!

2013-11-10 Thread Rick Johnson
The Pros of Python Modules: Python modules require no special syntax to create, nor do they induce extra indentation in your source code to maintain readability.

Re: New user's initial thoughts / criticisms of Python

2013-11-10 Thread Rick Johnson
On Saturday, November 9, 2013 10:30:26 AM UTC-6, rusi wrote: [...] Well print ( {mon:mondays suck, tue:at least it's not monday, wed:humpday }.get(day_of_week,its some other day) ) may be dense Separate into named dictionary and its ok (I think!) Proper

Re: The narcissism of small code differences

2013-11-10 Thread Rick Johnson
On Saturday, November 9, 2013 6:42:04 AM UTC-6, Steven D'Aprano wrote: Uses an example written in Ruby, but don't let that put you off: Why would it? I write Ruby code all the time. Ruby code in and of itself does not bother me, what bothers me about Ruby is the ease at which a programmer can

Re: Creating a function for a directory

2013-11-11 Thread Rick Johnson
On Monday, November 11, 2013 4:26:46 PM UTC-6, Matt wrote: So I want to take the file, desktop/test.txt and write it to desktop/newfolder/test.txt. I tried the below script, and it gave me: IOError: [Errno 2] No such file or directory: 'desktop/%s.txt'. Any suggestions would be great. def

Re: PyWart: Python modules are not so modular after all!

2013-11-11 Thread Rick Johnson
On Monday, November 11, 2013 1:34:54 AM UTC-6, Steven D'Aprano wrote: import sys sys.modules[mymodule] = any_object_you_like() Thanks for this great advice! I'm not particularly fond of injecting names and objects in this manner due to the surprise factor, especially when the names are going

PyMyth: Global variables are evil... WRONG!

2013-11-11 Thread Rick Johnson
PyMyth: Global variables are evil... WRONG! Python's Global Hysteria: How many times have your heard or read the phrase: Global variables are evil? Well if you've been a

Re: PyMyth: Global variables are evil... WRONG!

2013-11-11 Thread Rick Johnson
On Monday, November 11, 2013 8:47:09 PM UTC-6, Tim Daneliuk wrote: I think this is certainly the use case most people would suggest. But I think you may have missed the real reason most modern designers object to inter-module globals: The presence of such entities almost always means the code

Re: Creating a function for a directory

2013-11-11 Thread Rick Johnson
On Monday, November 11, 2013 5:11:52 PM UTC-6, Chris Angelico wrote: On Tue, Nov 12, 2013 at 9:51 AM, Rick Johnson 1. i believe win32 file paths require a qualifying volume letter. They do not; omitting the drive letter makes the path relative to the current drive (and since it doesn't

Re: PyMyth: Global variables are evil... WRONG!

2013-11-12 Thread Rick Johnson
On Tuesday, November 12, 2013 8:12:10 AM UTC-6, jongiddy wrote: Can you please give an example where having a module provide a global variable would work better than any of: [snip] Well my point is that the attributes of any Python module are emulating globals already. The fact that we have

Re: PyMyth: Global variables are evil... WRONG!

2013-11-12 Thread Rick Johnson
On Tuesday, November 12, 2013 9:33:50 AM UTC-6, jongiddy wrote: I'm not sure where you get the feeling you're accessing an interface. Because the constant PI should never change. Sure we can argue about granularity of PI, but that argument has no weight on the fact that PI should be a constant.

Re: PyMyth: Global variables are evil... WRONG!

2013-11-12 Thread Rick Johnson
On Tuesday, November 12, 2013 11:00:37 AM UTC-6, Rick Johnson wrote: [snip] We have all been brainwashed by authorities. First they give us rules, then they give us the power to break those rules. The devil himself said it best: http://www.youtube.com/watch?v=RGR4SFOimlk Hmm. How do we

PyModule(G.py): Now Python has REAL globals -- and their scoped to boot!

2013-11-12 Thread Rick Johnson
# Copyright 2013, Rick rantingrick Johnson # # Permission to use, copy, modify, and distribute this software for # any purpose and without fee is hereby granted, provided that the above # copyright notice appear in all copies. # # THIS SOFTWARE IS PROVIDED AS IS AND WITHOUT ANY EXPRESS OR #

Re: PyMyth: Global variables are evil... WRONG!

2013-11-12 Thread Rick Johnson
On Tuesday, November 12, 2013 4:41:34 PM UTC-6, jongiddy wrote: On Tuesday, November 12, 2013 5:00:37 PM UTC, Rick Johnson wrote: 1. Accept that globals are useful, and make them available through a real global syntax, not some attribute of a module that appears

PyModule(C.py): Now Python has REAL constants -- and they're scoped to boot!

2013-11-12 Thread Rick Johnson
# Copyright 2013, Rick rantingrick Johnson # # Permission to use, copy, modify, and distribute this software for # any purpose and without fee is hereby granted, provided that the above # copyright notice appear in all copies. # # THIS SOFTWARE IS PROVIDED AS IS AND WITHOUT ANY EXPRESS OR #

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

2012-12-25 Thread Rick Johnson
On Tuesday, December 25, 2012 11:10:49 AM UTC-6, Dave Angel wrote: We all make mistakes, like my referring to class methods when I meant instance methods. This mistake reminded of how people in this group (maybe not you in particular) happily accept the terms instance method and class method

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

2012-12-25 Thread Rick Johnson
On Tuesday, December 25, 2012 3:08:21 PM UTC-6, Dennis Lee Bieber wrote: Only that many of us don't believe Python has /variables/, the use of instance/class as a modifier is thereby moot. What IS a variable Dennis? # #

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

2012-12-25 Thread Rick Johnson
On Tuesday, December 25, 2012 4:56:44 PM UTC-6, Steven D'Aprano wrote: Rick, what makes you think that this is logically inconsistent? Method is the accepted name for functions attached to classes. They report themselves as methods: [...] There are two built-ins for creating different types

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

2012-12-26 Thread Rick Johnson
On Wednesday, December 26, 2012 2:29:13 AM UTC-6, Steven D'Aprano wrote: [snip] I won't reply to your last post on a line-by-line basis because i feel we are straying from my general point: which is that we should NEVER re-interpret existing words (in an illogical manner) whilst transforming

Re: Most discussion on comp.lang.python is about developing with Python

2013-11-13 Thread Rick Johnson
Hello Bob, I understand your concern but you need to realize there is not much that can (or should) be done *IF* we want to live in societies that are free from oppression. The minute we start drawing lines in the sand and punishing people for exercising their freedom of speech, is when we

Re: PyMyth: Global variables are evil... WRONG!

2013-11-13 Thread Rick Johnson
On Wednesday, November 13, 2013 5:42:24 PM UTC-6, Rhodri James wrote: On Tue, 12 Nov 2013 02:06:09 -, Rick Johnson wrote: PyMyth: Global variables are evil... WRONG! That's not a PyMyth. It's a CompSciMyth, or to be more accurate a good general Software Engineering guideline regardless

Re: PyMyth: Global variables are evil... WRONG!

2013-11-13 Thread Rick Johnson
On Wednesday, November 13, 2013 4:00:15 PM UTC-6, Andrew Cooper wrote: And what do you do when the wizards bend space-time to make PI exactly 3, for the ease of other calculations when building a sorting machine? Are you telling me that these wizards can't be bothered to write the integer 3?

Re: PyMyth: Global variables are evil... WRONG!

2013-11-13 Thread Rick Johnson
On Wednesday, November 13, 2013 6:17:22 PM UTC-6, Tim Daneliuk wrote: But python modules can't be interfaces because interfaces should protect internal data, prevent external forces from meddling with internal state (EXCEPT via the rules of a predefined contract), hide dirty details from

Re: PyMyth: Global variables are evil... WRONG!

2013-11-13 Thread Rick Johnson
On Wednesday, November 13, 2013 7:09:42 PM UTC-6, Steven D'Aprano wrote: On Wed, 13 Nov 2013 23:42:24 +, Rhodri James wrote: On Tue, 12 Nov 2013 02:06:09 -, Rick Johnson wrote: Python has globals, but we just can't admit it! A different subject entirely, but no more accurately

Re: PyMyth: Global variables are evil... WRONG!

2013-11-13 Thread Rick Johnson
On Wednesday, November 13, 2013 8:45:16 PM UTC-6, Steven D'Aprano wrote: A fully-auto machine gun with a hair-trigger and no safety is no different from a single-barrel shotgun with a safety and a trigger lock! You can blow your foot off with both! Yes. But in the case of the shotgun

Re: PyMyth: Global variables are evil... WRONG!

2013-11-13 Thread Rick Johnson
And what's this? *picks up hat* Where did this hat come from??? Spectator interrupts: Maybe Steven threw his hat in? No, no. Can't be. Steven would not wear something this old. I mean, it looks like something a farmer would put on a scarecrow or something??? *scratched head* OH

Re: Automation

2013-11-13 Thread Rick Johnson
On Sunday, November 3, 2013 5:32:46 PM UTC-6, Denis McMahon wrote: Seems to me like you're using a sledgehammer to shell a peanut. And hopefully he knows whether or not he has a peanut allergy before he commits to enjoying the fruits of his labor. --

Re: Automation

2013-11-13 Thread Rick Johnson
bob gailer wrote: Does this have anything to do with statistics? Quantum theory? Telephony? P = Pluto, V = Venus, S = Saturn? Help us understand - then we *might* be able to help you. bob later gailer wrote: Oh ... will you please explain in good English and a lot more detail. I can

Re: PyMyth: Global variables are evil... WRONG!

2013-11-13 Thread Rick Johnson
On Wednesday, November 13, 2013 10:33:22 PM UTC-6, Roy Smith wrote: Wait, aren't you the guy who's into MUDs? Yes he is. But that's his second favorite hobby. His first is filling the Devils Advocate slot when Steven is too busy -- doing WHATEVER Steven does when he's not here. God only

Re: PyMyth: Global variables are evil... WRONG!

2013-11-14 Thread Rick Johnson
On Wednesday, November 13, 2013 11:50:40 PM UTC-6, Steven D'Aprano wrote: On Wed, 13 Nov 2013 19:45:42 -0800, Rick Johnson wrote: On Wednesday, November 13, 2013 8:45:16 PM UTC-6, Steven D'Aprano wrote: A fully-auto machine gun with a hair-trigger and no safety is no different from

Re: PyMyth: Global variables are evil... WRONG!

2013-11-15 Thread Rick Johnson
On Friday, November 15, 2013 2:19:01 AM UTC-6, Steven D'Aprano wrote: But with software, coupling is *easy*. By default, code in a single process is completely coupled. Think of a chunk of machine code running in a single piece of memory. We have to build in our own conventions for decoupling

Re: Fire Method by predefined string!

2013-11-17 Thread Rick Johnson
On Sunday, November 17, 2013 3:46:16 PM UTC-6, Tamer Higazi wrote: class(object): def Fire(self,param) #possible ?! self.__param(): def _DoSomething(self): print 'I did it!' 1. First off your class declaration is not valid -- it needs an identifier! 2.

Re: Fire Method by predefined string!

2013-11-17 Thread Rick Johnson
On Sunday, November 17, 2013 4:23:11 PM UTC-6, Rick Johnson wrote: 2. Never start a function or method with a lowercase letter. Please read PEP8 Urm... let me correct that: 2. Never start a function or method with a UPPERCASE letter. Initial uppercase should be reserved for class names only

Re: Oh look, another language (ceylon)

2013-11-17 Thread Rick Johnson
On Saturday, November 16, 2013 9:41:07 PM UTC-6, Gregory Ewing wrote: The type system looks very interesting! Indeed. I went to the site assuming this would be another language that i would never like, however, after a few minutes reading the tour, i could not stop! I read through the entire

Re: Oh look, another language (ceylon)

2013-11-18 Thread Rick Johnson
I've never *really* been crazy about the plus operator concatenating strings anyhow, however, the semantics of + seem to navigate the perilous waters of intuition far better than *. Addition of numeric types is well defined in maths: Take N inputs values and *reduce* them into a single

Re: Got a Doubt ! Wanting for your Help ! Plz make it ASAP !

2013-11-23 Thread Rick Johnson
On Friday, November 22, 2013 8:18:03 PM UTC-6, Steven D'Aprano wrote: [snip] I look forward to the day that rice is the plural of ri Yes and i look forward to the day when thread hijacking perpetrated under the guise of exploring linguistic minutia perpetrated under the guise of vanity is

Re: Got a Doubt ! Wanting for your Help ! Plz make it ASAP !

2013-11-23 Thread Rick Johnson
On Friday, November 22, 2013 8:18:03 PM UTC-6, Steven D'Aprano wrote: As this is an international forum, it behoves us all to make allowances for slight difference in dialect. I don't thank so. What purpose does that serve? If we allow people to speak INCORRECT English under the guise of

Re: Got a Doubt ! Wanting for your Help ! Plz make it ASAP !

2013-11-25 Thread Rick Johnson
On Saturday, November 23, 2013 7:38:47 PM UTC-6, Steven D'Aprano wrote: Where do you, an American, What the hell makes you believe I'm an American? Because i speak fluent English? Because i embrace capitalism? Because i wish to be free of tyranny? Well, if that's all it takes to be an American,

Re: Excute script only from another file

2013-11-25 Thread Rick Johnson
On Monday, November 25, 2013 4:52:46 AM UTC-6, Himanshu Garg wrote: My motive is I will give scripts to somebody else and he should not run the script directly without running the parent script. The only sure fire method to prevent a file containing Python code from executing on a machine

Re: Got a Doubt ! Wanting for your Help ! Plz make it ASAP !

2013-11-25 Thread Rick Johnson
On Monday, November 25, 2013 2:10:04 PM UTC-6, Ned Batchelder wrote: Let's please avoid veering off into rants about language and philosophy now. Hello Ned. I respect the fact that you want to keep threads on-topic, and i greatly appreciate the humbleness of your request. However, i feel as

Re: Excute script only from another file

2013-11-25 Thread Rick Johnson
On Monday, November 25, 2013 8:41:07 PM UTC-6, Chris Angelico wrote: Totally sure-fire. Absolutely prevents any execution until it's renamed. Doh! It seems Python's quite the sneaky little snake! By the way, what does associate mean, and what does it have to do with file names? Hmm, I did

Re: Got a Doubt ! Wanting for your Help ! Plz make it ASAP !

2013-11-26 Thread Rick Johnson
On Tuesday, November 26, 2013 8:52:11 AM UTC-6, Chris Angelico wrote: On Wed, Nov 27, 2013 at 1:37 AM, Roy Smith [...] wrote: We live in an international world (otherwise we wouldn't need that annoying unicode stuff). When you say, effort to be understandable, what you're really saying

Re: Excute script only from another file

2013-11-26 Thread Rick Johnson
On Tuesday, November 26, 2013 5:09:13 PM UTC-6, Chris Angelico wrote: My point was that Rick had made the assumption that the GUI was *everything* and that users were able to do nothing beyond double-clicking on icons For some people the GUI *is* everything. Most people are unaware that life

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Rick Johnson
On Tuesday, December 10, 2013 7:35:47 PM UTC-6, Dennis Lee Bieber wrote: NAILS Nails were verboten in my high school wood working class... We used dowels and glue; chisels to carve dove-tails; etc. That could be a result of two possibilities: 1. Your high school years were before the

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Rick Johnson
On Monday, December 9, 2013 2:53:30 PM UTC-6, bob gailer wrote: Taking the opposite perspective from Gene: I think Python is great as an intro to computing and programming. Give a student a tool with which he can be productive quickly. and with minimal effort. Understanding the real machine

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Rick Johnson
On Monday, December 16, 2013 8:33:11 PM UTC-6, Steven D'Aprano wrote: Of course, this is very hard to measure: different languages require different amounts of code to get something useful done. Different languages get used for different things -- there are no operating system kernels written

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Rick Johnson
On Sunday, December 15, 2013 11:01:53 AM UTC-6, Steven D'Aprano wrote: On Sun, 15 Dec 2013 14:53:45 +, Grant Edwards wrote: On 2013-12-14, Steven D'Aprano wrote: You seem to be equating was compiled from with includes an implemenation of. Do you say that CPython ships with C? Well,

Re: New to Python, Help to get script working?

2013-12-17 Thread Rick Johnson
On Monday, December 16, 2013 1:09:38 AM UTC-6, Mark wrote: On Sunday, December 15, 2013 9:33:17 PM UTC-5, Chris Angelico wrote: I went and looked at the post linked to, and it has buggy indentation. (Quite possibly indicates that the author has two-space tabs, and didn't notice a bug

Re: cascading python executions only if return code is 0

2013-12-22 Thread Rick Johnson
On Sunday, December 22, 2013 12:37:04 PM UTC-6, Frank Cui wrote: I have a requirement where I need to sequentially execute a bunch of executions, each execution has a return code. the followed executions should only be executed if the return code is 0. is there a cleaner or more pythonic way

Re: How can i return more than one value from a function to more than one variable

2013-12-23 Thread Rick Johnson
On Sunday, December 22, 2013 4:54:46 PM UTC-6, dec...@msn.com wrote: basically what I wanna do is this : x = 4 y = 7 def switch (z,w): ***this will switch z to w and vice verca*** c= z z=w w=c print 'Now x =', w, 'and y = ' , z return w x = switch(x,y) If

Re: cascading python executions only if return code is 0

2013-12-23 Thread Rick Johnson
On Sunday, December 22, 2013 5:02:51 PM UTC-6, Mark Lawrence wrote: On 22/12/2013 22:51, Chris Angelico wrote: if a() == 0: if b() == 0: c() I can only see one way that you can possibly intepret it. Hmm, I guess i should not assume color vision to be ubiquitous. [snip]

Re: Recovering deleted files

2013-12-26 Thread Rick Johnson
On Wednesday, December 25, 2013 10:44:39 PM UTC-6, George Tang wrote: I am new to python and was trying to program with txt files, and tried to move the txt file to a new directory. i did not read very carefully about what shutil.move(src, dst) does and it deleted some of my files. How do i

Re: On a scrollbar for tkinter

2014-01-02 Thread Rick Johnson
I know you're using Python3.x, so there may be new functionality in Tkinter that i am not aware of yet. I still have oodles of Python2.x dependencies and really don't see a need to make the jump yet -- so keep that in mind when taking my advice below. In the old days of Tkinter, if you wanted

Re: Tkinter GUI Error

2014-01-13 Thread Rick Johnson
On Monday, January 13, 2014 12:49:07 PM UTC-6, Lewis Wood wrote: labelent1 = Label(main, text=Correct!,fg=green).grid(row = 0, column = 3) [snip] UnboundLocalError: local variable 'labelent1' referenced before assignment Observe the following interactive session and prepare to be

Re: buggy python interpretter or am I missing something here?

2014-01-27 Thread Rick Johnson
On Monday, January 27, 2014 3:32:43 AM UTC-6, me wrote: On Mon, 27 Jan 2014 20:01:33 +1100, Chris Angelico wrote: [snip chris reply] You feel better now that you too have vented? I had a productive discussion with a couple of top level posters who helped me solve my problem and they

Re: buggy python interpretter or am I missing something here?

2014-01-27 Thread Rick Johnson
On Monday, January 27, 2014 9:53:37 AM UTC-6, Chris Angelico wrote: Heh. If you'd said Pike instead of REXX, I might have believed you :) I've said more about Pike than is perhaps appropriate, but of late, I've actually not been the one to most often quote REXX code. Yes in my haste to inject

PyWart: More surpises via implict conversion to boolean (and other steaming piles!)

2014-02-10 Thread Rick Johnson
## START CODE ### def foo(): # foo represents a patternless function # or method that returns a Boolean value # based on some internal test. # if 1==1: return True return False # # The fun begins when two tiny chars are

Re: Import order question

2014-02-18 Thread Rick Johnson
On Monday, February 17, 2014 1:40:41 PM UTC-6, Ben Finney wrote: Nagy László Zsolt ... writes: Use modules to group your class definitions conceptually. There is no need whatever to separate every class into a different module. If there is a consensus, and it is really desireable to put

Re: Bad Code Snippet of the Day

2014-02-18 Thread Rick Johnson
On Tuesday, February 18, 2014 10:47:15 AM UTC-6, Chris Angelico wrote: I call this Russian Exception Roulette. It came about because of some discussions on python-ideas regarding the new PEP 463 and exception handling. try: exc = getattr(__builtins__,random.choice(list(filter(lambda x:

Re: Import order question

2014-02-18 Thread Rick Johnson
On Tuesday, February 18, 2014 3:02:26 PM UTC-6, Chris Angelico wrote: On Wed, Feb 19, 2014 at 7:41 AM, Rick Johnson wrote: # ui_main.py from ui_mod1 import * from ui_mod2 import * from ui_mod3 import * from ui_mod4 import * At least by this method i can maintain

Re: Import order question

2014-02-18 Thread Rick Johnson
On Tuesday, February 18, 2014 4:17:48 PM UTC-6, Tim Chase wrote: On 2014-02-19 08:49, Chris Angelico wrote: At my last job, I had a single C++ file of roughly 5K lines, and it wasn't at all unmanageable. Probably wouldn't have been a problem to have another order of magnitude on that. What

Re: Import order question

2014-02-18 Thread Rick Johnson
On Tuesday, February 18, 2014 5:28:21 PM UTC-6, Rotwang wrote: I have music software that's a single 9K-line Python module, which I edit using Notepad++ or gedit. If I wish to find e.g. the method edit of class sequence I can type Ctrl-fclass seqReturndef edit(Return This is not about

Re: Nexus Programming Language

2012-06-10 Thread Rick Johnson
On Jun 10, 7:21 am, Colin J. Williams c...@ncf.ca wrote: On 10/06/2012 1:45 AM, rusi wrote: What does nexus have that python doesn't? Yeah I know this kind of question leads to flames but a brief glance at the about page does not tell me anything in this direction. It has a more complex

Re: Nexus Programming Language

2012-06-10 Thread Rick Johnson
On Jun 10, 12:45 am, rusi rustompm...@gmail.com wrote: On Jun 10, 7:46 am, Adam Campbell abcampbell...@gmail.com wrote: The Nexus programming language version 0.5.0 has been released. It is an object-oriented, dynamically-typed, reflective programming language, drawing from Lua and

Re: what gui designer is everyone using

2012-06-10 Thread Rick Johnson
On Jun 7, 4:18 pm, Kevin Walzer k...@codebykevin.com wrote: On 6/5/12 10:10 AM, Mark R Rivet wrote: I want a gui designer that writes the gui code for me. I don't want to write gui code. what is the gui designer that is most popular? None. I write GUI code by hand (Tkinter). I second that

Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-10 Thread Rick Johnson
On Jun 8, 7:27 am, Wolfgang Keller felip...@gmx.net wrote: This whole cycle of design GUI-generate code-add own code to generated code-run application with GUI has always seemed very un-pythonic to me. A dynamic, interpreted language should allow to work in a more lively, direct way to build

Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-10 Thread Rick Johnson
On Jun 9, 8:25 am, Dietmar Schwertberger n...@schwertberger.de wrote: Before anyone now writes Good GUIs are coded by hand: I agree, but for many purposes only simple GUIs are required and it should be possible to create these without studying manuals (on toolkit and GUI editor). It is

Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-10 Thread Rick Johnson
On Jun 10, 2:36 pm, Rick Johnson rantingrickjohn...@gmail.com wrote: # # Or become a pro and create reusable objects! # class LE(tk.Frame):     def __init__(self, master, **kw):         tk.Frame.__init__(self, master)         self.l = tk.Label(self, **kw)         self.l.pack(side=LEFT

Re: Passing ints to a function

2012-06-10 Thread Rick Johnson
On Jun 9, 3:29 am, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: Here's something you could have thought of for yourself even when you didn't remember that Python does have special built-in support for applying a function to a list of arguments: def five(func, args):    a, b, c, d, e =

Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-11 Thread Rick Johnson
On Jun 10, 11:05 pm, rusi rustompm...@gmail.com wrote: If python is really a language maven's language then it does not do very well: - its not as object-oriented as Ruby (or other arcana like Eiffel) if it were object-oreiented as Ruby, then why not use Ruby? - its not as functional as

Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-11 Thread Rick Johnson
On Jun 11, 9:09 am, Mark Roseman m...@markroseman.com wrote: Second, there does exist at least one fairly good source of documentation for new users wishing to do exactly this (according to many, many comments I have received), though that documentation is admittedly buried in a sea of

Re: Question:Programming a game grid ...

2012-06-27 Thread Rick Johnson
On Jun 27, 5:21 pm, iconoclast011 iconoclast...@gmail.com wrote: Fairly new to Python ... Is there a way to efficiently (different from my brute force code shown below) to set up a game grid of buttons (ie with pygame) responding to mouse clicks ?   I would want to vary the size of the grid

Re: code review

2012-07-02 Thread Rick Johnson
On Jul 2, 3:20 am, Chris Angelico ros...@gmail.com wrote: On Mon, Jul 2, 2012 at 6:11 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: c first_word second_word == third_word x I'm sure I don't have to explain what that means -- that standard chained notation for

Re: code review

2012-07-02 Thread Rick Johnson
On Jun 30, 9:06 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Sun, 01 Jul 2012 00:05:26 +0200, Thomas Jollans wrote: Yes. My sole point, really, is that normally, one would expect these two expressions to be equivalent: a b c (a b) c Good grief. Why would you

Re: code review

2012-07-02 Thread Rick Johnson
On Jul 2, 11:42 am, Chris Angelico ros...@gmail.com wrote: Rick, do you realize that you have to spoon-feed the interpreter with spaces/tabs when other interpreters just KNOW to drop back an indentation level when you close a brace? Yes. And significant white space is my favorite attribute of

Re: code review

2012-07-02 Thread Rick Johnson
On Jul 2, 2:06 pm, Thomas Jollans t...@jollybox.de wrote: On 07/02/2012 08:22 PM, Rick Johnson wrote: Agreed. I wish we had one language. One which had syntactical directives for scoping, blocks, assignments, etc, etc... BLOCK_INDENT_MARKER - \t BLOCK_DEDENT_MARKER - \n

Re: WxSlider Mouse Wheel Resolution

2012-07-02 Thread Rick Johnson
On Jul 2, 10:45 am, Wanderer wande...@dialup4less.com wrote: Is there a way to set the mouse wheel resolution for the wxPython wx.Slider? I would like to use the graphic slider for coarse control and the mouse wheel for fine control. Right now the mouse wheel makes the slider jump ten counts

Re: WxSlider Mouse Wheel Resolution

2012-07-02 Thread Rick Johnson
On Jul 2, 3:45 pm, Rick Johnson rantingrickjohn...@gmail.com wrote: [...]   MouseWheel - cb(MEDIUM)   MouseWheel+ControlKey - cb(FINE)   MouseWheel+ShiftKey - cb(COURSE) Of course some could even argue that three levels of control are not good enough; for which i wholeheartedly agree! A REAL

Re: Discussion on some Code Issues

2012-07-04 Thread Rick Johnson
On Jul 4, 6:21 pm, subhabangal...@gmail.com wrote: [...] To detect the document boundaries, I am splitting them into a bag of words and using a simple for loop as, for i in range(len(bag_words)):         if bag_words[i]==$:             print (bag_words[i],i) Ignoring that you are attacking

Re: simpler increment of time values?

2012-07-05 Thread Rick Johnson
On Jul 5, 10:19 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: The number of seconds in a day (true solar day) varies by between 13 and 30 seconds depending on the time of the year and the position of the sun. Indeed. Which proves that a time keeping system based on the

Re: tkFileDialogs

2012-07-06 Thread Rick Johnson
On Jul 6, 12:22 am, brandon harris brandon.har...@reelfx.com wrote: [...] import tkFileDialog # Won't start in or allow navigation to APPDATA test = tkFileDialog.askdirectory(initialdir='%APPDATA%') # Will start in and navigate to APPDATA test =

Re: simpler increment of time values?

2012-07-06 Thread Rick Johnson
On Jul 5, 12:16 pm, Chris Angelico ros...@gmail.com wrote: So it's even easier than I said. And bonus lesson for the day: Try things in the interactive interpreter before you post. :) but first: be sure to familiarize yourself with the many built-in python classes(sic). Re-inventing the wheel

Re: Tkinter.event.widget: handler gets name instead of widget.

2012-07-09 Thread Rick Johnson
On Jul 9, 12:58 am, Terry Reedy tjre...@udel.edu wrote: When posting problem code, you should post a minimal, self-contained example that people can try on other systems and versions. Can you create the problem with one record, which you could give, and one binding? Do you need 4 fields, or

Re: Python Interview Questions

2012-07-09 Thread Rick Johnson
On Jul 9, 12:40 pm, Tim Chase python.l...@tim.thechases.com wrote:  The second[or higher]-order ignorance of not knowing what pdb is (or, if you need more powerful debugging, how to do it) is sign the person hasn't been programming in Python much. So guru knowledge of pdb is prerequisite to

Re: Tkinter.event.widget: handler gets name instead of widget.

2012-07-10 Thread Rick Johnson
I've tried to condense your code using the very limited info you have provided. I have removed unnecessarily configuring of widgets and exaggerated the widget borders to make debugging easier. Read below for QA. ## START CONDENSED CODE ## records = range(4) CNF_SUBFRAME = { 'bd':5, #

Re: Tkinter.event.widget: handler gets name instead of widget.

2012-07-10 Thread Rick Johnson
Also: Q3: Why are you explicitly setting the name of your subFrame widgets instead of allowing Tkinter to assign a unique name?...AND are you aware of the conflicts that can arise from such changes[1]? Q4: Are you aware of the built-in function enumerate[2]? I see you are passing around indexes

Re: Python Interview Questions

2012-07-10 Thread Rick Johnson
On Jul 10, 4:29 am, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Why would you want to hire someone that knows something pointless as the version where feature X has been introduced ? Just tell him that feature X has been introducted in version Y, costless 2.5sec training. Don't you

Re: How to safely maintain a status file

2012-07-12 Thread Rick Johnson
On Jul 12, 2:39 pm, Christian Heimes li...@cheimes.de wrote: Windows's file system layer is not POSIX compatible. For example you can't remove or replace a file while it is opened by a process. Sounds like a reasonable fail-safe to me. Not much unlike a car ignition that will not allow starting

Re: Keeping the Console Open with IDLE

2012-07-15 Thread Rick Johnson
On Sunday, July 15, 2012 10:57:00 AM UTC-5, Chris Angelico wrote: On Mon, Jul 16, 2012 at 1:35 AM, rantingrickjohn...@gmail.com wrote: Besides, you can skip most of those steps by Shift+RightClicking the file icon and choosing Open Command Window Here. That's not standard. Me, I can invoke

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Rick Johnson
On Sunday, July 15, 2012 11:19:16 AM UTC-5, Ian wrote: On Sun, Jul 15, 2012 at 4:56 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: (For the record, I can only think of one trap for the unwary: time objects are false at *exactly* midnight.) Ugh, that's irritating. I can't

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Rick Johnson
On Sunday, July 15, 2012 1:01:58 PM UTC-5, Ian wrote: So now instead of having to understand how if handles arbitrary values, we have to understand how bool handles arbitrary values. How is that an improvement? Because we are keeping the condition consistent. We are not relying on implicit

Re: How to configure Tkinter Listbox to disable state keeping selected item highlighted

2012-07-18 Thread Rick Johnson
On Tuesday, July 17, 2012 8:55:21 AM UTC-5, Sarbjit singh wrote: I am having a problem configuring a listbox widget such that the selection remains highlighted even while it is set (programmatically) to the DISABLED state. Below code shows the problem: from Tkinter import * master = Tk()

Re: Sudden doubling of nearly all messages

2012-07-21 Thread Rick Johnson
On Saturday, July 21, 2012 5:48:29 AM UTC-5, Dave Angel wrote: Has anybody else noticed the sudden double-posting of nearly all messages in the python mailing list? Previously, I#39;ve seen some messages double posted, and it was nearly always a newbie, presumably posting via some low-end

Re: Sudden doubling of nearly all messages

2012-07-21 Thread Rick Johnson
On Saturday, July 21, 2012 6:16:24 PM UTC-5, Chris Angelico wrote: Just to clarify, I'm not advocating the [...snip...] Well. Well. Backpedaling AND brown-nosing in a single post. Nice! -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuples and immutability

2014-03-11 Thread Rick Johnson
On Thursday, February 27, 2014 4:18:01 PM UTC-6, Ian wrote: x += y is meant to be equivalent, except possibly in-place and more efficient, than x = x + y. In an ideal world, the speed of these two codes should be the same, of course i'm assuming that most competent language designers would

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Rick Johnson
On Tuesday, April 8, 2014 2:07:27 AM UTC-5, James Brewer wrote: I'm sure there will be a substantial amount of arrogance perceived from this question, but frankly I don't think that I have anything to learn from my co-workers, which saddens me because I really like to learn and I know that I

Re: threading

2014-04-08 Thread Rick Johnson
A overview of the Py-Venactular used in this thread: by Professor Rick # Finny Said:# # Threading is very difficult to get right

Re: threading

2014-04-09 Thread Rick Johnson
On Wednesday, April 9, 2014 8:50:59 AM UTC-5, Neil D. Cerutti wrote: [...] Plus Rufus Xavier Sasparilla disagrees with it. If you think you're going to argue in such an implicit manner as to the benefits of pronouns, then you should expect that an astute logician such as myself will tear you to

Re: Why Python 3?

2014-04-19 Thread Rick Johnson
On Friday, April 18, 2014 10:28:05 PM UTC-5, Anthony Papillion wrote: Hello Everyone, So I've been working with Python for a while and I'm starting to take on more and more serious projects with it. I've been reading a lot about Python 2 vs Python 3 and the community kind of seems split on

Return of an old friend

2011-11-24 Thread Rick Johnson
Hello Fellow Pythonistas, I am very glad to be back after an unfortunate incident caused my Google account to be deleted. Unfortunately for those of you that have been following along and supporting my crusade to bring fairness and humility to the python community, my old posts under rantingrick

  1   2   3   4   5   6   7   8   9   10   >