(Not an answer to your question, but a philosophical answer...)

Don't worry too much about naming.  I've spent far too much time in my life 
doing that, and it doesn't *really* gain you anything.  So what if you use up 
the "whatever.blah" attribute.  There are a million other attributes you can 
have.  So what if you use up the "Bilge" class, you can always create another 
class with another name.

The important thing is that you design your system so that if something uses 
the "Bilge" class it doesn't have to be known as "Bilge" to the end-user.  (In 
particular, I'm thinking about tables in databases.  Just because it's in the 
"documents" table doesn't mean it has to be called a "document" to the user, it 
might be a "Record" or an "Item" or a "Sheet" ..) Those end-user displayable 
things should be totally separate from what your code calls 'em.

The one case where naming is somewhat important is if you are building an API 
that lots of people will use.  (For example, in my pgu library, I did my best 
to name the gui widgets using fairly standard names.  I looked at what HTML and 
Qt named their widgets and generally used the same naming.)

The other one case is when naming tables and fields in databases, or anything, 
you always want to make sure you don't use a reserved word.  (I've had some 
hassle in databases by naming tables "user" instead of "users" ... I've also 
had trouble with pgu naming a variable "as".)  Reserved words can get you in 
weird ways.  Don't use those :)

Heh - don't know if this answers any of your question - but almost every day I 
have to remind myself that decisions about naming aren't that important.  
Because frequently I find myself sitting in my chair for an hour trying to 
decide stuff like that, which, in the long run doesn't really seem to make a 
difference.

Later,
Phil

Charles Christie <[EMAIL PROTECTED]> wrote: self.rect is already used by the 
pygame.sprite.Sprite class.

On 4/24/07, Samuel Mankins <[EMAIL PROTECTED] > wrote:I agree with Jason. Also, 
self.rect is the predefined value for where
 the widget is, I believe.

--Skizzaltix

Jason Massey wrote:
> Don't you think that the "explicit is better than implicit" in import
> this gives you some help?
>
> I'd stick with the  self.location
>
>
>
> On 4/23/07, * Kris Schnee* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote: 
>
>     A trivial question that's bugging me:
>
>     A Widget object currently has a variable called "location," which is a
>     Pygame.Rect object. It _is_ a Rect, but what it _means_ is the 
>     Widget's
>     location. Is it better to call it " self.location" or "self.rect"?
>
>     Even typing "import this" at the IDLE console gives no clear insight. 
>
>     Kris
>
>



 

       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

Reply via email to