Skip to main content

originally, you have:

def func():
    return 1
print func() + func()

Then you decided that func() can return some extra information but you don’t want to break previous code (or modify them one by one). It looks like

def func():
    return 1, "extra info"
value, extra = func()
print value # 1 (expected)
print extra # extra info (expected)
print func() + func() # (1, 'extra info', 1, 'extra info') (not expected, we want the previous behaviour, i.e. 2)

The previous codes (func() + func()) are broken. You have to fix it.

The solution is adapted from the answer,

http://stackoverflow.com/questions/17648591/multiple-value-return-pattern-in-python-not-tuple-list-dict-or-object-soluti/17680730#17680730

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multiret-0.0.1.tar.gz (1.5 kB view details)

Uploaded Source

File details

Details for the file multiret-0.0.1.tar.gz.

File metadata

  • Download URL: multiret-0.0.1.tar.gz
  • Upload date:
  • Size: 1.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for multiret-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f2076157c022f39ef0fe195f396c90cf57f9860603ec20963aba24e90c53f315
MD5 11f01b1da79e863714f1e306456ad185
BLAKE2b-256 f228e150cac6c8ffda0625127170724e782b583c4a49c7bcb8dd38c035c66217

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 file

0.0.0

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page