What is Python?

Tim Hammerquist tim at degree.ath.cx
Thu Sep 21 19:35:53 EDT 2000


William Tanksley <wtanksle at dolphin.openprojects.net> wrote:
> On Wed, 20 Sep 2000 17:51:01 GMT, Tim Hammerquist wrote:
> >Those curse symbols have spoiled me, I admit.  When I can just tell by
> >looking at a variable whether it's a scalar, array, hash, or function
> >instead of having to remember how I defined it to begin with, I can
> >get on with the coding.  This comes in handy in scaled apps when you
> >can't remember defining it at all.
> 
> >And I just never got into that whole Visual Basic convention:
> 
> That's just about the quickest crayfishing I've ever seen.  Either you
> like having the variable tell you what type of data it contains, or you
> don't.  Which one?

Perl's $/@/%/& punctuation is a builtin feature which aids in
identification and also interpolation.

The VB convention I mentioned is just that: a convention.  It's not
anything that is forced or even consistent; just a pseudo-tradition
eminating from Redmond like last week's mildewing running shorts.

Besides $ is shorter than most of the VB conventions I cited, such
as 'str'. Some VBers even spell out 'float' as a varname prefix.

OTOH, I shouldn't bash the concept itself.  The prefix convention
started at least as far back as C, with iIndex, fPrice, and cInitial.
VB just made it more verbose by an order of magnitude.

> I like both approaches, but in languages like Python and Perl, the
> variable holds data but is clearly not the data (because you can put
> ANYTHING you want into the same variable).  Therefore, there's no reason
> to make the variable be named after the data, unless you actually need the
> type at some point -- and then why force the programmer to use only the
> language's predefined types (as nice as they may be)?

I have to agree with you here.  Which brings to mind a metaphor to
explain Perl's use of it's curse characters: they dereference the
variable, while implicating type and context at the same time. Ergo:

	printf("%.2", $answer);   // Perl
is loosely similar in principle to:
	printf("%.2", *var_ref);  // C

-- 
-Tim Hammerquist <timmy at cpan.org>
I don't want to belong to any club
that would have me as a member.
	-- Groucho Marx



More information about the Python-list mailing list