Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9184701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:07:03+00:00 2026-06-17T19:07:03+00:00

help(dir): dir([object]) -> list of strings If called without an argument, return the names

  • 0
help(dir):
dir([object]) -> list of strings        
If called without an argument, return the names in the current scope.  
Else, return an alphabetized list of names comprising (some of) the attributes  
of the given object, and of attributes reachable from it.  
If the object supplies a method named __dir__, it will be used; otherwise  
the default dir() logic is used and returns:  
  for a module object: the module's attributes.  
  for a class object:  its attributes, and recursively the attributes  
    of its bases.  
  for any other object: its attributes, its class's attributes, and  
    recursively the attributes of its class's base classes.

i found maybe there are problems in the help file of dir builtin function.for example:

class  AddrBookEntry(object):
   'address book entry class'
   def __init__(self,nm,ph):
     self.name=nm
     self.phone=ph
   def updatePhone(self,newph):
     self.phone=newph
     print 'Updated phone # for :' ,self.name

dir(AddrBookEntry('tom','123'))
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'name', 'phone', 'updatePhone']

1.dir() can list the method of object ,not only attributes
the updatePhone is method ,not attribute.

2.how can i know which is the attribute,which is method in the output of dir()?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:07:04+00:00Added an answer on June 17, 2026 at 7:07 pm
    1. Methods are attributes in Python.

    2. Check the various attributes on them. Methods have im_* attributes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

f:\i>move foo bar dir The syntax of the command is incorrect help move says:
Help, I can't function without Resharper . All of a sudden my Alt +
I have these strings as a response from a FTP server: 02-17-11 01:39PM <DIR>
im trying to make a vbscript that would list all contents in dir and
I was trying to make a JSON Object from a String URL without success
For any one unfamiliar with those two methods in Python... dir returns a list
Help me translate following block of the Haskell code. The run function produces text
Help please on how to extract data like 15,Teaching Periods 1 and 2.,Max 150.
Help from the SQL Gods Required Table 1 - DistinctQuotes This tables holds information
Help! I think i've gone in a bit over my head. I'm making a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.