Python Forum
Private instance variables
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Private instance variables
#6
def __init__(self, first, last):
        self._first = first
        self._last = last
        self.e = self._f + self._l +'@gmail.com'
the first time self._f and self._l are used, they are being read. But they have never been defined so you get an Attributeerror

If you remove the last line from the __init__ method, it should work.
Reply


Messages In This Thread
Private instance variables - by mepyyeti - Jan-09-2018, 05:59 PM
RE: Private instance variables - by mpd - Jan-09-2018, 07:55 PM
RE: Private instance variables - by wavic - Jan-09-2018, 08:27 PM
RE: Private instance variables - by stranac - Jan-09-2018, 08:59 PM
RE: Private instance variables - by mepyyeti - Jan-09-2018, 09:38 PM
RE: Private instance variables - by mpd - Jan-09-2018, 10:35 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020