[Tutor] Is this the right way to create a

Zameer Manji zmanji at gmail.com
Sun Jun 22 21:50:14 CEST 2008


-----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 services API and return a list of Artists. At a
> first guess, it looks like you may want classes for each of the types
> listed under "Categories" on the Web Services page.

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')
Also what do you mean by 'accessors' for Neighbors ?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iQEcBAEBCgAGBQJIXqz2AAoJEA759sZQuQ1BKWgIAJMAXzcUkL1MNjXE2xbFXpgf
cKAnNfiHpCLp9X8503Fdn8yMA8dq16ktOS7L5EeqsZnU4lpns6XeWzO1RbiUcxY7
i0ojWffBgvtfaK/3b6IteDvL7/+rKKXHiQRzPLDET8XUfoAe9kIXppN49JEfl7s7
JCrEXLv6/eHLcHT+aMCtcKLGF9s85kSW7pipIg61n2H0X3rYl3kZeRE5unjbc2rJ
++YM4CSOrG3n8U3o/NCdnP23p8W2x6WNnndeWG2C7tLa2n/k3QkY2cOpG/tELU+p
tpwT9VAeoEvOyKAhtfqfwBS9gCa3hrbnuUt9IDvcHR0TmKJ+rytbLqHOGLtH5rU=
=2Ifq
-----END PGP SIGNATURE-----


More information about the Tutor mailing list