Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flattening attribute access
#5
(Jun-25-2021, 07:19 PM)deanhystad Wrote: AttributeError would be the wrong type of error for this. Your code is looking for an attribute that it fails to find. That raises a NameError.

I'm runing python 3.9.5 and get the AttributeError, such as in this simple example:

class Test:
    pass

t = Test()
t.a
Error:
Traceback (most recent call last): File "C:\Users\ruy\Google Drive\PYTHON\cj8-qualifier\qualifier\untitled10.py", line 12, in <module> t.a AttributeError: 'Test' object has no attribute 'a'
Reply


Messages In This Thread
Flattening attribute access - by ruy - Jun-25-2021, 12:09 PM
RE: Flattening attribute access - by deanhystad - Jun-25-2021, 01:18 PM
RE: Flattening attribute access - by ruy - Jun-25-2021, 01:44 PM
RE: Flattening attribute access - by deanhystad - Jun-25-2021, 07:19 PM
RE: Flattening attribute access - by ruy - Jun-25-2021, 08:18 PM
RE: Flattening attribute access - by ruy - Jun-25-2021, 08:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  sharepoint: Access has been blocked by Conditional Access policies CAD79 0 2,388 Jul-12-2024, 09:36 AM
Last Post: CAD79
  How to access parent object attribute Pavel_47 2 12,317 Nov-19-2021, 09:36 PM
Last Post: deanhystad
  Problem in flattening list Shahmadhur13 5 3,591 May-03-2020, 12:40 AM
Last Post: DeaD_EyE
  Is it OK to use a context manager to simplify attribute access? nholtz 0 2,591 Jun-11-2019, 01:19 AM
Last Post: nholtz
  flattening a list with some elements being lists Skaperen 17 10,603 Apr-09-2019, 07:08 AM
Last Post: perfringo
  Flattening List mp3909 8 6,684 Jan-26-2018, 12:13 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

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