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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:04:37+00:00 2026-06-06T00:04:37+00:00

In some languages, like php, you don’t need to manually initialize each dimension of

  • 0

In some languages, like php, you don’t need to manually initialize each dimension of a multidimensional array. You just specify the key path, and the language will automatically initialize the sub arrays if needed.

For example, in php I can just do

$foo = array();
$foo['sub1']['sub2']['sub3'] = 5;

Instead of having to manually initialize each level of sub array

$foo = array();
$foo['sub1'] = array();
$foo['sub1']['sub2'] = array();
$foo['sub1']['sub2']['sub3'] = 5;

I know that python offers this convenience as well I’ve seen python code that appears equivalent, so I figure there’s a name for this feature.

What is the name of this feature?

  • 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-06T00:04:38+00:00Added an answer on June 6, 2026 at 12:04 am

    I believe the corresponding feature in Perl is called autovivification. As the wikipedia page points out, Python dictionaries don’t have this feature by default, but it’s easy to build something that behaves this way by making use of collections.defaultdict. See this recent blog post for some ideas.

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

Sidebar

Related Questions

Similar to technologies like ASP.NET, PHP, JSP and some other web languages which run
I think that some newer languages like JS can do this natively, but I
In my application there is language detection. Languages have some identification code like en
I know that some other languages, such as PHP , support a concept of
I have some long-running CLI PHP scripts that run regularly via cron. I'd like
I know a bunch of scripting languages, (python, ruby, lua, php) but I don't
Just would like some thoughts of what you think about my strategy to learn
In some languages where you cannot override the () operator, I have seen methods
I know some languages allow this. Is it possible in C++?
When I'm learning Clojure of some languages, the readability and convenience of syntax is

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.