Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use of @property decorator
#17
(Jun-09-2020, 04:57 PM)ruy Wrote: I guess I can see why you would say so. The first code is much more simple and straightforward
yes + I don't think performance benefit of not calculating every time would be worth it. Second proposal by @Yoriz is fair compromise, but still it's open to mishandling if Vessel.previous_values property is changed by mistake.

EDIT: actually, yes, second proposal by @Yoriz is better compromise
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
Use of @property decorator - by ruy - Jun-08-2020, 05:11 PM
RE: Use of @property decorator - by Yoriz - Jun-08-2020, 05:31 PM
RE: Use of @property decorator - by buran - Jun-08-2020, 05:37 PM
RE: Use of @property decorator - by stullis - Jun-08-2020, 05:37 PM
RE: Use of @property decorator - by ruy - Jun-08-2020, 06:01 PM
RE: Use of @property decorator - by buran - Jun-08-2020, 06:09 PM
RE: Use of @property decorator - by ruy - Jun-08-2020, 06:19 PM
RE: Use of @property decorator - by Yoriz - Jun-08-2020, 06:27 PM
RE: Use of @property decorator - by deanhystad - Jun-08-2020, 10:57 PM
RE: Use of @property decorator - by buran - Jun-09-2020, 03:55 AM
RE: Use of @property decorator - by ruy - Jun-09-2020, 04:02 PM
RE: Use of @property decorator - by buran - Jun-09-2020, 04:27 PM
RE: Use of @property decorator - by Yoriz - Jun-09-2020, 04:34 PM
RE: Use of @property decorator - by Yoriz - Jun-09-2020, 04:48 PM
RE: Use of @property decorator - by ruy - Jun-09-2020, 04:57 PM
RE: Use of @property decorator - by Yoriz - Jun-09-2020, 05:00 PM
RE: Use of @property decorator - by buran - Jun-09-2020, 05:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  the order of running code in a decorator function akbarza 2 536 Nov-10-2023, 08:09 AM
Last Post: akbarza
  Curious about decorator syntax rjdegraff42 14 2,145 May-03-2023, 01:21 PM
Last Post: rjdegraff42
  Subclass initialized property used in parent class method. Is it bad coding practice? saavedra29 5 1,804 Feb-07-2022, 07:29 PM
Last Post: saavedra29
  ABC Module and @property decorator, Pythonic Way? muzikman 21 5,704 Aug-18-2021, 06:08 PM
Last Post: muzikman
  @property vs __set__ / __get__ and __setattr__ / __getattr__ okhajut 1 3,346 Jun-15-2021, 03:48 PM
Last Post: snippsat
  Can property getters and setters have additional arguments? pjfarley3 2 3,053 Oct-30-2020, 12:17 AM
Last Post: pjfarley3
  decorator adamfairhall 0 1,571 Aug-18-2020, 08:38 AM
Last Post: adamfairhall
  Property price calculation oli_action 4 3,179 Jul-15-2020, 04:27 PM
Last Post: sridhar
  Problem adding keys/values to dictionary where keynames = "property" and "value" jasonashaw 1 2,060 Dec-17-2019, 08:00 PM
Last Post: jasonashaw
  strange class property KaliLinux 2 2,366 Nov-25-2019, 04:32 PM
Last Post: KaliLinux

Forum Jump:

User Panel Messages

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