[Tutor] Is this the right way to create a

Kent Johnson kent37 at tds.net
Sun Jun 22 23:25:08 CEST 2008

On Sun, Jun 22, 2008 at 3:50 PM, Zameer Manji <zmanji at gmail.com> 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
> class User (object):
>        def __init__:
>                self.UserProfile = UserProfile('Bob')

Yes, that's about right. Of course 'Bob' should be an argument passed
to __init__()

> Also what do you mean by 'accessors' for Neighbors ?

class User(object):
  def getNeighbors():
    """ Returns a list of this user's neighbors """

and similar for getTopArtists(), etc.

> Version: GnuPG v1.4.7 (MingW32)
> cKAnNfiHpCLp9X8503Fdn8yMA8dq16ktOS7L5EeqsZnU4lpns6XeWzO1RbiUcxY7
> i0ojWffBgvtfaK/3b6IteDvL7/+rKKXHiQRzPLDET8XUfoAe9kIXppN49JEfl7s7
> JCrEXLv6/eHLcHT+aMCtcKLGF9s85kSW7pipIg61n2H0X3rYl3kZeRE5unjbc2rJ
> ++YM4CSOrG3n8U3o/NCdnP23p8W2x6WNnndeWG2C7tLa2n/k3QkY2cOpG/tELU+p
> tpwT9VAeoEvOyKAhtfqfwBS9gCa3hrbnuUt9IDvcHR0TmKJ+rytbLqHOGLtH5rU=
> =2Ifq

More information about the Tutor mailing list