Difference between #type and #theme in Render API I am reading this theming article http://themery.com/dgd7/advanced-theming/render/manipulate and I have a question.

This article has the following code:

$page['highlighted']['new_stuff'] = array(
'#type' =&gt; 'container',
'#attributes' =&gt; array('class' =&gt; 'my-container'),
);
$page['highlighted']['new_stuff']['heading'] = array(
'#type' =&gt; 'html_tag',
'#tag' =&gt; 'h2',
'#value' =&gt; t('Heading'),
'#attributes' =&gt; array('id' =&gt; 'my-heading'),
);
$page['highlighted']['new_stuff']['list'] = array(
'#theme' =&gt; 'item_list',
'#items' =&gt; array(
  'First item',
  'Second item',
  'Third item',
), 
);


I see that when you provide the #theme property you are telling the Render API to use the theme_item_list, and you pass it the #items variable. But isn't that exactly what you are doing when you set type to #html_tag, you're using the theme_html_tag and passing it variables?
The purpose is a little different:


'#type' is telling to the render API to merge what returned from hook_element_info()
'#theme' is saying to the render API which theme function to use


In the example you are making, the theme function used is theme_html_tag() because system_element_info() returns the following data.

  $types['html_tag'] = array(
    '#theme' =&gt; 'html_tag',
    '#pre_render' =&gt; array('drupal_pre_render_conditional_comments'),
    '#attributes' =&gt; array(),
    '#value' =&gt; NULL,
  );


If '#theme' were set to 'tag_html', theme_tag_html() would be the theme used by the render API.