Thursday, July 31, 2008

DFW Pythoneers, 4th Sat July, Topics Covered

For the 4th Saturday meeting of July, we had a good group show up for the beginners session at 1pm. The target audience were existing programmers new to Python. We had 10 people besides myself there and then at the regular 2pm start time, some people left and some came in, raising it to 12 people. I presented on the underlying concepts of Python that make it easy to learn yet powerful.

We covered introspection at the Python prompt, using dir(), type(), id() and help() to examine your environment as well as the useful "python -v" and "python -i" arguments. Then we got into names and values and how they are organized into namespaces everywhere you turn in Python. We got into the differences between 'is' and '==', mutability, shared vs non-shared structures and whether names are by-ref or by-value. I went over the simple values then the compound values like mappings, sequences and sets.

Around 2pm when the main meeting began we went over how a Python source file is structured, how it gets converted into multiple codeblocks, which are executed immediately and which are executed later. This was a tricky concept for some with lots of discussion. We covered how the Python module system is derived from that for Modula-3, the various kinds of import statements, the true meaning of the global statement (i.e. not really global overall), how modules are aggregated into a navigable top-level set of in-memory namespaces and some of the metadata you can find in them, like __name__ and __file__.

We took a look at the most common modules all programmers should know, such as __builtins__, sys, os, os.path, string and re (derived from Perl), and a bit on the types module. We reviewed the various control structures that Python gives us and also the ones it lacks, such as switch/case and do/while. We looked at the exception model of Python, how it differs from other languages in its continuability and restartability and the correct usage of exceptions in Python for error conditions, not normal control flows.

We touched lightly on the underlying behavior protocols of Python, for object, number, sequence, mapping, iterator and buffer, how Python uses protocols instead of class derivation for grouping behavior. We then got into Python's idea of OOP, the topmost object class, initializers/destructors and the binding of self and what it means when you have an unbound method. We sidestepped metaclasses and the type hierarchy for now but got in a mention of ducks (type peeking), turtles (all the way down) and monkeys (patching).

And because it is such a key concept, we went over 'callables', how different things can be called transparently and the powerful argument passing mechanism Python uses re positional, keyword and default. We touched a bit on what it means to be iterable and moved on to the more concrete ideas of being subscriptable, from/upto, negative ordinals and subscript ranges or slicing. The third slice argument for skipping, forward and backward, was a popular topic.

It was almost 5pm by then and we were running out of time, so we briefly covered predicates; if a == b, if a is b, if a/not a, and the has_key (in) and hasattr tests. We wrapped up with a couple of short code walkthroughs just to see the concepts in use.

----
This kind of presentation was an experiment to see if there is a demand in our group for a return to the basics of the Python code instead of covering the web framework flavor of the week. Based on this first response, it seemed popular so we'll do it some more at future meetings. I'm going to try to break it apart into relatively standalone topic chapters and, when I do, make those materials available online.

I'll be at WorldCon during our 2nd Sat meeting of August but we'll do this again for the 4th Sat meeting.

Wednesday, July 16, 2008

pyCologne Python User Group, Cologne, Germany, July 9, Notes

The Python User Group in Cologne met at the computer centre of the University of Cologne. The meeting was attended by 16 people. German speakers might want to refer to our wiki page: http://www.pycologne.de.

The meeting started with some introductory statements from Rex Turnbull:
  • Short talks and talks in general from everybodies work experience are very welcome at any of our meetings.
  • Klaus Bremer suggests to give a talk on Web-Applications-Development with Python at one of the next Meetings.
  • Suggestion: The call for talks and discussion-topics sent by e-mail should be earlier in advance (Now: about 2 weeks)
  • Suggestion: There should be a report about the Europython conference from the participants within the next meeting.
Rex welcomed todays new participants and as usual there was a short presentation of everyone.

Then we got down to the talks:

Creation of strange pictures using Turtle-Graphics (Günter Jantzen):

Günter gave a short introduction into Turtle-Graphics and Python's Turtle-Graphics-Module and showed us
some amazing pictures:
  • The Turtle-Graphics module is based on Tkinter
  • The drawing scheme uses the model of a turtle which can advance forward and turn about a certain angle. While moving it draws a line.
  • Günter showed some graphics which based on a spiral drawing pattern.
  • He discussed the problem that float values can get inexact for certain big numbers and exponents. This problems are visible within the graphics and can be solved by using the modulo function.
The sources can be found at http://wiki.python.de/User_Group_K%C3%B6ln/Protokoll_20080709?action=AttachFile&do=get&target=distel2.zip

The Hotwire-Shell (Michael Kesper):

Michael gave an introduction into the Hotwire-Shell, a modern, object-oriented shell.
  • Hotwire-Shell is written in Python and features a graphical user-interface.
  • Usual commands like "ls" and "cat" are available. The difference to a normal shell is the presentation of the result within a type specific view. (a directory-listing or a scrollable text-file-browser)
  • Results of previous commands are stored and can be used as input for the next command. (Dynamic creation of a pipeline.)
  • Hotwire-Shell supports various languages as command languages. e.g. Python
  • It can be downloaded at http://hotwire-shell.org/

Information about Open-Source activities around Cologne (Thomas Richter):

Thomas informed us about open-source activities within the region of Cologne:
  • There is a collaboration of several User-Groups to get support from the City of Cologne. The idea is that the City of Cologne could provide facilities like rooms for user-group activities (Support of cultural activities is a municipial task.)
  • Cooperation with the "Kölner-Freiwilligen-Agentur" has been established. Members of this organization offer their own spare time for activities to help other people or to support social projects.
  • On 6th of september there will take place an event of the City of Cologne where the idea of a "House for free software" will be presented.
  • There was some discussion for possibilities to cooperate with companies and organizations.

Further announcements:
  • 20th of september: Software-Freedom-Day
  • 8th to 22th of october: Linux-Congress of the GUUG (German Unix Users Group) in Hamburg with the stress on kernel development.
The next meeting will be held on, Wednesday, August, 13th.

The minutes of the meeting in German language can be found here.

Like usual we enjoyed the rest of the evening in our usual italian restaurant having food, drinks and friendly conversation.

Monday, July 7, 2008

pyCologne Python User Group, Cologne, Germany, July, 7th, Announcement

The next meeting of pyCologne will take place

Wednesday, July, 7th
starting about 6.30 pm - 6.45 pm
at Room 0.14, Benutzerrechenzentrum (RRZK-B)
University of Cologne, Berrenrather Str. 136, 50937 Köln, Germany

Agenda:
  • Creation of strange pictures using Turtle-Graphics (Günter Jantzen)
  • Presentation of the RRZN-Python Handbook
At about 8.30 pm we will as usual enjoy the rest of the evening in a nearby restaurant.

Further information including directions how to get to the location can be found at:
http://www.pycologne.de (Sorry, this page is in German only)