Re: [Python-es] Moratoria de cambios Python (Re: E l BIND 10 está escrito en Python)

2010-06-25 Por tema Chema Cortes
El día 24 de junio de 2010 23:43, Jesus Cea  escribió:

> Que haya coincidido con python 3 es un efecto colateral, permitiendo
> dedicar más tiempo y esfuerzo a python 3 en vez de a evaluar e
> implementar cambios en el lenguaje. Pero la idea fundamental de la
> moratoria es dar oportunidad a las implementaciones para que se pongan
> al día, en vez de perseguir un objetivo móvil que cambia versión a versión.
>
> http://www.python.org/dev/peps/pep-3003/#rationale

Entiendo que ése sea el principal objetivo, que todas las
implementaciones de python se equiparen; pero diría que es
precisamente la migración conjunta a python3 el efecto buscado y no un
efecto colateral. Del PEP-3003:

"As it is expected that Python 2.7 be the effective "end of life" of
the Python 2.x code line, with Python 3.x being the future, it is in
the best interest of Python core development to temporarily suspend
the alteration of the language itself to allow all of these external
entities to catch up and to assist in the adoption of, and migration
to, Python 3.x"

La espera del resto de implementaciones es dar por finalizado el ciclo
de vida del python2 y dedicar, a partir de ahí, todos los esfuerzos
comunes en la migración a python3. El efecto que se quiere evitar es
que CPython hubiera pasado a python3, mientras que el resto de
implementaciones seguían con python2. Al unificar versiones,
proyectos, como django, pueden abstraerse de la plataforma para
centrarse únicamente en el lenguaje.
___
Python-es mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-es
FAQ: http://python-es-faq.wikidot.com/


[Python-es] Encender bits individuales en variable

2010-06-25 Por tema Jesús Genicio
Hola:

Necesito poder modificar los bits individuales de un valor determiando.
Por ejemplo

Figure 6. CONFIGURATION REGISTER

MSb  bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 LSb
DONE THF   TLF   NVB   R1R0POL*  1SHOT*

He declarado las siguientes variables:

b_1Shot= 1
b_Pol= 2
b_R0= 4
b_R1= 8
b_TLF= 32
b_THF= 64
byt_Configuracion= 0

Y enciendo los bits de la manera:

byt_Configuracion |= b_R0

Y los apago:

byt_Configuracion ^= b_R0

El problema es que cuando se cambia una configuración, al intentar
ejecutar el cambio me da este error "de novato claro :))"

Traceback (most recent call last):
  File "ds1631.py", line 257, in cambio_grupo_resolucion
bit_Configuracion ^= b_R0
UnboundLocalError: local variable 'bit_Configuracion' referenced before
assignment

En fin.

S2

___
Python-es mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-es
FAQ: http://python-es-faq.wikidot.com/


Re: [Python-es] Encender bits individuales en variable

2010-06-25 Por tema Jose Caballero
>
>
>
>b_1Shot= 1
>b_Pol= 2
>b_R0= 4
>b_R1= 8
>b_TLF= 32
>b_THF= 64
>byt_Configuracion= 0
>
> UnboundLocalError: local variable 'bit_Configuracion' referenced before
> assignment
>



byt_Configuracion != bit_Configuracion
___
Python-es mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-es
FAQ: http://python-es-faq.wikidot.com/


Re: [Python-es] Encender bits individuales en variable

2010-06-25 Por tema Jesús Genicio
El vie, 25-06-2010 a las 14:29 -0400, Jose Caballero escribió:
> 
> 
>b_1Shot= 1
>b_Pol= 2
>b_R0= 4
>b_R1= 8
>b_TLF= 32
>b_THF= 64
>byt_Configuracion= 0
> 
> UnboundLocalError: local variable 'bit_Configuracion'
> referenced before
> assignment
> 
> 
> 
> byt_Configuracion != bit_Configuracion

Si eso ya me dí cuenta de ello al poco de enviar el mensaje, pero aún
así me da el mismo fallo.

Traceback (most recent call last):
  File "ds1631.py", line 258, in cambio_grupo_resolucion
bit_Conf ^= b_R0
UnboundLocalError: local variable 'bit_Conf' referenced before
assignment

S2
> ___
> Python-es mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-es
> FAQ: http://python-es-faq.wikidot.com/

___
Python-es mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-es
FAQ: http://python-es-faq.wikidot.com/


Re: [Python-es] Encender bits individuales en variable

2010-06-25 Por tema Jose Caballero
El 25 de junio de 2010 15:23, Jesús Genicio  escribió:

> El vie, 25-06-2010 a las 14:29 -0400, Jose Caballero escribió:
> >
> >
> >b_1Shot= 1
> >b_Pol= 2
> >b_R0= 4
> >b_R1= 8
> >b_TLF= 32
> >b_THF= 64
> >byt_Configuracion= 0
> >
> > UnboundLocalError: local variable 'bit_Configuracion'
> > referenced before
> > assignment
> >
> >
> >
> > byt_Configuracion != bit_Configuracion
>
> Si eso ya me dí cuenta de ello al poco de enviar el mensaje, pero aún
> así me da el mismo fallo.
>
> Traceback (most recent call last):
>   File "ds1631.py", line 258, in cambio_grupo_resolucion
>bit_Conf ^= b_R0
> UnboundLocalError: local variable 'bit_Conf' referenced before
> assignment
>



bit_Conf != bit_Configuracion ?
___
Python-es mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-es
FAQ: http://python-es-faq.wikidot.com/


Re: [Python-es] Encender bits individuales en variable

2010-06-25 Por tema Jesús Genicio
El vie, 25-06-2010 a las 15:37 -0400, Jose Caballero escribió:
> 
> 
> El 25 de junio de 2010 15:23, Jesús Genicio 
> escribió:
> El vie, 25-06-2010 a las 14:29 -0400, Jose Caballero escribió:
> 
> >
> >
> >b_1Shot= 1
> >b_Pol= 2
> >b_R0= 4
> >b_R1= 8
> >b_TLF= 32
> >b_THF= 64
> >byt_Configuracion= 0
> >
> > UnboundLocalError: local variable
> 'bit_Configuracion'
> > referenced before
> > assignment
> >
> >
> >
> > byt_Configuracion != bit_Configuracion
> 
> 
> Si eso ya me dí cuenta de ello al poco de enviar el mensaje,
> pero aún
> así me da el mismo fallo.
> 
> Traceback (most recent call last):
> 
>  File "ds1631.py", line 258, in cambio_grupo_resolucion
>bit_Conf ^= b_R0
> UnboundLocalError: local variable 'bit_Conf' referenced before
> assignment
> 
> 
> 
> bit_Conf != bit_Configuracion ?

A ver, dicho de otra manera, ¿De qué forma se pueden tener ctes y
variables visibles desde todo lugar.?

al estilo de C

#define variable 128

?

S2.
> 
> 
> ___
> Python-es mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-es
> FAQ: http://python-es-faq.wikidot.com/

___
Python-es mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-es
FAQ: http://python-es-faq.wikidot.com/