I have this line
{% set entries = craft.entries.section('x') etc etc %}
Which I use to pull data for a header in my _layout.html template.
Then later, knowing I am done with the array, inside a block in an another template which extends _layout I have
{% set entries = craft.entries.section('y') etc etc %}
In fact I have reused the 'entries' name regularly through many templates and a number of sites and haven't, as far as I know, had a problem, except in one case.
In this case if the cache has just been cleared (manually at least) then the second setting of entries does not work and it contains the values from the first set, mucking up the page of course.
On reloading the page, and subsequently until the cache is cleared manually every thing works as expected (although I don't know what happens when the cache automatically clears as I am never sure when that has just happened).
It was an easy fix just to change 'entries' to 'whatevers' in the second line, and where it is referred to in the rest of the template.
Is it bad practice to do what I have done (before the change), or is it likely that there is another error in my code that is causing this problem?