[Tutor] Is this the right way to create a
Kent Johnson
kent37 at tds.net
Tue Jun 24 01:37:27 CEST 2008
On Mon, Jun 23, 2008 at 7:22 PM, Ricardo Araoz <ricaraoz at gmail.com> wrote:
> Kent Johnson wrote:
>>
>> On Sun, Jun 22, 2008 at 3:50 PM, Zameer Manji <zmanji at gmail.com> wrote:
>>> 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.
>>
>
> A couple of caveats though.
> Don't forget "self", it should be :
>
> class User (object):
> def __init__(self):
> self.UserProfile = UserProfile('Bob')
>
>
> Passing 'Bob' to __init__ would be :
>
> class User (object):
> def __init__(self, User='Bob'):
> self.UserProfile = UserProfile(User)
Good catch; also
def getNeighbors(self):
Kent
More information about the Tutor
mailing list