Python Forum
Instances sharing attributes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Instances sharing attributes
#4
You can take advantage of Python 'returning operand' feature:

>>> scale = None
>>> scale = scale or None
>>> print(scale)
None
>>> scale = 10
>>> scale = scale or None
>>> scale
10
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
Instances sharing attributes - by midarq - Sep-19-2019, 04:26 PM
RE: Instances sharing attributes - by ichabod801 - Sep-19-2019, 07:18 PM
RE: Instances sharing attributes - by midarq - Sep-20-2019, 10:30 AM
RE: Instances sharing attributes - by perfringo - Sep-20-2019, 10:45 AM
RE: Instances sharing attributes - by midarq - Sep-20-2019, 11:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Best way to secure API key when sharing quarinteen 2 492 Jan-19-2024, 04:46 PM
Last Post: deanhystad
Question [solved] Classes, assign an attributes to a class not to instances.. SpongeB0B 4 1,126 May-20-2023, 04:08 PM
Last Post: SpongeB0B
  How to install modules for 2.7 (or sharing from 3.8)) Persisto 2 2,648 Dec-31-2021, 02:33 PM
Last Post: Persisto
  multiprocessing and sharing object cyrduf 0 2,148 Feb-02-2021, 08:16 PM
Last Post: cyrduf
  sharing variables between two processes Kiyoshi767 1 1,985 Nov-07-2020, 04:00 AM
Last Post: ndc85430
  Sharing my code emirasal 2 2,174 Oct-04-2020, 02:21 PM
Last Post: emirasal
  Sharing X Axis in Sub plots JoeDainton123 1 2,305 Aug-22-2020, 04:11 AM
Last Post: deanhystad
  Instances as attributes sapra90 2 2,479 Jun-26-2019, 04:38 AM
Last Post: woooee
  Sharing variables across modules j.crater 4 3,646 Jul-30-2018, 09:09 PM
Last Post: j.crater
  Class Instances overriding class members and attributes. Leaf 7 7,148 Nov-29-2017, 06:08 AM
Last Post: Leaf

Forum Jump:

User Panel Messages

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