Skip to content

Commit 90f314a

Browse files
authored
Add open and with chapter (#60)
1 parent 56a6fff commit 90f314a

22 files changed

Lines changed: 2691 additions & 51 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ The project foundation and six complete educational sections are available, and
8585
- [Comments versus Logging in Python](comments-and-documentation/05-comments-vs-logging/README.md)
8686
- [PEP 8 and Readability in Python](comments-and-documentation/06-pep8-and-readability/README.md)
8787

88-
Phases 1, 2, 3, 4, 5, and 6 are complete. Phase 7 now includes [Handling Exceptions with `try`, `except`, `else`, and `finally`](errors-files-and-modules/01-try-except-else-finally/README.md), which establishes specific handlers, success-only `else`, cleanup-oriented `finally`, propagation, and narrow failure boundaries, plus [Raising and Custom Exceptions](errors-files-and-modules/02-raise-and-custom-exceptions/README.md), which adds deliberate `raise`, built-in and custom exception selection, re-raising, explicit chaining, and the distinction between `raise` and `assert`. Phase 5: Functions contains nine reviewed chapters: [Defining and Calling Functions](functions/01-defining-and-calling-functions/README.md), [Parameters and Arguments](functions/02-parameters-and-arguments/README.md), [Return Values](functions/03-return-values/README.md), [Scope](functions/04-scope/README.md), [Type Hints](functions/05-type-hints/README.md), [Default Values](functions/06-default-values/README.md), [`*args` and `**kwargs`](functions/07-args-and-kwargs/README.md), [Functions Working Together](functions/08-functions-working-together/README.md), and [Data Flow Between Functions](functions/09-data-flow-between-functions/README.md). Together they establish function definition and calling, required input flow, returned results, local and global scope, typed interfaces, safe optional inputs, intentionally flexible positional and keyword argument collection, composition through helpers and coordinators, and explicit caller-to-parameter-to-return data flow including rebinding versus mutation. Phase 4 remains complete with eight reviewed Program Flow chapters, ending with [Choosing and Combining Program Flow](program-flow/08-choosing-and-combining-program-flow/README.md). Phase 3 contains six reviewed Collections chapters, ending with [Choosing the Right Collection](collections/06-choosing-the-right-collection/README.md). Phase 2 remains complete with four reviewed chapters, ending with [Numeric Built-ins](strings-and-numbers/04-numeric-builtins/README.md). See the [roadmap](docs/roadmap.en.md) or the [full learning path](docs/learning-path.en.md) for the current curriculum status and direct chapter links.
88+
Phases 1, 2, 3, 4, 5, and 6 are complete. Phase 7 now includes three reviewed chapters: exception handling; deliberate raising and custom exceptions; and [Opening Files Safely with `open()` and `with`](errors-files-and-modules/03-open-and-with/README.md), which introduces text-file modes, explicit encodings, reading, writing, appending, focused file errors, and context-managed cleanup. Phase 5: Functions contains nine reviewed chapters: [Defining and Calling Functions](functions/01-defining-and-calling-functions/README.md), [Parameters and Arguments](functions/02-parameters-and-arguments/README.md), [Return Values](functions/03-return-values/README.md), [Scope](functions/04-scope/README.md), [Type Hints](functions/05-type-hints/README.md), [Default Values](functions/06-default-values/README.md), [`*args` and `**kwargs`](functions/07-args-and-kwargs/README.md), [Functions Working Together](functions/08-functions-working-together/README.md), and [Data Flow Between Functions](functions/09-data-flow-between-functions/README.md). Together they establish function definition and calling, required input flow, returned results, local and global scope, typed interfaces, safe optional inputs, intentionally flexible positional and keyword argument collection, composition through helpers and coordinators, and explicit caller-to-parameter-to-return data flow including rebinding versus mutation. Phase 4 remains complete with eight reviewed Program Flow chapters, ending with [Choosing and Combining Program Flow](program-flow/08-choosing-and-combining-program-flow/README.md). Phase 3 contains six reviewed Collections chapters, ending with [Choosing the Right Collection](collections/06-choosing-the-right-collection/README.md). Phase 2 remains complete with four reviewed chapters, ending with [Numeric Built-ins](strings-and-numbers/04-numeric-builtins/README.md). See the [roadmap](docs/roadmap.en.md) or the [full learning path](docs/learning-path.en.md) for the current curriculum status and direct chapter links.
8989

9090
## Visual identity
9191

docs/learning-path.en.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ This phase is already available and is the next recommended phase after Function
9393

9494
1. [Handling Exceptions with `try`, `except`, `else`, and `finally`](../errors-files-and-modules/01-try-except-else-finally/README.md)
9595
2. [Raising and Custom Exceptions](../errors-files-and-modules/02-raise-and-custom-exceptions/README.md)
96+
3. [Opening Files Safely with `open()` and `with`](../errors-files-and-modules/03-open-and-with/README.md)
9697

97-
Phase 7 is in progress. Chapter 01 establishes the runtime-exception and handler model. Chapter 02 adds deliberate `raise`, built-in versus custom exception selection, bare re-raising, explicit chaining with `from`, and the distinction between `raise` and `assert`. The next planned chapter is **`open()` and `with`**.
98+
Phase 7 is in progress. Chapters 01–02 establish exception handling and deliberate signaling. Chapter 03 adds text-file modes, explicit encodings, reading, writing, appending, file exceptions, and context-managed cleanup. The next planned chapter is **TXT, CSV, and JSON**.
9899

99100
## Phase 8 · Standard Library ⏳
100101

docs/learning-path.es.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ Esta fase ya está disponible y es la siguiente fase recomendada después de Fun
9393

9494
1. [Manejo de Excepciones con `try`, `except`, `else` y `finally`](../errors-files-and-modules/01-try-except-else-finally/README.es.md)
9595
2. [Lanzar Excepciones y Crear Excepciones Personalizadas](../errors-files-and-modules/02-raise-and-custom-exceptions/README.es.md)
96+
3. [Abrir Archivos de Forma Segura con `open()` y `with`](../errors-files-and-modules/03-open-and-with/README.es.md)
9697

97-
La Fase 7 está en progreso. El Capítulo 01 establece el modelo de excepciones en runtime y handlers. El Capítulo 02 añade `raise` deliberado, elección entre excepciones built-in y personalizadas, relanzamiento con `raise` sin expresión, encadenamiento explícito con `from` y la distinción entre `raise` y `assert`. El próximo capítulo planificado es **`open()` y `with`**.
98+
La Fase 7 está en progreso. Los Capítulos 01–02 establecen manejo y señalización deliberada de excepciones. El Capítulo 03 añade modos de archivo de texto, encoding explícito, lectura, escritura, append, excepciones de archivo y limpieza gestionada por contexto. El próximo capítulo planificado es **TXT, CSV y JSON**.
9899

99100
## Fase 8 · Biblioteca Estándar ⏳
100101

docs/learning-path.pt-BR.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ Esta fase já está disponível e é a próxima fase recomendada depois de Funç
9393

9494
1. [Tratando Exceções com `try`, `except`, `else` e `finally`](../errors-files-and-modules/01-try-except-else-finally/README.pt-BR.md)
9595
2. [Levantando Exceções e Criando Exceções Personalizadas](../errors-files-and-modules/02-raise-and-custom-exceptions/README.pt-BR.md)
96+
3. [Abrindo Arquivos com Segurança com `open()` e `with`](../errors-files-and-modules/03-open-and-with/README.pt-BR.md)
9697

97-
A Fase 7 está em andamento. O Capítulo 01 estabelece o modelo de exceções em runtime e handlers. O Capítulo 02 acrescenta `raise` deliberado, escolha entre exceções built-in e personalizadas, relançamento com `raise` sem expressão, encadeamento explícito com `from` e a distinção entre `raise` e `assert`. O próximo capítulo planejado é **`open()` e `with`**.
98+
A Fase 7 está em andamento. Os Capítulos 01–02 estabelecem tratamento e sinalização deliberada de exceções. O Capítulo 03 acrescenta modos de arquivo de texto, encoding explícito, leitura, escrita, append, exceções de arquivo e limpeza gerenciada por contexto. O próximo capítulo planejado é **TXT, CSV e JSON**.
9899

99100
## Fase 8 · Biblioteca Padrão ⏳
100101

docs/localized/README.es.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ La base del proyecto y seis secciones educativas completas están disponibles, y
8585
- [Comentarios frente a Logging en Python](../../comments-and-documentation/05-comments-vs-logging/README.es.md)
8686
- [PEP 8 y Legibilidad en Python](../../comments-and-documentation/06-pep8-and-readability/README.es.md)
8787

88-
Las Fases 1, 2, 3, 4, 5 y 6 están completadas. La Fase 7 ahora incluye [Manejo de Excepciones con `try`, `except`, `else` y `finally`](../../errors-files-and-modules/01-try-except-else-finally/README.es.md), que establece handlers específicos, ruta de éxito con `else`, limpieza con `finally`, propagación y límites de fallo pequeños, además de [Lanzar Excepciones y Crear Excepciones Personalizadas](../../errors-files-and-modules/02-raise-and-custom-exceptions/README.es.md), que añade `raise` deliberado, elección entre excepciones built-in y personalizadas, relanzamiento, encadenamiento explícito y la distinción entre `raise` y `assert`. La Fase 5: Funciones reúne nueve capítulos revisados: [Definir y Llamar Funciones](../../functions/01-defining-and-calling-functions/README.es.md), [Parámetros y Argumentos](../../functions/02-parameters-and-arguments/README.es.md), [Valores de Retorno](../../functions/03-return-values/README.es.md), [Alcance](../../functions/04-scope/README.es.md), [Type Hints](../../functions/05-type-hints/README.es.md), [Valores Predeterminados](../../functions/06-default-values/README.es.md), [`*args` y `**kwargs`](../../functions/07-args-and-kwargs/README.es.md), [Funciones Trabajando Juntas](../../functions/08-functions-working-together/README.es.md) y [Flujo de Datos Entre Funciones](../../functions/09-data-flow-between-functions/README.es.md). Juntos establecen definición y llamada, flujo de entrada obligatorio, resultados retornados, alcance local y global, interfaces tipadas, entradas opcionales seguras, recolección intencionalmente flexible de argumentos posicionales y por palabra clave, composición mediante funciones auxiliares y coordinadoras y flujo explícito desde el llamador hacia parámetros y retornos, incluida la reasignación frente a la mutación. La Fase 4 permanece completada con ocho capítulos revisados de Flujo del Programa, terminando con [Elegir y Combinar el Flujo del Programa](../../program-flow/08-choosing-and-combining-program-flow/README.es.md). La Fase 3 reúne seis capítulos revisados de Colecciones, terminando con [Elegir la Colección Adecuada](../../collections/06-choosing-the-right-collection/README.es.md). La Fase 2 permanece completada con cuatro capítulos revisados, terminando con [Funciones Numéricas Incorporadas](../../strings-and-numbers/04-numeric-builtins/README.es.md). Consulta el [roadmap](../roadmap.es.md) o la [ruta completa de aprendizaje](../learning-path.es.md) para seguir el estado del currículo y acceder directamente a los capítulos.
88+
Las Fases 1, 2, 3, 4, 5 y 6 están completadas. La Fase 7 ahora incluye tres capítulos revisados: manejo de excepciones; lanzamiento y excepciones personalizadas; y [Abrir Archivos de Forma Segura con `open()` y `with`](../../errors-files-and-modules/03-open-and-with/README.es.md), que introduce modos de archivo de texto, encoding explícito, lectura, escritura, append, errores de archivo específicos y limpieza gestionada por contexto. La Fase 5: Funciones reúne nueve capítulos revisados: [Definir y Llamar Funciones](../../functions/01-defining-and-calling-functions/README.es.md), [Parámetros y Argumentos](../../functions/02-parameters-and-arguments/README.es.md), [Valores de Retorno](../../functions/03-return-values/README.es.md), [Alcance](../../functions/04-scope/README.es.md), [Type Hints](../../functions/05-type-hints/README.es.md), [Valores Predeterminados](../../functions/06-default-values/README.es.md), [`*args` y `**kwargs`](../../functions/07-args-and-kwargs/README.es.md), [Funciones Trabajando Juntas](../../functions/08-functions-working-together/README.es.md) y [Flujo de Datos Entre Funciones](../../functions/09-data-flow-between-functions/README.es.md). Juntos establecen definición y llamada, flujo de entrada obligatorio, resultados retornados, alcance local y global, interfaces tipadas, entradas opcionales seguras, recolección intencionalmente flexible de argumentos posicionales y por palabra clave, composición mediante funciones auxiliares y coordinadoras y flujo explícito desde el llamador hacia parámetros y retornos, incluida la reasignación frente a la mutación. La Fase 4 permanece completada con ocho capítulos revisados de Flujo del Programa, terminando con [Elegir y Combinar el Flujo del Programa](../../program-flow/08-choosing-and-combining-program-flow/README.es.md). La Fase 3 reúne seis capítulos revisados de Colecciones, terminando con [Elegir la Colección Adecuada](../../collections/06-choosing-the-right-collection/README.es.md). La Fase 2 permanece completada con cuatro capítulos revisados, terminando con [Funciones Numéricas Incorporadas](../../strings-and-numbers/04-numeric-builtins/README.es.md). Consulta el [roadmap](../roadmap.es.md) o la [ruta completa de aprendizaje](../learning-path.es.md) para seguir el estado del currículo y acceder directamente a los capítulos.
8989

9090
## Identidad visual
9191

docs/localized/README.pt-BR.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ A fundação do projeto e seis seções educacionais completas estão disponíve
8585
- [Comentários versus Logging em Python](../../comments-and-documentation/05-comments-vs-logging/README.pt-BR.md)
8686
- [PEP 8 e Legibilidade em Python](../../comments-and-documentation/06-pep8-and-readability/README.pt-BR.md)
8787

88-
As Fases 1, 2, 3, 4, 5 e 6 estão concluídas. A Fase 7 agora inclui [Tratando Exceções com `try`, `except`, `else` e `finally`](../../errors-files-and-modules/01-try-except-else-finally/README.pt-BR.md), que estabelece handlers específicos, caminho de sucesso com `else`, limpeza com `finally`, propagação e fronteiras de falha estreitas, além de [Levantando Exceções e Criando Exceções Personalizadas](../../errors-files-and-modules/02-raise-and-custom-exceptions/README.pt-BR.md), que acrescenta `raise` deliberado, escolha entre exceções built-in e personalizadas, relançamento, encadeamento explícito e a distinção entre `raise` e `assert`. A Fase 5: Funções reúne nove capítulos revisados: [Definindo e Chamando Funções](../../functions/01-defining-and-calling-functions/README.pt-BR.md), [Parâmetros e Argumentos](../../functions/02-parameters-and-arguments/README.pt-BR.md), [Valores de Retorno](../../functions/03-return-values/README.pt-BR.md), [Escopo](../../functions/04-scope/README.pt-BR.md), [Type Hints](../../functions/05-type-hints/README.pt-BR.md), [Valores Padrão](../../functions/06-default-values/README.pt-BR.md), [`*args` e `**kwargs`](../../functions/07-args-and-kwargs/README.pt-BR.md), [Funções Trabalhando Juntas](../../functions/08-functions-working-together/README.pt-BR.md) e [Fluxo de Dados Entre Funções](../../functions/09-data-flow-between-functions/README.pt-BR.md). Juntos, eles estabelecem definição e chamada, fluxo de entrada obrigatório, resultados retornados, escopo local e global, interfaces tipadas, entradas opcionais seguras, coleta intencionalmente flexível de argumentos posicionais e nomeados, composição por funções auxiliares e coordenadoras e fluxo explícito do chamador aos parâmetros e retornos, incluindo reatribuição versus mutação. A Fase 4 permanece concluída com oito capítulos revisados de Fluxo do Programa, encerrando com [Escolhendo e Combinando o Fluxo do Programa](../../program-flow/08-choosing-and-combining-program-flow/README.pt-BR.md). A Fase 3 reúne seis capítulos revisados de Coleções, encerrando com [Escolhendo a Coleção Certa](../../collections/06-choosing-the-right-collection/README.pt-BR.md). A Fase 2 permanece concluída com quatro capítulos revisados, encerrando com [Funções Numéricas Embutidas](../../strings-and-numbers/04-numeric-builtins/README.pt-BR.md). Consulte o [roadmap](../roadmap.pt-BR.md) ou a [trilha completa de estudos](../learning-path.pt-BR.md) para acompanhar o status do currículo e acessar os capítulos diretamente.
88+
As Fases 1, 2, 3, 4, 5 e 6 estão concluídas. A Fase 7 agora inclui três capítulos revisados: tratamento de exceções; levantamento e exceções personalizadas; e [Abrindo Arquivos com Segurança com `open()` e `with`](../../errors-files-and-modules/03-open-and-with/README.pt-BR.md), que introduz modos de arquivo de texto, encoding explícito, leitura, escrita, append, erros de arquivo específicos e limpeza gerenciada por contexto. A Fase 5: Funções reúne nove capítulos revisados: [Definindo e Chamando Funções](../../functions/01-defining-and-calling-functions/README.pt-BR.md), [Parâmetros e Argumentos](../../functions/02-parameters-and-arguments/README.pt-BR.md), [Valores de Retorno](../../functions/03-return-values/README.pt-BR.md), [Escopo](../../functions/04-scope/README.pt-BR.md), [Type Hints](../../functions/05-type-hints/README.pt-BR.md), [Valores Padrão](../../functions/06-default-values/README.pt-BR.md), [`*args` e `**kwargs`](../../functions/07-args-and-kwargs/README.pt-BR.md), [Funções Trabalhando Juntas](../../functions/08-functions-working-together/README.pt-BR.md) e [Fluxo de Dados Entre Funções](../../functions/09-data-flow-between-functions/README.pt-BR.md). Juntos, eles estabelecem definição e chamada, fluxo de entrada obrigatório, resultados retornados, escopo local e global, interfaces tipadas, entradas opcionais seguras, coleta intencionalmente flexível de argumentos posicionais e nomeados, composição por funções auxiliares e coordenadoras e fluxo explícito do chamador aos parâmetros e retornos, incluindo reatribuição versus mutação. A Fase 4 permanece concluída com oito capítulos revisados de Fluxo do Programa, encerrando com [Escolhendo e Combinando o Fluxo do Programa](../../program-flow/08-choosing-and-combining-program-flow/README.pt-BR.md). A Fase 3 reúne seis capítulos revisados de Coleções, encerrando com [Escolhendo a Coleção Certa](../../collections/06-choosing-the-right-collection/README.pt-BR.md). A Fase 2 permanece concluída com quatro capítulos revisados, encerrando com [Funções Numéricas Embutidas](../../strings-and-numbers/04-numeric-builtins/README.pt-BR.md). Consulte o [roadmap](../roadmap.pt-BR.md) ou a [trilha completa de estudos](../learning-path.pt-BR.md) para acompanhar o status do currículo e acessar os capítulos diretamente.
8989

9090
## Identidade visual
9191

0 commit comments

Comments
 (0)