Default scope of variables

Chris Angelico rosuav at gmail.com
Tue Jul 9 02:13:43 EDT 2013


On Tue, Jul 9, 2013 at 4:08 PM, alex23 <wuwei23 at gmail.com> wrote:
> On 9/07/2013 3:07 PM, Chris Angelico wrote:
>>
>> The subtransactions are NOT concepted as separate transactions. They
>> are effectively the database equivalent of a try/except block.
>
>
> Sorry, I assumed each nested query was somehow related to the prior
> one. In which case, I'd probably go with Ethan's suggestion of a
> top-level transaction context manager with its own substransaction
> method.

Yeah, that would probably be the best option in this particular
instance. Though I do still like the ability to have variables shadow
each other, even if there's a way around one particular piece of code
that uses the technique.

ChrisA



More information about the Python-list mailing list