Python - year-end ramblings

Bill Sconce sconce at in-spec-inc.com
Thu Dec 30 14:52:01 EST 2004


A couple (all right, three :) things, random thoughts as the year winds down.

1.  On Mon, 13 Dec 2004 16:01:51 -0500, Bill McGonigle
    <bill at bfccomputing.com> wrote:
    
    >    [...] a script [to] call the unix system call 'gethostbyname' 
    >    [...] Usage: ./gethostbyname.pl hostname.
    > 
    > --- start gethostbyname.pl ---
    > 
    > #!/usr/bin/perl -w
    > use strict;
    > use warnings FATAL => 'all';
    > use Socket;
    > 
    > my $host = shift;
    > my ($name,$aliases,$addrtype,$length, at addrs) = gethostbyname($host);
    > print join ( ', ' ,
    >               map(
    >                   inet_ntoa($_),
    >                   @addrs
    >               )
    >             ) . "\n";
    > 
    > --- end gethostbyname.pl ---
    
    
This was so cool I thought I'd have a look at what a similar script
written in Python would look like.  My effort(*):
    
--- start gethostbyname.py ---

#!/usr/bin/python
import socket, sys

host = sys.argv[1]      
name, aliases, addrs = socket.gethostbyname_ex(host)
print ', '.join(addrs)

--- end gethostbyname.py ---

(*) "effort" - all the real work is done by the library routine (as
it should be, for any language!)



2.  Registration for PyCon 2005 has just opened:
    http://www.python.org/pycon/2005/
    March 23-25, 2005, at the Cafritz Conference Center,
    Washington, DC  (same as last year)
    

    
3.  Would anyone hereabouts have an interest in getting together
    for an occasional evening someplace where there are lots of
    computers to play around with Python, compare notes/handy tips,
    etc?  A sort of Python SIG in GNHLUG?

    I think I can find the "lots of computers" if there's an interest.
    Let me know, off or on the list.
    

Best-in-2005'ly yours,

Bill





More information about the gnhlug-discuss mailing list