[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

A few minutes from the ILUGC meet - 23rd Dec, 2000



*****************************************************************************
       A few minutes from the ILUGC meet - 23rd  December, 2000
*****************************************************************************

The ILUGC met on the 23rd for the 30th time in its life at the IIT Computer
centre at what-was-scheduled-to-be-3:30-but-happens-at-4:30 pm. The 
attendance was weak with just 11 people trying to make the room noisy.

The Agenda as was planned were:
 1. Intro to the Python language by Prabhu
 2. Internetworking by Mr.MKS

Unfortunately MKS was out to Madurai and hence his lectures, I assume, will be
shifted over to the next meet. )-:

Right from 3:30, thinking there will be more visitors to the meet, we were just
chatting on a variety of topics ranging from Voting on ILUGC, DSL vs Cable
modems, etc.,. more of this later...

At about 4:30, impatient prabhu went to the white board to spread, his 
religion, python. A good recap of what was discussed during the last meet was 
given.

   Python is an interpreted, Object Oriented, High-Level, Dynamically typed
language with Good introspection abilities. Now that theses features were
described in the previous meet, more of the python data types, language
constructs, classes were seen.

  One convenient feature of python is the way the interpreter works. to invoke
  the interpreter just type python at the prompt:

  $ python
  Python 1.5.2 (#0, Apr  3 2000, 14:46:48)  [GCC 2.95.2 20000313 (Debian
  GNU/Linux)] on linux2
  Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
  >>>

  Python has a '>>>' prompt. Here one can type just about any python command
  and see it working immdly. Fire the python interpreter, you can do anything
  ranging from using-it-as-a-calculator to drawing-widgets-on-a-window.
  
  Python's data types can be broadly classified into two: Mutable -- that can
  be changed and Immutable -- that can't be. In python almost all the data
  types are considered as objects. There are some basic data types that python
  features:
     1. int, float, complex, etc.,
     2. Strings
     3. Lists
     4. tuples
     5. Dictionaries
  The numeric quantities such as int, float, etc., behave just as they would in
  other languages. But there's no simple method of type casting other than
  calling a function. For example to type cast a float to an int in C one would
  simply say 'blah=(int) f;' but in python this happens to be through a
  function that returns the integer of whatever you send it as a param. That is
  'blah=int(f)'. Strings are enclosed either by a `` " '' or by a `` ' ''.

  The important feature of the python language is the list. A list is something
  like an array which can hold, just, anything. The following example should
  make the usage of list a little clear.

  >>> my_list=[1]
  >>> print my_list[0]
  1
  >>> my_list.append(2)
  >>> print my_list
  [1, 2]
  
  A tuple is similar to a list but it is immutable. That is the elements once
  created cannot be removed or edited. But if the element is mutable and is not
  an immediate child of the tuple, that can be done:

  >>> c=(1,"ilugc", [1,"linux"])
  >>> c[0]
  1
  >>> c[0]=10
  Traceback (innermost last):
    File "<stdin>", line 1, in ?
  TypeError: object doesn't support item assignment
  >>> c[2]
  [1, 'linux']
  >>> c[2][1]='OpenBSD'
  >>> c
  (1, 'ilugc', [1, 'OpenBSD'])
  >>>

 hmmm... ravi must be quite happy with this example where OpenBSD replaces
 Linux.. (-; 

 But take a look at this:

 >>> c=(1,['OpenBSD', ('linux', 2)])
 >>> c
 (1, ['OpenBSD', ('linux', 2)])
 >>> c[1]
 ['OpenBSD', ('linux', 2)]
 >>> c[1][1][0]
 'linux'
 >>> c[1][1][0]='OpenBSD'
 Traceback (innermost last):
   File "<stdin>", line 1, in ?
 TypeError: object doesn't support item assignment
 >>>

 Now doesn't Linux rule? (-;

 There is another data type called 'dictionary'. Its one of the most
 interesting datatypes (not just because there was private joke going around
 due to the way its shortly pronounced it (-;) A Dictionary is similar to
 associative arrays. But the key can be anything, an object, a list, a class, 
 even a function! the dictionary can be constructed as follows:

 >>> mail = {"ilugc":"ilugc@xxxxxxxxxxxxxxxxxx"}
 >>> mail["subscribe"]="ilugc-REQUEST@xxxxxxxxxxxxxxxxxx"
 >>> what="ilugc"
 >>> mail[what]
 'ilugc@xxxxxxxxxxxxxxxxxx'
 >>> len (mail)
 2
 
 Now let's move on to the language constructs. All blocks of code are
 represented by indentations. There is no endblock command that specifies the
 end of a block of code. Let's consider the IF construct. The IF takes the
 syntax of 
    if <condition> : [single line statement] |
         [statement 1]
         [statement 2]
         ...
         [statement n]
    elif <condition> :
         [statement 1]
         ...
    else :
         [statement]
         ...

    [other statements not under if]
    .
    .
  There were voices against this indent-to-represent-code (who else is going 
  to raise this voice, obviously lisp/C programmers!). But Software
  Carpentry has chosen Python as THE scripting language of the future. 
  
  Similarly there are other constructs like the 
  while <condition>:
      [statements]

  The python-doc is very good when it comes to the get-the-fundae-right.

  Functions: functions are defined by the def statement. In python its all
  reference counted (except for very trivial data types such as int, float,
  etc.,) . So all functions take the references of the objects passed to them
  and not a copy of the object itself. So there is no fear of inefficient 
  memory handling. 

  def hw (strn):
     print hw + "!" , "say Hello World!"

  and in the actual main (there's nothing like a main function, all code not
  under any function block falls into the main). The above function would, if
  called as hw('suraj') would print 'suraj! say Hello World!'. if called as
  hw([1,10]) would print '[1, 10]! say Hello World!' cool huh?

  It would be of no use to use python to write a lot of procedural code. The
  most useful feature of python is its object orientedness. A class can be
  constructed by the class statement. Consider the following example:

  class <classname>(parent_class):
  "this class is a demo class"
  # but this is a comment
     def func(self, other_arg1, other_arg2):
          self.member_variable1 = other_arg1;
          self.member_variable2 = other_arg2;
     def __init__ (self):  #constructor
          self.list1=[]
   
 In python there is nothing as such called a private variable as in C++.
 It is expected of the developer not to use those members that he considers
 are private to the class. But, still, there's a way to do this -- the use of
 __member_[atmost one ``_'']. Python scrambles these members so that the
 outside world can't see this.
 
 In the above example, the string "this class is a demo class" is a
 documentation string. but the ones beginning with a ``#'' are comments. 
 The documentation strings are available as strings in class_name.__doc__ 

 For more details look into the python-doc.
  
 Thats all for the official agenda stuff. Then started the hot topic of
 how-do-we-vote? The main point was under the assumption that 'all luggies
 are lazy to send mail, asking for I-Want-The-Next-Meet-On... on the list is
 spam+flood_the_archives'. 
 
 There were a lot of suggestions: 
 1. insecure voting on chennailug.org as is available on 
 http://chennailug.org/phpised codenamed "insecure".
 
 2. vote through the self-destructing cookies codenamed "cookies"
 
  3. vote through mail... listen guys, this is one of the most interesting
  stuff... Srini-the-sleepless-scientist (-; came up with a hi-fi idea of 
 "encrypting the	username+expiry_date_of_vote+vote_choice" and sending this
 in a URL. The user merely clicks (or may have to use GPM to paste this into 
 the 'go' of lynx).	codenamed "url"
 
 4. send a seperate mail to someone prolly prabhu and then filter it through
 procmail and then run a script to count (something like 
 cat	'filterfile' | grep "Subject:vote=<number>" | wc -l) codenamed "mail"
 
 5. Give each member a password. Ask them to use the site to vote by filling
 in their name+passwd+vote combo to vote. But the problem was a who will bell
 the database? When a member subscribes to the list via
 ilugc-request@xxxxxxxxxxxxxxxxxx?subject=subscribe, and immdly wants to
 vote, the db at chennailug.org must be updated. We came up with ideas like
 running a cron job at chlug for updating the db -or- auto forwarding the 
 mail that prabhu gets when someone is subscribed to some special address 
 so that the script there can parse it.  This is a scalable option so that we
 can do a lot of stuff in the future (prolly build a slashdot2.org??)
 codenamed "secure"

 There was a vote to know how we should vote. 
 Vote results: insecure - 2; cookies - 3; url - 4; mail - 0;  secure - 2

 Winner: url? nop, the escape-colon-w-q was for "cookies". We are, to start
 with, implementing using cookies. 

 The other meet (at the outside of the Computer Centre) lasted for nearly an
 hour. The gang dispersed at about 8:30 pm. 

      "Let's vote to know how many people want voting on chennailug.org"
                                                   -- prabhu 
                                                   (at this meet)
 

          -suraj

-- 
In those days he was a wiser man than he is now. He used 
to fruquently take my advice.
		--Winston Churchill
---
Visit our home page at: www.chennailug.org
Send e-mail to 'ilugc-request@xxxxxxxxxxxxxxxxxx' with 'unsubscribe' 
in either the subject or the body to unsubscribe from this list.