vyper icon indicating copy to clipboard operation
vyper copied to clipboard

VIP: import lists

Open charles-cooper opened this issue 1 year ago • 1 comments

Simple Summary

example:

from ethereum.ercs import ERC20, ERC4626, ERC20Detailed

Motivation

stub

Specification

stub

Backwards Compatibility

no issues

Dependencies

If this VIP depends on any other VIPs being implemented, please mention them.

References

Add any references that this VIP might reference (other VIPs/issues, links to blog posts, etc.)

Copyright

Copyright and related rights waived via CC0

charles-cooper avatar Oct 11 '24 16:10 charles-cooper

I think this would be useful not only when importing interfaces but also when working with stateless modules. For instance if I'm making a module containing all the constants in the codebase it would be nice to be able to reference a single constant without having to prefix it with the name of the module first.

The only workaround for this currently is:

import constants
N_COINS: constant(uint256) = constants.N_COINS

But it's easy to see how this defeats the purpose of modules if you have a lot of constants to import

AlbertoCentonze avatar Apr 08 '25 14:04 AlbertoCentonze

Resolved via https://github.com/vyperlang/vyper/pull/4762.

pcaversaccio avatar Nov 05 '25 09:11 pcaversaccio