Skip to content

Hands on: More refactoring of the microscope script #7

@pberkes

Description

@pberkes

In the file hands_on/1_microscope_script.py [1], define a new context manager called sample_inserted that inserts a sample in the microscope before executing a block of code, and safely removes it at the end of the block.

Rewrite the brain-scan script from cell in the file using the do_stuff_under_vacuum and the sample_inserted context managers.

[1] https://github.com/ASPP/2019-camerino-advanced-python/tree/master/notebook/context%20manager/hands_on

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions