Python Forum
What is all the info in the info window in Idle?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is all the info in the info window in Idle?
#4
Not all classes do have a dict. If the classvariable __slots__ is used, then only the names from the supplied sequence are available and there is no __dict__. This is used to save memory. If you have only one instance of the class, you don't care. If you have one million, you care.

class Foo:
    __slots__ = ("x", "y")


Foo().__dict__
Output:
AttributeError: 'Foo' object has no attribute '__dict__
Dataclasses supports this too:
from dataclasses import dataclass

@dataclass(slots=True)
class Foo2:
    x: int
    y: int
If you use a class with slots, you cannot add new attributes to the class.
Pedroski55 likes this post
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
RE: What is all the info in the info window in Idle? - by DeaD_EyE - Jul-08-2023, 11:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  I dont understand on how to create a Bot that can read info on the screen aloud RaySuS777 0 743 Jun-19-2024, 10:02 AM
Last Post: RaySuS777
  Bot that can read info on the screen aloud... RaySuS777 2 1,307 Jun-18-2024, 05:52 PM
Last Post: RaySuS777
  Input network device connection info from data file edroche3rd 6 3,034 Oct-12-2023, 02:18 AM
Last Post: edroche3rd
  Is there a way to call and focus any popup window outside of the main window app? Valjean 6 6,140 Oct-02-2023, 04:11 PM
Last Post: deanhystad
  Pyspark Window: perform sum over a window with specific conditions Shena76 0 2,130 Jun-13-2022, 08:59 AM
Last Post: Shena76
  [split] Py2exe Writing UNKNOWN-0.0.0-py3.7.egg-info sarahroxon7 1 1,552 Apr-20-2022, 08:02 AM
Last Post: VadimCr
  Taking info from Json & using it in Python Extra 8 4,440 Apr-02-2022, 04:45 PM
Last Post: Extra
  Hiding "undesired" info Extra 4 3,062 Jan-03-2022, 08:25 PM
Last Post: Extra
  Looking for data/info on a perticular data-proccesing problem. MvGulik 9 5,848 May-01-2021, 07:43 AM
Last Post: MvGulik
  IDLE editing window no longer works chris1 2 3,261 Feb-06-2021, 07:59 AM
Last Post: chris1

Forum Jump:

User Panel Messages

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