[BangPypers] class instance getting passed to other class obj creation

shreyas shyran at gmail.com
Sun Mar 9 16:15:31 CET 2014


You could make login instance a module level variable and then use that as
a singleton.

shreyas
On Mar 9, 2014 4:38 PM, "Nitin Kumar" <nitin.nitp at gmail.com> wrote:

> Hi All,
>
> I am looking for some better way to implement below scenario.
>
> Say there is a class login
>
> class login:
> def __init_(self, user, pwd):
> -----
>
> now user uses this class to login a session and then I am using the object
> of this class being passed to other class. So that other class can use this
> logged in session.
>
> >>> lgn = login()
> >>> scores(lgn)
> >>> account(lgn)
>
> I am somehow not in favour of passing this object to different class. Is
> there a way such that once we have login object that is visible to other
> class.
>
>
> Nitin K
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list