Re: [Tutor] hasattr()

2012-10-14 Thread Matthew Ngaha
Thank you xDog and Steven. The whole assignment makes a lot of sense now after your explanations of what hasattr is doing. Thanks ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinf

Re: [Tutor] hasattr()

2012-10-13 Thread Steven D'Aprano
On 14/10/12 05:29, Matthew Ngaha wrote: im trying to understand this hasattr function. i am supposed to pass in an object and an attribute name into its parametres... so im trying to get it to return True. Here's a quick test class Test: def __init__(self): self.att = "testing" O

Re: [Tutor] hasattr()

2012-10-13 Thread xDog Walker
On Saturday 2012 October 13 11:29, Matthew Ngaha wrote: > >>> hasattr(e, e.att) > > False >>> hasattr(e, "att") True hasattr wants the second parameter to be a string. You gave it a string. The string you gave it was "Testing". -- Yonder nor sorghum stenches shut ladle gulls stopper torque wet

[Tutor] hasattr()

2012-10-13 Thread Matthew Ngaha
im trying to understand this hasattr function. i am supposed to pass in an object and an attribute name into its parametres... so im trying to get it to return True. Here's a quick test class Test: def __init__(self): self.att = "testing" >>> e = Test() >>> hasattr(e, e.att) False >>