---------- Forwarded message ----------
From: "Vijay Kumar" <[email protected]>
Date: Oct 27, 2012 6:53 PM
Subject: [chennaipy 1449] October Meet Minutes
To: <[email protected]>
Hi Everyone,
we had a great meet this time, with about 10 people participating.
We started with the customary introduction to Python, since there were
lot of people who had just started with Python.
We then moved on to the "Classes and Methods" talk by
Rengaraj. Rengaraj demonstrated classes and objects by creating an
empty class called `Point`, instantiating it, and then adding members
to the object.
------
> class Point(object):
>>>
>> ... pass
> p = Point()
>>> p.x = 10
>>> p.y = 20
>>>
>> ------
He then showed how to create a initialized object by defining the
`__init__()` method. He also explained the mandatory first argument,
which is used to pass the object itself. He then added another helper
method to calculate the distance of the point from the origin. One
question worth mentioning was raised by Gurpreet. He was surprised
that attributes get created by just assigning to them. He wanted to
know if this is good or bad? Vijay explained that the Python, unlike
languages like Java, doesn't constrain the developer too much. It
gives freedom to the developer, and the developer is supposed to use
freedom with responsibility.
We then moved on to the "Idioms and Anti-Idioms" talk by Vijay. Vijay
first explained an anti-idiom with module import. He explained why
`from module import *` is bad. He showed how that can overshadow
built-ins, local definitions and definitions from other modules. He
said the better way to do this is to explicitly specify the
definitions required from the module, as in `from module import x, y, z`
He then moved on to another anti-idiom with exceptions. He explained
why a blanket `try ... except` block, as shown below is bad.
------
try:
fp = open(filename)
except:
print "error opening file"
------
He showed what happened when the `open` function was misspelt, and how
it mattered more in Python, than in other languages like Java. He then
explained the right way to do it, is to explicitly specify the
exception to catch.
After the talks, Vijay wanted know anybody was interested in
giving a talk next meet. Arunram, Rengaraj and Gurpreet offered to
talk in the next meet. He also asked for suggestions, for Chennaipy,
and the following topics were suggested for the upcoming meets.
1. GUI toolkits
2. Socket programming
3. Algorithm implementation
Vijay also suggested that we take up a small program, implement it and
then review the implementation during the next meet. He also suggested
that we could iterate this by adding more features. He said he will be
sending out a mail asking for suggestions on the program to implement.
Gurpreet, raised a question about doctest. He wanted to know if that
was good way of unit testing code. Vijay, put the audience to
perspective by telling them what docstrings are and what doctests
are. He then explained that doctests were used to ensure that the
documentation is in sync with the code, and not the other way
around. And that, it is not the best way to do unit testing.
With this, we came to the end of another wonderful Python meet.
Regards,
Vijay
--
You received this message because you are subscribed to the Google Groups
"Chennaipy" group.
Wiki at
http://nrcfosshelpline.in/**chennaipy/<http://nrcfosshelpline.in/chennaipy/>
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to chennaipy-unsubscribe@**
googlegroups.com <[email protected]>
For more options, visit this group at http://groups.google.com/**
group/chennaipy?hl=en <http://groups.google.com/group/chennaipy?hl=en>
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc