Python Forum
all of attributes and methods related to a special type
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
all of attributes and methods related to a special type
#1
hi
how can I see all attributes and methods related to a special type? for example, I want to see all methods and attributes related to lists, how can I do it?
I write in idle dir(list) and it shows some, but there is not del in the given list, but del can be used with list type to omit element(s) of it:
dir(list)
Output:
['__add__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
'del' in dir(list)
Output:
False
mylist=[1,2,3,4,5]
del mylist[2]
mylist
Output:
[1, 2, 4, 5]
del mylist[0:2]
mylist
Output:
[4, 5]
thanks
Reply


Messages In This Thread
all of attributes and methods related to a special type - by akbarza - Jan-18-2024, 06:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Special Methods in Class Nikhil 3 2,338 Mar-04-2021, 06:25 PM
Last Post: Nikhil
  Special Methods - what are they exactly? bytecrunch 1 1,709 Feb-07-2021, 01:38 AM
Last Post: Larz60+
  Although this is a talib related Q it's mostly related to python module installing.. Evalias123 4 5,774 Jan-10-2021, 11:39 PM
Last Post: Evalias123
  Type hinting - return type based on parameter micseydel 2 2,530 Jan-14-2020, 01:20 AM
Last Post: micseydel
  How to Create Very Very Special Class with too many magic methods ? harun2525 5 4,415 Apr-13-2017, 10:18 PM
Last Post: wavic

Forum Jump:

User Panel Messages

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