Re: [Tutor] Is this the right way to create a

2008-06-23 Thread Kent Johnson
On Mon, Jun 23, 2008 at 7:22 PM, Ricardo Araoz <[EMAIL PROTECTED]> wrote: > Kent Johnson wrote: >> >> On Sun, Jun 22, 2008 at 3:50 PM, Zameer Manji <[EMAIL PROTECTED]> wrote: >>> Also what do you mean by 'accessors' for Neighbors ? >> >> class User(object): >> ... >> def getNeighbors(): >>"""

Re: [Tutor] Is this the right way to create a

2008-06-23 Thread Ricardo Araoz
Kent Johnson wrote: On Sun, Jun 22, 2008 at 3:50 PM, Zameer Manji <[EMAIL PROTECTED]> wrote: I'm quite new to OOP, so forgive me if I am missing something obvious. When you say that the User class should have a UserProfile as an attribute, would it look something like this? from lastfmapi impo

Re: [Tutor] Is this the right way to create a

2008-06-22 Thread Kent Johnson
On Sun, Jun 22, 2008 at 3:50 PM, Zameer Manji <[EMAIL PROTECTED]> wrote: > I'm quite new to OOP, so forgive me if I am missing something obvious. > When you say that the User class should have a UserProfile as an > attribute, would it look something like this? > > from lastfmapi import UserProfile

Re: [Tutor] Is this the right way to create a

2008-06-22 Thread Zameer Manji
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Kent Johnson wrote: > A User class that has a UserProfile as an attribute, and accessors for > Neighbors, etc, sounds good to me. You may want an Artist class, > probably not a Top Artists class. The User.getTopArtists() method > would access the web

Re: [Tutor] Is this the right way to create a

2008-06-22 Thread Kent Johnson
On Sun, Jun 22, 2008 at 12:00 AM, Zameer Manji <[EMAIL PROTECTED]> wrote: > I'm trying to create a library for the Last.fm webservice[1] and the > first thing I created was a class for the Profile Information.[2] Is > this the proper way of creating it? Is this useful to another programmer? > > imp

Re: [Tutor] Is this the right way to create a

2008-06-22 Thread Kent Johnson
On Sun, Jun 22, 2008 at 4:03 AM, Alan Gauld <[EMAIL PROTECTED]> wrote: > Web services are usually procedural in nature so that you don't > need to create classes at all. So to provbide maximum flexibility > you might be better just creating a module that exposes the > services as functions. The us

Re: [Tutor] Is this the right way to create a

2008-06-22 Thread Alan Gauld
"Zameer Manji" <[EMAIL PROTECTED]> wrote Also, how do I then begin to approach the whole API ? Do I create a User class the inherits from the UserProfile class and other classes for their Neighbours', Top Artists, etc ? I don;t know enough about the underlying service to answer that but...

[Tutor] Is this the right way to create a

2008-06-21 Thread Zameer Manji
I'm trying to create a library for the Last.fm webservice[1] and the first thing I created was a class for the Profile Information.[2] Is this the proper way of creating it? Is this useful to another programmer? import urllib import xml.etree.ElementTree as ET from BeautifulSoup import BeautifulSt