vyper icon indicating copy to clipboard operation
vyper copied to clipboard

Allow comma-separated, multi-interface imports

Open pcaversaccio opened this issue 2 years ago • 1 comments

Simple Summary

Allow comma-separated, pythonic-style, multi-interface imports:

from vyper.interfaces import ERC20, ERC20Detailed

The Vyper compiler currently disallows this as the rule currently is that an assignment statement must have one target.

Motivation

Support pythonic-style imports. PEP 8 says the following:

Imports should usually be on separate lines:

# Correct:
import os
import sys
# Wrong:
import sys, os

It's okay to say this though:

# Correct:
from subprocess import Popen, PIPE

Specification

Allow comma-separated, pythonic-style, multi-interface imports:

from interface_path.interface_name import x, y, z

Backwards Compatibility

Not backwards-compatible syntax.

Dependencies

N/A.

References

N/A.

Copyright

Copyright and related rights waived via CC0.

pcaversaccio avatar Oct 11 '23 17:10 pcaversaccio

Same syntax for implements would be great as well:

from snekmate.tokens.interfaces import IERC20Permit
implements: erc.IERC20, erc.IERC20Detailed, IERC20Permit

pcaversaccio avatar May 13 '24 08:05 pcaversaccio