Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
caching attribute reference
#12
(Feb-21-2017, 10:51 AM)wavic Wrote: It doesn't matter. Both references are pointers to one memory address

It matters in terms of performance. self.foo has to do an attribute lookup to get that pointer, foo just gives the pointer.

Now, that performance gain is very slight and may not matter in some applications. But if you're doing it a million times, it will start to matter.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
caching attribute reference - by Skaperen - Feb-21-2017, 06:24 AM
RE: caching attribute reference - by Larz60+ - Feb-21-2017, 10:42 AM
RE: caching attribute reference - by wavic - Feb-21-2017, 10:51 AM
RE: caching attribute reference - by ichabod801 - Feb-22-2017, 02:08 AM
RE: caching attribute reference - by Larz60+ - Feb-21-2017, 10:53 AM
RE: caching attribute reference - by wavic - Feb-21-2017, 11:02 AM
RE: caching attribute reference - by micseydel - Feb-21-2017, 05:30 PM
RE: caching attribute reference - by Larz60+ - Feb-21-2017, 05:37 PM
RE: caching attribute reference - by micseydel - Feb-21-2017, 06:00 PM
RE: caching attribute reference - by Larz60+ - Feb-21-2017, 08:00 PM
RE: caching attribute reference - by Skaperen - Feb-22-2017, 01:44 AM
RE: caching attribute reference - by Ofnuts - Feb-22-2017, 08:00 AM
RE: caching attribute reference - by micseydel - Feb-22-2017, 01:45 AM
RE: caching attribute reference - by Skaperen - Feb-22-2017, 02:16 AM
RE: caching attribute reference - by Skaperen - Feb-22-2017, 09:14 AM
RE: caching attribute reference - by Ofnuts - Feb-22-2017, 10:59 AM
RE: caching attribute reference - by wavic - Feb-22-2017, 11:20 AM
RE: caching attribute reference - by micseydel - Feb-23-2017, 03:43 AM
RE: caching attribute reference - by Ofnuts - Feb-23-2017, 08:12 AM
RE: caching attribute reference - by Skaperen - Feb-23-2017, 09:53 AM
RE: caching attribute reference - by micseydel - Feb-23-2017, 03:53 PM
RE: caching attribute reference - by Ofnuts - Feb-23-2017, 11:18 PM
RE: caching attribute reference - by wavic - Feb-23-2017, 04:20 PM
RE: caching attribute reference - by Skaperen - Feb-24-2017, 06:04 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pass by object reference when does it behave like pass by value or reference? mczarnek 2 2,593 Sep-07-2020, 08:02 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

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