Python Forum
How to Create Very Very Special Class with too many magic methods ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Create Very Very Special Class with too many magic methods ?
#3
I can not understand what you mean.
This make no sense example = "bar"
This just overwrite class object example.
There are no function in your example,it's called method when belong to a class.
If a function is placed in class it has @staticmethod decorator.

To run the class just to make it clear what it dos:
>>> example = PointerVariable("foo")
>>> example.for_use_of_variable_without_calling()
'foo'
>>> example.val
'foo'

# Change val to bar
>>> example.new_value('bar')
>>> example.for_use_of_variable_without_calling()
'bar'
>>> example.val
'bar'
Reply


Messages In This Thread
RE: How to Create Very Very Special Class with too many magic methods ? - by snippsat - Apr-13-2017, 09:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] Class and methods ebn852_pan 15 794 May-23-2024, 11:57 PM
Last Post: ebn852_pan
  Class and methods Saida2024 2 292 May-13-2024, 04:04 AM
Last Post: deanhystad
  How does this code create a class? Pedroski55 6 675 Apr-21-2024, 06:15 AM
Last Post: Gribouillis
  Class test : good way to split methods into several files paul18fr 4 617 Jan-30-2024, 11:46 AM
Last Post: Pedroski55
  all of attributes and methods related to a special type akbarza 4 597 Jan-19-2024, 01:11 PM
Last Post: perfringo
  Structuring a large class: privite vs public methods 6hearts 3 1,201 May-05-2023, 10:06 AM
Last Post: Gribouillis
  magic related field in Django model sonh 1 1,310 Apr-24-2022, 12:37 PM
Last Post: sonh
  Cannot convert the series to <class 'int'> when trying to create new dataframe column Mark17 3 8,724 Jan-20-2022, 05:15 PM
Last Post: deanhystad
  Need a little help with numpy array magic. pmf71 0 1,212 Dec-01-2021, 02:51 AM
Last Post: pmf71
  access share attributed among several class methods drSlump 0 1,107 Nov-18-2021, 03:02 PM
Last Post: drSlump

Forum Jump:

User Panel Messages

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