Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Add for/while else #143

@pauldraper

Description

@pauldraper

I tried to use for-else, only to discover it does not exist (syntax error at 'else': expected expression).

for root in roots:
    if src.path.startswith(root):
        modules.append(create_module(name = src.path[len(root):], file = src))
        break
else:
    fail("Module roots does not contain %s" % src.path, "srcs")

This is surprising to someone familiar with Python control structures.

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