Does class patching actually work

John Nagle nagle at animats.com
Tue Jan 16 23:51:18 EST 2007


James Stroud wrote:
> John Nagle wrote:

>> The intent of this is to replace method open_https of class URLopener
>> with a local, patched version.
>>
>> Does that actually work?  When I've tried to do that in other code, it
>> seems to have no effect.  In fact, I can write
>>
>>     URLopener.open_https = None
>>
>> and nothing changes.

    My mistake.  Confusion between

	import a.b
	c = foo

and

	import a
	b.c = foo

which result in different namespaces.

					John Nagle



More information about the Python-list mailing list