Re: pep 8 constants

2009-07-05 Thread Rhodri James
On Fri, 03 Jul 2009 15:52:31 +0100, MRAB pyt...@mrabarnett.plus.com wrote: Eric S. Johansson wrote: Horace Blegg wrote: I've been kinda following this. I have a cousin who is permanently wheel chair bound and doesn't have perfect control of her hands, but still manages to use a computer

Re: pep 8 constants

2009-07-05 Thread Tim Chase
You can get giant piano keyboards that you step on, so how about a giant computer keyboard? I wrote 5 miles of code before lunch! :-) You can get/make MIDI organ pedal-boards (a friend of mine has two). From there it's just one small step... Is that a two-step? a box-step? Count it

Re: pep 8 constants

2009-07-03 Thread Horace Blegg
I've been kinda following this. I have a cousin who is permanently wheel chair bound and doesn't have perfect control of her hands, but still manages to use a computer and interact with society. However, the idea/thought of disabled programmers was new to me/hadn't ever occurred to me. You say

Re: pep 8 constants

2009-07-03 Thread Eric S. Johansson
Horace Blegg wrote: I've been kinda following this. I have a cousin who is permanently wheel chair bound and doesn't have perfect control of her hands, but still manages to use a computer and interact with society. However, the idea/thought of disabled programmers was new to me/hadn't ever

Re: pep 8 constants

2009-07-03 Thread MRAB
Eric S. Johansson wrote: Horace Blegg wrote: I've been kinda following this. I have a cousin who is permanently wheel chair bound and doesn't have perfect control of her hands, but still manages to use a computer and interact with society. However, the idea/thought of disabled programmers was

Re: pep 8 constants

2009-07-03 Thread Terry Reedy
Eric S. Johansson wrote: Horace Blegg wrote: I've been kinda following this. I have a cousin who is permanently wheel chair bound and doesn't have perfect control of her hands, but still manages to use a computer and interact with society. However, the idea/thought of disabled programmers was

Re: pep 8 constants

2009-07-02 Thread Eric S. Johansson
Steven D'Aprano wrote: That assumes that every word is all caps. In practice, for real-life Python code, I've tripled the vocal load of perhaps one percent of your utterances, which cuts your productivity by 2%. If you have 1 words in you per day, and one percent get wrapped with a

Re: pep 8 constants

2009-07-02 Thread Lie Ryan
Eric S. Johansson wrote: Steven D'Aprano wrote: That assumes that every word is all caps. In practice, for real-life Python code, I've tripled the vocal load of perhaps one percent of your utterances, which cuts your productivity by 2%. If you have 1 words in you per day, and one

Re: pep 8 constants

2009-07-02 Thread Lie Ryan
Eric S. Johansson wrote: I've been working with speech recognition for 15 years. I've written something on the order of 10,000 lines of Python code both as open source and private projects. I've tried it least two dozen editors and they all fail miserably because they're focused on keyboard

Re: pep 8 constants

2009-07-01 Thread Eric S. Johansson
Tim Chase wrote: I've tried it least two dozen editors and they all fail miserably because they're focused on keyboard use (but understandable) [...snip...] I've tried a whole bunch, like I said at least a dozen. They all fail for first reasons such as inability to access all functionality

Re: pep 8 constants

2009-07-01 Thread Eric S. Johansson
Rhodri James wrote: Gah. Ignore me. I hit 'send' instead of 'cancel', after my musings concluded that yes, an editor could be smart enough, but it would have to embed a hell of a lot of semantic knowledge of Python and it still wouldn't eliminate the need to speak the keyboard at times.

Re: pep 8 constants

2009-06-30 Thread Rhodri James
On Tue, 30 Jun 2009 03:37:15 +0100, Eric S. Johansson e...@harvee.org wrote: Steven D'Aprano wrote: Why do you think a smart editing environment is in opposition to coding conventions? Surely an editor smart enough to know a variable name spoken as pear tree is an instance and therefore

