[pyar] Consulta sobre Pattern Registry
Leonardo Vidarte
lvidarte en gmail.com
Mie Oct 20 16:59:13 ART 2010
On Wed, Oct 20, 2010 at 4:46 PM, Facundo Batista
<facundobatista en gmail.com> wrote:
> 2010/10/20 Leonardo Vidarte <lvidarte en gmail.com>:
>
>> El uso sería:
>>
>> # archivo1.py
>> from registry import Registry
>> Registry.set('foo', 1)
>> Registry.set('bar', 2)
>>
>> # archivo2.py
>> from registry import Registry
>> if 'foo' in Registry.keys():
>> print Registry.get('foo')
>
> KISS:
>
> $ cat registry.py
> registry = {}
>
> $ cat arch1.py
> from registry import registry
> registry['foo'] = 1
> registry['bar'] = 2
> import arch2
>
> $ cat arch2.py
> from registry import registry
> print registry['foo']
>
> $ python arch1.py
> 1
Buenísimo. Gracias.
--
// Leo
More information about the pyar
mailing list