[Tutor] Re: [Offlist] Slightly OT: public/private class members

Jerry Jorgenson jerry@j3iss.com
Fri Feb 14 13:55:20 2003


> Yes, Perl has the "my" keyword before the declaration.  I imagine that
> this might not get implemented without a fundamental change to the
> Python syntax (such as allowing variables to be declared without being
> initialized -- might be kind of weird looking and confusing, though).

I should say that I also use the my as documentation for the variable.
That is, they look like this:

my (@octets) = @_;      # List of octects
my $octet;              # Octet to process
my $octetOut;           # Return expanded octet
my $restOfLine;         # Discription of ip address
my $sortKey;            # Concatenated, expanded ipaddress
my @answers;            # holds the results

my @hostEntries;        # Holds a record of data from /etc/hosts

My hope is that with the additional comments at the begining of the
function/subroutine/program the next person to work on the code
will have a clue (including me).

Jerry

Jerry Jorgenson
jerry@j3iss.com
http://www.j3iss.com/
972-897-1166 (Cell)
972-209-0191 (Page)