Re: pep 8 constants

2009-06-30 Thread Rhodri James
On Tue, 30 Jun 2009 09:57:27 +0100, Rhodri James rho...@wildebst.demon.co.uk wrote: On Tue, 30 Jun 2009 03:37:15 +0100, Eric S. Johansson e...@harvee.org wrote: Steven D'Aprano wrote: Why do you think a smart editing environment is in opposition to coding conventions? Surely an editor

Re: pep 8 constants

2009-06-30 Thread Tim Chase
Eric S. Johansson wrote: Tim Chase wrote: It sounds like the issue should be one of making your screen-reader smarter, not dumbing down Python conventions. I don't know what SR you're using (Jaws? Window Eyes? yasr? screeder? speakup? Naturally speaking is speech recognition (speech in

Re: pep 8 constants

2009-06-30 Thread Rhodri James
[Trimming for length, sorry if that impacts too much on intelligibility] On Tue, 30 Jun 2009 02:52:37 +0100, Eric S. Johansson e...@harvee.org wrote: let's use an example. Admittedly, this is a very simple example but hopefully it illustrates my point What I dictate is: from pots is

Re: pep 8 constants

2009-06-30 Thread Jean-Michel Pichavant
Eric S. Johansson wrote: Ethan Furman wrote: Eric S. Johansson wrote: yup how long will i[t] be before you become disablesd? maybe not as badly as I am but you should start feeling some hand problems in your later 40's to early 50's and it goes down hill from there. self

Re: pep 8 constants

2009-06-30 Thread Eric S. Johansson
Rhodri James wrote: [Trimming for length, sorry if that impacts too much on intelligibility] no problem, one of the hazards of speech recognition uses you become very verbose. This goes a long way, but it doesn't eliminate the need for some forms of escape coming up on a moderately frequent

Re: pep 8 constants

2009-06-30 Thread Eric S. Johansson
Tim Chase wrote: Eric S. Johansson wrote: np. I get this confusion often. While I have used SR in some testing, I've found that while it's passable for prose (and even that, proclamations of 95% accuracy sound good until you realize how many words comprise 5% of your daily typing :),

Re: pep 8 constants

2009-06-30 Thread Tim Chase
I've tried it least two dozen editors and they all fail miserably because they're focused on keyboard use (but understandable) [...snip...] I've tried a whole bunch, like I said at least a dozen. They all fail for first reasons such as inability to access all functionality through keystrokes

Re: pep 8 constants

2009-06-30 Thread MRAB
Eric S. Johansson wrote: I've been working with speech recognition for 15 years. I've written something on the order of 10,000 lines of Python code both as open source and private projects. I've tried it least two dozen editors and they all fail miserably because they're focused on keyboard use

Re: pep 8 constants

2009-06-29 Thread Rhodri James
On Mon, 29 Jun 2009 06:07:19 +0100, Eric S. Johansson e...@harvee.org wrote: Rhodri James wrote: Reject away, but I'm afraid you've still got some work to do to convince me that PEP 8 is more work for an SR system than any other convention. [snip sundry examples] Yes, yes, recognition

Re: pep 8 constants

2009-06-29 Thread Tim Chase
Reject away, but I'm afraid you've still got some work to do to convince me that PEP 8 is more work for an SR system than any other convention. Name capname higher than normal recognition error rate. can require multiple tries or hand correction MultiWordName

Re: pep 8 constants

2009-06-29 Thread Eric S. Johansson
Peter Otten wrote: Eric S. Johansson wrote: MultiWordName capmulitno-spacecapwordnospacecapname very high error rate. many retries or hand hurting typing. Can you define macros in your speech recognition software? capmulticamelwordcamelname might slightly lower the error rate.

Re: pep 8 constants

2009-06-29 Thread Eric S. Johansson
alex23 wrote: Eric S. Johansson e...@harvee.org wrote: no, I know the value if convention when editors can't tell you anything about the name in question. I would like to see more support for disabled programmers like myself and the thousands of programmers injured every year and forced to

Re: pep 8 constants

2009-06-29 Thread Eric S. Johansson
Tim Chase wrote: It sounds like the issue should be one of making your screen-reader smarter, not dumbing down Python conventions. I don't know what SR you're using (Jaws? Window Eyes? yasr? screeder? speakup? Naturally speaking is speech recognition (speech in text out) it is not text

Re: pep 8 constants

2009-06-29 Thread Ethan Furman
Eric S. Johansson wrote: yup how long will i[t] be before you become disablesd? maybe not as badly as I am but you should start feeling some hand problems in your later 40's to early 50's and it goes down hill from there. self preservation/interest comes to mind as a possible motive for

Re: pep 8 constants

2009-06-29 Thread Eric S. Johansson
Ethan Furman wrote: Eric S. Johansson wrote: yup how long will i[t] be before you become disablesd? maybe not as badly as I am but you should start feeling some hand problems in your later 40's to early 50's and it goes down hill from there. self preservation/interest comes to mind as a

Re: pep 8 constants

2009-06-29 Thread Rhodri James
On Mon, 29 Jun 2009 20:28:07 +0100, Eric S. Johansson e...@harvee.org wrote: Rhodri James wrote: As far as I can tell, the only thing that you are even vaguely suggesting for convention use is underscores_with_everything. As promised, I laugh hollowly. I'm sorry. It may have been too

Re: pep 8 constants

2009-06-29 Thread Steven D'Aprano
On Mon, 29 Jun 2009 11:49:04 -0400, Eric S. Johansson wrote: alex23 wrote: Eric S. Johansson e...@harvee.org wrote: no, I know the value if convention when editors can't tell you anything about the name in question. I would like to see more support for disabled programmers like myself and

Re: pep 8 constants

2009-06-29 Thread Eric S. Johansson
Rhodri James wrote: Could you elucidate a bit? I'm not seeing how you're intending to keep PEP-8 conventions in this, and I'm not entirely convinced that without them the smart editor approach doesn't in fact reduce your productivity. thank you for asking for an elaboration. Programming

Re: pep 8 constants

2009-06-29 Thread Eric S. Johansson
Steven D'Aprano wrote: Why do you think a smart editing environment is in opposition to coding conventions? Surely an editor smart enough to know a variable name spoken as pear tree is an instance and therefore spelled as pear_tree (to use your own example) would be smart enough to know a

Re: pep 8 constants

2009-06-29 Thread Steven D'Aprano
On Mon, 29 Jun 2009 22:37:15 -0400, Eric S. Johansson wrote: Steven D'Aprano wrote: ... Sounds to me that your speech environment needs a command to turn capslock on and off, and your problem with PEP 8 is solved: you haven't used recognition, have you? No. x equals caps on red caps off

Re: pep 8 constants

2009-06-28 Thread Eric S. Johansson
Bruno Desthuilliers wrote: Brendan Miller a écrit : PEP 8 doesn't mention anything about using all caps to indicate a constant. Is all caps meaning don't reassign this var a strong enough convention to not be considered violating good python style? I see a lot of people using it, but I also

Re: pep 8 constants

2009-06-28 Thread Rhodri James
On Sun, 28 Jun 2009 15:09:21 +0100, Eric S. Johansson e...@harvee.org wrote: Bruno Desthuilliers wrote: Brendan Miller a écrit : PEP 8 doesn't mention anything about using all caps to indicate a constant. Is all caps meaning don't reassign this var a strong enough convention to not be

Re: pep 8 constants

2009-06-28 Thread Steven D'Aprano
On Sun, 28 Jun 2009 10:09:21 -0400, Eric S. Johansson wrote: Bruno Desthuilliers wrote: Brendan Miller a écrit : PEP 8 doesn't mention anything about using all caps to indicate a constant. Is all caps meaning don't reassign this var a strong enough convention to not be considered violating

Re: pep 8 constants

2009-06-28 Thread Eric S. Johansson
Rhodri James wrote: Reject away, but I'm afraid you've still got some work to do to convince me that PEP 8 is more work for an SR system than any other convention. Name capname higher than normal recognition error rate. can require multiple tries or hand correction MultiWordName

Re: pep 8 constants

2009-06-28 Thread alex23
Eric S. Johansson e...@harvee.org wrote: no, I know the value if convention when editors can't tell you anything about the name in question.  I would like to see more support for disabled programmers like myself and the thousands of programmers injured every year and forced to leave the

Re: pep 8 constants

2009-02-27 Thread Ethan Furman
Steve Holden wrote: Gabriel Genellina wrote: En Tue, 24 Feb 2009 22:52:20 -0200, Ethan Furman et...@stoneleaf.us escribió: Steve Holden wrote: Brian Allen Vanderburg II wrote: One idea to make constants possible would be to extend properties to be able to exist at the module level as

Re: pep 8 constants

2009-02-25 Thread Bruno Desthuilliers
Brendan Miller a écrit : PEP 8 doesn't mention anything about using all caps to indicate a constant. Is all caps meaning don't reassign this var a strong enough convention to not be considered violating good python style? I see a lot of people using it, but I also see a lot of people writing

Re: pep 8 constants

2009-02-25 Thread Bruno Desthuilliers
Ben Finney a écrit : (snip - about using ALL_CAPS for pseudo-constants) Perhaps I'd even argue for an update to PEP 8 that endorses this as conventional. +1 I've been a bit surprised last time I checked PEP8 to find out this wasn't already the case - I would have sweared it was. --

Re: pep 8 constants

2009-02-25 Thread Bruno Desthuilliers
Brian Allen Vanderburg II a écrit : bock...@virgilio.it wrote: Constants would be a nice addition in python, sure enough. But I'm not sure that this can be done without a run-time check every time the constant is used, and python is already slow enough. Maybe a check that is disabled when

Re: pep 8 constants

2009-02-25 Thread Bruno Desthuilliers
Ethan Furman a écrit : Steve Holden wrote: Brian Allen Vanderburg II wrote: (snip) One idea to make constants possible would be to extend properties to be able to exist at the module level as well as the class level: @property def pi(): return 3.14159. print(pi) # prints 3.14159

Re: pep 8 constants

2009-02-25 Thread Robin Becker
well this sort of awful hackery will allow you to put read only constants on an existing module import reportlab reportlab.__class__ class MyModule(reportlab.__class__): ... @property ... def pi(self): ... return 3 ... z=MyModule('reportlab')

Re: pep 8 constants

2009-02-25 Thread Bruno Desthuilliers
Robin Becker a écrit : well this sort of awful hackery will allow you to put read only constants on an existing module (snip example code) so I guess if you write your own module class and then use a special importer you can create module like objects with read only attributes. Fine

Re: pep 8 constants

2009-02-25 Thread Robin Becker
Bruno Desthuilliers wrote: Robin Becker a écrit : well this sort of awful hackery will allow you to put read only constants on an existing module (snip example code) so I guess if you write your own module class and then use a special importer you can create module like objects with read

Re: pep 8 constants

2009-02-25 Thread Rhodri James
On Wed, 25 Feb 2009 08:48:27 -, Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: Ben Finney a écrit : (snip - about using ALL_CAPS for pseudo-constants) Perhaps I'd even argue for an update to PEP 8 that endorses this as conventional. +1 I've been a bit surprised

Re: pep 8 constants

2009-02-24 Thread Steve Holden
Ethan Furman wrote: Steve Holden wrote: Brian Allen Vanderburg II wrote: bock...@virgilio.it wrote: Constants would be a nice addition in python, sure enough. But I'm not sure that this can be done without a run-time check every time the constant is used, and python is already slow

Re: pep 8 constants

2009-02-24 Thread Ethan Furman
Steve Holden wrote: Brian Allen Vanderburg II wrote: bock...@virgilio.it wrote: Constants would be a nice addition in python, sure enough. But I'm not sure that this can be done without a run-time check every time the constant is used, and python is already slow enough. Maybe a check that is

Re: pep 8 constants

2009-02-24 Thread Gabriel Genellina
En Tue, 24 Feb 2009 22:52:20 -0200, Ethan Furman et...@stoneleaf.us escribió: Steve Holden wrote: Brian Allen Vanderburg II wrote: One idea to make constants possible would be to extend properties to be able to exist at the module level as well as the class level: @property def pi():

Re: pep 8 constants

2009-02-24 Thread Steve Holden
Gabriel Genellina wrote: En Tue, 24 Feb 2009 22:52:20 -0200, Ethan Furman et...@stoneleaf.us escribió: Steve Holden wrote: Brian Allen Vanderburg II wrote: One idea to make constants possible would be to extend properties to be able to exist at the module level as well as the class level:

Re: pep 8 constants

2009-01-22 Thread Benjamin Kaplan
On Thu, Jan 22, 2009 at 1:16 AM, Aahz a...@pythoncraft.com wrote: In article mailman.7174.1231915778.3487.python-l...@python.org, Brendan Miller catph...@catphive.net wrote: PEP 8 doesn't mention anything about using all caps to indicate a constant. Now it does! See

Re: pep 8 constants

2009-01-22 Thread Terry Reedy
Benjamin Kaplan wrote: On Thu, Jan 22, 2009 at 1:16 AM, Aahz a...@pythoncraft.com mailto:a...@pythoncraft.com wrote: In article mailman.7174.1231915778.3487.python-l...@python.org mailto:mailman.7174.1231915778.3487.python-l...@python.org, Brendan Miller catph...@catphive.net

Re: pep 8 constants

2009-01-22 Thread Brian Allen Vanderburg II
bock...@virgilio.it wrote: Constants would be a nice addition in python, sure enough. But I'm not sure that this can be done without a run-time check every time the constant is used, and python is already slow enough. Maybe a check that is disabled when running with optimizing flags ? But I'm

Re: pep 8 constants

2009-01-22 Thread Steve Holden
Brian Allen Vanderburg II wrote: bock...@virgilio.it wrote: Constants would be a nice addition in python, sure enough. But I'm not sure that this can be done without a run-time check every time the constant is used, and python is already slow enough. Maybe a check that is disabled when

Re: pep 8 constants

2009-01-22 Thread Benjamin Peterson
Benjamin Kaplan benjamin.kaplan at case.edu writes: On Thu, Jan 22, 2009 at 1:16 AM, Aahz aahz at pythoncraft.com wrote:In article mailman.7174.1231915778.3487.python-list at python.org, Brendan Miller catphive at catphive.net wrote:PEP 8 doesn't mention anything about using all caps to

Re: pep 8 constants

2009-01-21 Thread Aahz
In article mailman.7174.1231915778.3487.python-l...@python.org, Brendan Miller catph...@catphive.net wrote: PEP 8 doesn't mention anything about using all caps to indicate a constant. Is all caps meaning don't reassign this var a strong enough convention to not be considered violating good

Re: pep 8 constants

2009-01-21 Thread Aahz
In article mailman.7174.1231915778.3487.python-l...@python.org, Brendan Miller catph...@catphive.net wrote: PEP 8 doesn't mention anything about using all caps to indicate a constant. Now it does! See http://www.python.org/dev/peps/pep-0008/ Thanks for bringing this up! -- Aahz

Re: pep 8 constants

2009-01-20 Thread Rhodri James
On Tue, 20 Jan 2009 04:58:30 -, Ben Finney bignose+hates-s...@benfinney.id.au wrote: Unless someone's going to argue that “Variable Names” doesn't apply to constant names, even though Python doesn't make the distinction. Python doesn't make the distinction, which is precisely why making

Re: pep 8 constants

2009-01-19 Thread Brendan Miller
Constants would be a nice addition in python, sure enough. My original question was about PEP-8 and whether it is pythonic to use all caps to denote a variable that shouldn't be changed. More of a style question than a language question. I actually think *enforcing* constantness seems to go

Re: pep 8 constants

2009-01-19 Thread Steven D'Aprano
On Mon, 19 Jan 2009 19:11:16 -0800, Brendan Miller wrote: Constants would be a nice addition in python, sure enough. My original question was about PEP-8 and whether it is pythonic to use all caps to denote a variable that shouldn't be changed. More of a style question than a language

Re: pep 8 constants

2009-01-19 Thread Ben Finney
Steven D'Aprano ste...@remove.this.cybersource.com.au writes: But regardless... yes, it is in my opinion Pythonic to use ALLCAPS to designate constants (by convention). I agree, in general. Though I think I can count the number of times I've wanted to use an ‘UPPER_CASE’-named constant in my

Re: pep 8 constants

2009-01-18 Thread Francesco Bochicchio
On Wed, 14 Jan 2009 08:13:30 +, Steven D'Aprano wrote: Absolutely. It's rather sad that I can do this: import math math.pi = 3.0 I like the ability to shoot myself in the foot, thank you very much, but I should at least get a warning when I'm about to do so: math.PI = 3.0 #

Re: pep 8 constants

2009-01-18 Thread MRAB
Francesco Bochicchio wrote: On Wed, 14 Jan 2009 08:13:30 +, Steven D'Aprano wrote: Absolutely. It's rather sad that I can do this: import math math.pi = 3.0 I like the ability to shoot myself in the foot, thank you very much, but I should at least get a warning when I'm about to do so:

Re: pep 8 constants

2009-01-14 Thread Steven D'Aprano
On Tue, 13 Jan 2009 23:26:54 -0800, Brendan Miller wrote: I tend to use constants as a means of avoiding the proliferation of magic literals for maintenance reasons... Like say if your example of FOO would have been used in 10 places. Maybe it is more pythonic to simply denote such a thing as

Re: pep 8 constants

2009-01-14 Thread Benjamin Kaplan
On Wed, Jan 14, 2009 at 3:13 AM, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 13 Jan 2009 23:26:54 -0800, Brendan Miller wrote: I tend to use constants as a means of avoiding the proliferation of magic literals for maintenance reasons... Like say if your example of

Re: pep 8 constants

2009-01-14 Thread Albert Hopkins
On Wed, 2009-01-14 at 16:58 +1000, James Mills wrote: [...] Still I would avoid using this idiom altogether and jsut stick with default values. For Example: FOO = 1 def f(x=FOO): ... Use this instead: def f(x=1): ... That only works well when 1 is only used once, and as an

pep 8 constants

2009-01-13 Thread Brendan Miller
PEP 8 doesn't mention anything about using all caps to indicate a constant. Is all caps meaning don't reassign this var a strong enough convention to not be considered violating good python style? I see a lot of people using it, but I also see a lot of people writing non-pythonic code... so I

Re: pep 8 constants

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 4:49 PM, Brendan Miller catph...@catphive.net wrote: PEP 8 doesn't mention anything about using all caps to indicate a constant. Is all caps meaning don't reassign this var a strong enough convention to not be considered violating good python style? I see a lot of

Re: pep 8 constants

2009-01-13 Thread Brendan Miller
FOO = 1 def f(x=FOO): ... Use this instead: def f(x=1): ... I tend to use constants as a means of avoiding the proliferation of magic literals for maintenance reasons... Like say if your example of FOO would have been used in 10 places. Maybe it is more pythonic to simply denote