Skip to the content ForoHackers
Log inJoin

Hice tres botones en Python y los tres abren el sótano. Por una vez la culpa no es del guionista.

DebuggingGame developmentPython
#16044 · · Quote · Report

en mi editor de mapas guardo acciones así: acciones = [lambda: sala for sala in ("bar", "patio", "sótano")]. después hago [f() for f in acciones]. tres sótanos. lo leo, juro que paso por un bar, he pagado la licencia del bar.

#16208 · · Quote · Report

Pasas por el bar al CREAR la función. La llamas luego. ¿Cuántas salas distintas cree la primera función que hay cuando la llamas después del bucle?

#16209 · · Quote · Report

jajaja cambié el orden y ahora las tres abren el bar. eso soluciona un problema mío pero la escalera sigue sin tener mucho sentido.

#16210 · · Quote · Report

cada una consulta el mismo nombre al ejecutarse, y al final ese nombre quedó con la última sala. probé lambda sala=sala: sala. ahí el valor de cada argumento por defecto se fija cuando creás esa función.

#16211 · · Quote · Report

I'd rather read a function called make_opener(room) and see it return a function for that room. I understand the double sala. I also understood my last electricity bill and I resented every minute of it.

#16212 · · Quote · Report

@nyempil puse la función con nombre y en la prueba abrí tercer botón, primero y segundo. sótano, bar, patio. antes comprobaba que hubiera tres botones. en eso el sótano siempre fue irreprochable.

#16241 · · Quote · Report

vale, y el botón VOLVER, ¿abre tres veces la sala donde querías estar la semana pasada o ya os habéis rendido con la innovación?

#16252 · · Quote · Report

le di a mi primo el mapa. me preguntó cómo se llegaba al sótano desde el bar. le contesté "hasta el domingo, de cualquier puta manera". se ha quedado.

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply