<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="es">
	<id>http://wiki.cabal.mx/index.php?action=history&amp;feed=atom&amp;title=Curso_de_Programaci%C3%B3n_en_Python%2FCrearFunci%C3%B3n-7</id>
	<title>Curso de Programación en Python/CrearFunción-7 - Historial de revisiones</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.cabal.mx/index.php?action=history&amp;feed=atom&amp;title=Curso_de_Programaci%C3%B3n_en_Python%2FCrearFunci%C3%B3n-7"/>
	<link rel="alternate" type="text/html" href="http://wiki.cabal.mx/index.php?title=Curso_de_Programaci%C3%B3n_en_Python/CrearFunci%C3%B3n-7&amp;action=history"/>
	<updated>2026-05-11T19:41:36Z</updated>
	<subtitle>Historial de revisiones para esta página en el wiki</subtitle>
	<generator>MediaWiki 1.32.1</generator>
	<entry>
		<id>http://wiki.cabal.mx/index.php?title=Curso_de_Programaci%C3%B3n_en_Python/CrearFunci%C3%B3n-7&amp;diff=7086&amp;oldid=prev</id>
		<title>Rrc: Página creada con &#039;__NOTOC__ *  CrearFunción-7.py **  Resultado **  Explicación  == CrearFunción-7.py ==  &lt;syntaxhighlight lang=&quot;p...&#039;</title>
		<link rel="alternate" type="text/html" href="http://wiki.cabal.mx/index.php?title=Curso_de_Programaci%C3%B3n_en_Python/CrearFunci%C3%B3n-7&amp;diff=7086&amp;oldid=prev"/>
		<updated>2015-01-28T03:43:39Z</updated>

		<summary type="html">&lt;p&gt;Página creada con &amp;#039;__NOTOC__ * &lt;a href=&quot;#CrearFunci.C3.B3n-7.py&quot;&gt; CrearFunción-7.py&lt;/a&gt; ** &lt;a href=&quot;#Resultado&quot;&gt; Resultado&lt;/a&gt; ** &lt;a href=&quot;#Explicaci.C3.B3n&quot;&gt; Explicación&lt;/a&gt;  == CrearFunción-7.py ==  &amp;lt;syntaxhighlight lang=&amp;quot;p...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Página nueva&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
* [[:#CrearFunción-7.py | CrearFunción-7.py]]&lt;br /&gt;
** [[:#Resultado | Resultado]]&lt;br /&gt;
** [[:#Explicación | Explicación]]&lt;br /&gt;
&lt;br /&gt;
== CrearFunción-7.py ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line=&amp;quot;GESHI_FANCY_LINE_NUMBERS&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/bin/python3&lt;br /&gt;
#-*-coding: utf-8 -*-&lt;br /&gt;
&lt;br /&gt;
MiGlobal = 5&lt;br /&gt;
&lt;br /&gt;
print( &amp;quot;MiGlobal después de la asignación:&amp;quot;, MiGlobal )&lt;br /&gt;
&lt;br /&gt;
def func1():&lt;br /&gt;
    try:&lt;br /&gt;
      print( &amp;quot;MiGlobal adentro de func1 antes de asignación():&amp;quot;, MiGlobal )&lt;br /&gt;
    except:&lt;br /&gt;
      print( &amp;quot;No hay un MiGlobal aquí&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
    MiGlobal = 42&lt;br /&gt;
    print( &amp;quot;MiGlobal adentro de func1():&amp;quot;, MiGlobal )&lt;br /&gt;
&lt;br /&gt;
def func2():&lt;br /&gt;
    global MiGlobal&lt;br /&gt;
    print( &amp;quot;MiGlobal adentro de func1 antes de asignación():&amp;quot;, MiGlobal )&lt;br /&gt;
    MiGlobal = 42&lt;br /&gt;
&lt;br /&gt;
def func3():&lt;br /&gt;
	print( &amp;quot;MiGlobal in func3():&amp;quot;, MiGlobal )&lt;br /&gt;
&lt;br /&gt;
func1()&lt;br /&gt;
func3()&lt;br /&gt;
print( &amp;quot;MiGlobal a fuera de las functiones:&amp;quot;, MiGlobal )&lt;br /&gt;
func2()&lt;br /&gt;
func3()&lt;br /&gt;
print( &amp;quot;MiGlobal al fin:&amp;quot;, MiGlobal )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Resultado ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[rrc@www PythonClase]$ ./CrearFuncion-7.py &lt;br /&gt;
MiGlobal después de la asignación: 5&lt;br /&gt;
No hay un MiGlobal aquí&lt;br /&gt;
MiGlobal adentro de func1(): 42&lt;br /&gt;
MiGlobal in func3(): 5&lt;br /&gt;
MiGlobal a fuera de las functiones: 5&lt;br /&gt;
MiGlobal adentro de func1 antes de asignación(): 5&lt;br /&gt;
MiGlobal in func3(): 42&lt;br /&gt;
MiGlobal al fin: 42&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explicación ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Programación en Python]]&lt;br /&gt;
[[Category:PythonCabal]]&lt;br /&gt;
[[Category:CursoPython]]&lt;/div&gt;</summary>
		<author><name>Rrc</name></author>
		
	</entry>
</feed>