eBay.py - Has anyone looked at this???

George Sakkis gsakkis at rutgers.edu
Thu Jul 14 20:12:15 EDT 2005


"provato" <provato at gmail.com> wrote

> I'm somewhat of a newbie was confused by the following code that I
> downloaded from eBay's developer site:
>
> One of the classes in the file is called "Call". What I don't get is
> that in "MakeCall" function, there's a use of self.Session.Server.
> Where is this property coming from?
>
> [snipped]

Typically, instance attributes should be bound in the constructor (__init__), but strangely Call has
no constructor. I checked out the ebay.py file and it turns out that other classes bind Session (and
other attributes) directly, e.g.

class SellerList:
    def Get(self, SellerUserName):
        api = Call()
        api.Session = self.Session
        api.DetailLevel = "2"
        # etc

This is lousy OO design and you saw why; you can't tell where on earth is Session and the other
attributes coming from. From a brief look, the api seems like a quick & dirty solution that would
benefit from refactoring, so you'd rather not try to learn python from it.

George





More information about the Python-list mailing list