Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: No Thoughts about Everything

Reply
Thread Tools

Re: No Thoughts about Everything

 
 
Dave Brueck
Guest
Posts: n/a
 
      02-25-2004
Bernhard wrote:
[snip]
> while using Java. I kindly ask for help to transfer that simple, single
> line intelligent to python in the best possible way:
>
> static final double c=2.99792458e8;
> How can I create such a "class constant" (static final / recipe 5.15 and
> 5.6 in one) in python as short as possible?


class Foo:
BAR = 10

Voila! BAR is now a "class constant" - shared among all instances of the class
Foo (in theory it's not a constant, but in practice it is ).

HTH,
Dave


 
Reply With Quote
 
 
 
 
Arthur
Guest
Posts: n/a
 
      02-25-2004
On Wed, 25 Feb 2004 08:55:45 -0700, "Dave Brueck"
<> wrote:

>class Foo:
> BAR = 10
>
>Voila! BAR is now a "class constant" - shared among all instances of the class
>Foo (in theory it's not a constant, but in practice it is ).
>
>HTH,
>Dave
>


But not 'final'.
I am only anticipating a response.

IMO - if I am understanidng the issues correctly - it is a perfectly
adequate solution. Simple to get across to beginners..

The issue of making the constant 'final' is a production programming
issue. And whether Python does or does not need it is not an issue
relative to teaching beginners. The fact that production programming
concerns are introduced at that stage of the game is, I think, where
many who would otherwise have an intellectual intererst in programming
fall of the wagon. Wanting to understand programming and wanting to
be a production programmer can be very different things.

I know not to change "PI" into something PI isn't. No one needs to
explain that to me. Adding that I couldn't even if I wanted to -
that's nice.

Though, as Dennis Miller likes to sign-off:

I could be wrong.

Art




 
Reply With Quote
 
 
 
 
Dave Brueck
Guest
Posts: n/a
 
      02-25-2004
Arthur wrote:
> >class Foo:
> > BAR = 10
> >
> >Voila! BAR is now a "class constant" - shared among all instances of the

class
> >Foo (in theory it's not a constant, but in practice it is ).
> >
> >HTH,
> >Dave
> >

>
> But not 'final'.
> I am only anticipating a response.
>
> IMO - if I am understanidng the issues correctly - it is a perfectly
> adequate solution. Simple to get across to beginners..
>
> The issue of making the constant 'final' is a production programming
> issue. And whether Python does or does not need it is not an issue
> relative to teaching beginners. The fact that production programming
> concerns are introduced at that stage of the game is, I think, where
> many who would otherwise have an intellectual intererst in programming
> fall of the wagon. Wanting to understand programming and wanting to
> be a production programmer can be very different things.


True, but IMO this particular issue is invalid as a "production programming
concern" as well - it doesn't prevent any problems that actually occur in
practice, or if it does, you have bigger problems on your hands. It falls into
the same bucket of concerns as "our programmers are untrained monkeys and/or
are seeking to destroy our company from the inside".

-Dave


 
Reply With Quote
 
Dang Griffith
Guest
Posts: n/a
 
      02-26-2004
On Wed, 25 Feb 2004 10:57:30 -0700, "Dave Brueck"
<> wrote:

>Arthur wrote:
>> >class Foo:
>> > BAR = 10
>> >
>> >Voila! BAR is now a "class constant" - shared among all instances of the

>class
>> >Foo (in theory it's not a constant, but in practice it is ).
>> >
>> >HTH,
>> >Dave
>> >

>>
>> But not 'final'.
>> I am only anticipating a response.
>>
>> IMO - if I am understanidng the issues correctly - it is a perfectly
>> adequate solution. Simple to get across to beginners..
>>
>> The issue of making the constant 'final' is a production programming
>> issue. And whether Python does or does not need it is not an issue
>> relative to teaching beginners. The fact that production programming
>> concerns are introduced at that stage of the game is, I think, where
>> many who would otherwise have an intellectual intererst in programming
>> fall of the wagon. Wanting to understand programming and wanting to
>> be a production programmer can be very different things.

>
>True, but IMO this particular issue is invalid as a "production programming
>concern" as well - it doesn't prevent any problems that actually occur in
>practice, or if it does, you have bigger problems on your hands. It falls into
>the same bucket of concerns as "our programmers are untrained monkeys and/or
>are seeking to destroy our company from the inside".
>

+1 on this. If the code has gotten to production, and someone is
changing (or trying to and silently failing) a final/constant value,
something seems a little non-production about it. What's the Wiki
term? CodeSmell?
--dang
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not Quite Everything for a Theory of Everything fitz VOIP 0 02-28-2010 04:42 PM
FIREFOX IS GREAT, EVERYTHING WILL LOAD Big Craigie Firefox 4 04-21-2005 12:38 AM
Firefox 1.0 "Looking up" everything, not finding it. s... Firefox 2 01-03-2005 08:34 AM
No Thoughts about Everything b-blochl Python 5 02-29-2004 03:48 AM
No Thoughts about Everything bblochl Python 1 02-26-2004 08:34 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57