Re: python syntax

  • From: "Alex Hall" <mehgcap@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 27 Dec 2009 14:02:43 -0500

I know basic python, having written a program in it for a class about 3 months ago, but this stuff is more advanced than what I learned. Is there something that covers these:

1. Why put an underline after the self keyword?
2. The method in my email returned one variable, yet it also had several vars which it extracted from somewhere. It did not return them, though, so why make them at all? 3. I have read about super, and I understand that it is a way of basically grabbing a passing bit of information, modifying it, then sening it on its way. I cannot understand this in practice, though, in the places where I have seen it.

Have a great day,
New email address: mehgcap@xxxxxxxxx
----- Original Message ----- From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, December 27, 2009 13:50
Subject: Re: python syntax

I'm going to recommend you read the python tutorial. Just jumping in from knowing another language will not work. The ideas are the same, but the keywords are different. Go read up on classes, self is fully explained there. Adding a method is as easy as just appending it in the class, making sure that it's indented correctly.

On Dec 27, 2009, at 11:37 AM, Alex Hall wrote:

Hi all,
I am really trying to better understand Python, but I am lost here. I have a file called pyfacebook, and it is a python wrapper for the facebook api. I am trying to add a ocuple of my own methods to this file, the new stream methods. I want all these methods in one class, so I created said class. Now, though, I am not sure how to put my methods into my class. The file contains something called an IDL, which seems to be a dictionary of methods? The other problem I have is getting some necessary information for connecting to facebook in the first place. Most of it can be gotten through methods already in place, but I am not sure how to call one such method because it has a lot of use of the word 'self' and I am unable to figure out just what it returns. I have pasted this funciton below. If you understand it, could you please explain it!!?? Thanks.

  def getSession(self):
"""Facebook API call. See""";
      args = {}
          args['auth_token'] = self._client.auth_token
      except AttributeError:
          raise RuntimeError('Client does not have auth_token set.')
      result = self._client('%s.getSession' % self._name, args)
      self._client.session_key = result['session_key']
      self._client.uid = result['uid']
      self._client.secret = result.get('secret')
      self._client.session_key_expires = result['expires']
      return result

Have a great day,
New email address: mehgcap@xxxxxxxxx
View the list's information and change your settings at

View the list's information and change your settings at

View the list's information and change your settings at

Other related posts: