Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[pyos][suggestion] Type hints on i/o functions #435

Open
Labels
discussionDiscussing a topic with no specific actions yethygieneImprove code quality and reduce maintenance overhead
@sneakers-the-rat

Description

@sneakers-the-rat

Not going to suggest going through and adding type hints to all possible functions, but I think they would be especially useful on the i/o functions since you are traversing libraries and types - this would help the already good interoperability in mixed contexts where people are converting to and from different types, help people know what to expect with static analysis tools. I recognize that you might not have the correct packages imported/installed since they are optionals, but there are a few strategies that might work there -- splitting up the i/o module into a package with submodules where you try and import the necessary packages at the module level and then use string type hints:

something like...

IMPORTED=Falsetry:importnetworkxasnxfromnetworkx.classes.digraphimportDiGraphIMPORTED=TrueexceptImportErrorase:# probably some logging idkraiseedefto_networkx(m,edge_attribute:str='weight')->'DiGraph':    ...

that's pretty clumsy but hopefully illustrates the idea.

part of:pyOpenSci/software-submission#81

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionDiscussing a topic with no specific actions yethygieneImprove code quality and reduce maintenance overhead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp