Skip to content

Conversation

@alexgeer
Copy link
Contributor

This is the Python docs content missing for M31 Lessons 1 and 2

str.split()

list.sort()

open()

print(jobs) # ['Curriculum Developer', 'Curriculum Instructor', 'Designer']
```

##### `open()`
Copy link
Contributor

Choose a reason for hiding this comment

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

@alexgeer can we show the version that uses context managers here as well since we only use that style in the Python Language Track courses for File I/O?

#opening "my_file.txt" in read mode
with open("my_file.txt", "rt") as file:
    contents = file.read()
    print(contents)

I get that open() and close() may be somewhat easier to digest for beginners, but it might be weird for the Python Language Track kids to come here and see it when they only use the with way. I can write those docs in if you don't want to add it, just figured I'd let you take a run if you wanted.

Copy link
Contributor

Choose a reason for hiding this comment

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

As a side note, we should ask @usrbinsam if there's any danger in having a bunch of open file descriptors around if kids use the open()/close() idiom and forget to run close() on the file handle. Not sure if that's something that would cause havoc on the backend, but would be good to run by him.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what to do it. The context-based way is standard but not basic so I don't want to do the cart-before-horse thing that we have been so guilty of in curriculum before. I'd want them to know the basic operations going on behind the context management before they use it, even though it's easier. I will probably add the context management to the early lesson content, but imo we should have both in the docs.

@daniel-schroeder-dev daniel-schroeder-dev merged commit 926f46a into codewizardshq:main Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants