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

  • SEARCH
  • Home
  • 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 6191485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:46:28+00:00 2026-05-24T02:46:28+00:00

Sometimes, I find it hard to distinguish between a method and an attribute by

  • 0

Sometimes, I find it hard to distinguish between a method and an attribute by it’s name without appending parentheses.

For example:
there’re keys() method and text attribute in xml.etree.ElementTree.Element class.

text:The text attribute can be used to hold additional data associated with the element.

keys():Returns the elements attribute names as a list.


Is there some basic rules/conventions to make text an attribute, but keys() a method?

If I make text() a method, and keys an attribute. It still seems OK.

  • 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-05-24T02:46:30+00:00Added an answer on May 24, 2026 at 2:46 am

    The only real distinction is that one is callable and one is not, so you can use the builtin function callable() with the actual object (not a string with the name of it) to determine whether or not it is callable.

    In your case:

    >>> from xml.etree import ElementTree
    >>> elt = ElementTree.Element("")
    >>> callable(elt.keys)
    True
    >>> callable(elt.text)
    False
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using Mercurial I sometimes find that it is hard to understand the relationship
Sometimes I need to find some strings inside DB usually it is just host-name
When I research a new library, I sometimes find it hard to locate the
I really like the smarty documentation but sometimes its hard to find easy stuff...
Sometimes I find myself in the situation where I want to execute several sequential
jQuery selectors are wonderful, but I sometimes I find myself typing them over and
This could save me so much time. Sometimes I find myself writing things like
Sometimes I need to find out if an object will really be released. I
Sometimes when using eclipse it loses references to the JRE. i.e. It cannot find
Once again I find myself failing at some really simple task in C++. Sometimes

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.