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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:05:48+00:00 2026-05-31T06:05:48+00:00

Why does python use modules, instead of just including the module functions in the

  • 0

Why does python use modules, instead of just including the module functions in the main language. It would be very useful and pretty easy, especially for the main ones such as random, re, and os. If Python preaches simplicity and minimalist, why do you have to write in extra lines of code?

  • 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-31T06:05:50+00:00Added an answer on May 31, 2026 at 6:05 am

    1) Zen of Python #19: “Namespaces are one honking great idea — let’s do more of those!”

    Named modules are good because they eliminate any chance of a collision between functions with the same name. If everything was a builtin, then os.error() would collide with logging.error() (and heaven forbid you try to define your own function called error()!)

    Ditto the builtin int() function and the random.int() function. You would have to write the latter as random_int(), which is just as much typing as the module syntax. Why not make the namespaces explicit and use modules?

    This is the same reason the syntax from os import * is frowned upon – it pollutes your namespace and introduces the chance for exciting name collision errors.

    2) Who decides what’s a builtin and what’s a module?

    Most of the programs that you personally write involve os and re. Personally every script I’ve written in the last three months has involved sqlite3, csv and logging. Should those be included as builtins for every program that any Python programmer ever writes?

    After a while your list of builtins gets to be bigger than Ben Hur.

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

Sidebar

Related Questions

What does python 2.7 use to sort vanilla class instances? I'm interested in the
I've been starting to use Fortran (95) for some numerical code (generating python modules).
I'm using the logging module in Python and I would like it to create
When I have lots of different modules using the standard python logging module, the
For a small python script I would like to use a temporary file with
I use the following at the beginning of all modules in my Python project:
Does Python have a unit testing framework compatible with the standard xUnit style of
Does python have the ability to create dynamic keywords? For example: qset.filter(min_price__usd__range=(min_price, max_price)) I
Does python create a completely new string (copying the contents) when you do a
Does Python have a built-in, simple way of encoding/decoding strings using a password? Something

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.