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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:56:31+00:00 2026-05-31T10:56:31+00:00

I was wondering why many functions – especially in numpy – utilize tuples as

  • 0

I was wondering why many functions – especially in numpy – utilize tuples as function parameters?

e.g.:

a = numpy.ones( (10, 5) )

What could possibly be the use for that? Why not simply have something such as the following, since clearly the first parameters will always denote the size of the array?

a = numpy.ones(10, 5)

Is it because there might be additional parameters, such as dtype? even if so,

a = numpy.ones(10, 5, dtype=numpy.int)

seems much cleaner to me, than using the convoluted tuple convention.

Thanks for your replies

  • 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-31T10:56:32+00:00Added an answer on May 31, 2026 at 10:56 am

    Because you want to be able to do:

    a = numpy.ones(other_array.shape)
    

    and other_array.shape is a tuple. There are a few functions that are not consistent with this and work as you’ve described, e.g. numpy.random.rand()

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

Sidebar

Related Questions

I was wondering if there is a reverse (kbd) function, one I could use
I have many requires and includes and i was wondering if there's something that
Was just wondering how do these sites (and many other softwares that generate flash
I have been wondering, when to use static functions, and when not to in
Helo, A library like jQuery is fully loaded and comes with many functions that
I was just wondering how many experienced programers out there actually map out their
Wondering how to open many new windows with Javascript. I have found plenty of
I'm just wondering if anyone has had any problems having too many subscribers for
I am crunching through many gigabytes of text data and I was wondering if
I'm wondering what a better design is for the intersection table for a many-to-many

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.