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 3432280
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:25:47+00:00 2026-05-18T07:25:47+00:00

I am a newbie for Python, I am a little confuse of the relationship

  • 0

I am a newbie for Python, I am a little confuse of the relationship between numbers.Integral and int in builtins module.

Then my questions are:

  1. What the relationship between numbers.Integral and int? Is it similiar with the relationship between Integer and int in Java (Integer is just a wrapper class for int)?

  2. When to use numbers.Integral?
    Since none of the types defined in mumbers module can be instantiated, then in what kind of scenarios we need to use these types?

Only one case I know we can use Integral:

 # check if x is a integer
 isinstance(x, Integral)

From the Python language reference:

”
numbers.Number These are created by numeric literals and returned as
results by arithmetic operators and
arithmetic built-in functions.
“

But it seems the arithmetic operators or arithmetic built-in functions doesn’t return a type in numbers. It is still the type in builtins.

>>> a,b=123,5
>>> c=a*b
>>> print(c.__class__)
<class 'int'>
>>> d=abs(a)
>>> print(d.__class__)
<class 'int'>

I am using Python 3.2a3.

  • 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-18T07:25:48+00:00Added an answer on May 18, 2026 at 7:25 am

    Since you sound like you know Java: numbers.Integral defines the “interface” (it’s really a generalization of interfaces, called “Abstract Base Class” (ABC)) for integral numbers. It’s not a concrete type that you can instantiate.

    The only builtin type that implements this interface is int.

    With isinstance( obj, numbers.Integral) you can test if obj implements a interface:

    >>> isinstance(3, numbers.Integral)
    True
    >>> isinstance(3.0, numbers.Integral)
    False
    >>> isinstance(3+0j, numbers.Integral)
    False
    

    If you wanted to write a custom class that behaves like a integral number you would inherit from numbers.Integral — or if you wanted to invent a new type of number you could register it there.

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

Sidebar

Related Questions

I'm a Python newbie. I have been a little confused by the differences between
I'm a newbie with a little experience writing in BASIC, Python and, of all
I am a newbie to Python and would like to genereate some numbers according
I am a Python and QT newbie. I am trying to do a little
Newbie to python here, I am trying to use an integer as an argument
I'm a python newbie, and I'm having some difficulty making a module out of
Python newbie getting a bit frustrated with the csv module. At this rate, it
I am a newbie to python and just learning things as i do my
I am newbie in Python and I need help: I have a file with
As a newbie to Python, and mainly having a background of writing scripts for

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.