Skip to content

Errors found in functions_advanced #318

@edoardob90

Description

@edoardob90

There is a lingering datetime.utcnow() in the section about mutable objects as function's arguments:

from datetime import datetime

def log(msg, *, dt=datetime.utcnow()):
    print(f"{dt}: {msg}")

Should be:

from datetime import datetime, UTC


def log(msg, *, dt=datetime.now(UTC)):
    print(f"{dt}: {msg}")

Sub-issues

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions