Skip to content

Commit

Permalink
doc: Add glossary entry for "free threading" (#119865)
Browse files Browse the repository at this point in the history
  • Loading branch information
colesbury authored May 31, 2024
1 parent f3fc800 commit 9bc6045
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,12 @@ Glossary
division. Note that ``(-11) // 4`` is ``-3`` because that is ``-2.75``
rounded *downward*. See :pep:`238`.

free threading
A threading model where multiple threads can run Python bytecode
simultaneously within the same interpreter. This is in contrast to
the :term:`global interpreter lock` which allows only one thread to
execute Python bytecode at a time. See :pep:`703`.

function
A series of statements which returns some value to a caller. It can also
be passed zero or more :term:`arguments <argument>` which may be used in
Expand Down

2 comments on commit 9bc6045

@Renatoff67
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exemplo de base de dados de usuários

usuarios = {
"123": {"nome": "Alice", "senha": "alice123"},
"456": {"nome": "Bob", "senha": "bob456"},
"789": {"nome": "Charlie", "senha": "charlie789"}
}

Função para buscar e exibir as informações do usuário

def buscar_usuario():
id_usuario = id_entry.get()
if id_usuario in usuarios:
usuario = usuarios[id_usuario]
nome_label.config(text=f"Nome: {usuario['nome']}")
senha_label.config(text=f"Senha: {usuario['senha']}")
else:
messagebox.showerror("Erro", "ID não encontrado")
nome_label.config(text="Nome: ")
senha_label.config(text="Senha: ")

Configuração da interface gráfica

root = tk.Tk()
root.title("Buscar Usuário")

frame = tk.Frame(root)
frame.pack(pady=20, padx=20)

id_label = tk.Label(frame, text="ID do Usuário:", font=("Helvetica", 12))
id_label.pack(pady=5)

id_entry = tk.Entry(frame, font=("Helvetica", 12))
id_entry.pack(pady=5)

buscar_btn = tk.Button(frame, text="Buscar", command=buscar_usuario)
buscar_btn.pack(pady=5)

nome_label = tk.Label(frame, text="Nome: ", font=("Helvetica", 12))
nome_label.pack(pady=5)

senha_label = tk.Label(frame, text="Senha: ", font=("Helvetica", 12))
senha_label.pack(pady=5)

root.mainloop()

@Renatoff67
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exemplo de base de dados de usuários

usuarios = {
"123": {"nome": "Alice", "senha": "alice123"},
"456": {"nome": "Bob", "senha": "bob456"},
"789": {"nome": "Charlie", "senha": "charlie789"}
}

Função para buscar e exibir as informações do usuário

def buscar_usuario():
id_usuario = id_entry.get()
if id_usuario in usuarios:
usuario = usuarios[id_usuario]
nome_label.config(text=f"Nome: {usuario['nome']}")
senha_label.config(text=f"Senha: {usuario['senha']}")
else:
messagebox.showerror("Erro", "ID não encontrado")
nome_label.config(text="Nome: ")
senha_label.config(text="Senha: ")

Configuração da interface gráfica

root = tk.Tk()
root.title("Buscar Usuário")

frame = tk.Frame(root)
frame.pack(pady=20, padx=20)

id_label = tk.Label(frame, text="ID do Usuário:", font=("Helvetica", 12))
id_label.pack(pady=5)

id_entry = tk.Entry(frame, font=("Helvetica", 12))
id_entry.pack(pady=5)

buscar_btn = tk.Button(frame, text="Buscar", command=buscar_usuario)
buscar_btn.pack(pady=5)

nome_label = tk.Label(frame, text="Nome: ", font=("Helvetica", 12))
nome_label.pack(pady=5)

senha_label = tk.Label(frame, text="Senha: ", font=("Helvetica", 12))
senha_label.pack(pady=5)

root.mainloop()

Please sign in to comment.