How to Return a JSON Object From a Function in Python?

Return a JSON String Object from the json.dumps() Method The JSON (JavaScript Object Notation) format is widely used for transmitting structured data, especially between web applications. Fortunately, Python has several libraries for dealing with this data format, including the json module. The JSON format can nest data within β€œobject literals” denoted by curly braces. Like … Read more

Solidity Function Calls – Internal and External

In this article, we’ll take a closer look at function calls in general, specifically internal function calls in Solidity. It’s part of our long-standing tradition to make this (and other) articles a faithful companion and a supplement of the official Solidity documentation. You can watch my explainer video on the topic here—I’ll talk about function … Read more

Python Return Error From Function

Problem Formulation πŸ’¬ Question: How do you write a function that returns a real Python error instead of an “error code” such as -1 or None in case something got wrong? For example, you may want to check the function input arguments for having the correct type or length (in the case of iterable arguments) … Read more

Python Return Integer From Function

Do you need to create a function that returns an integer value but you don’t know how? No worries, in sixty seconds, you’ll know! Go! πŸ”₯πŸ”₯πŸ”₯ A Python function can return any object. To return an integer, use the built-in int() function. Or create your own function with an arbitrary expression within the function body … Read more

Python Return Float From Function

Do you need to create a function that returns a float but you don’t know how? No worries, in sixty seconds, you’ll know! Go! πŸ”₯πŸ”₯πŸ”₯ A Python function can return any object such as a float value such as 3.14. To return a float, you can use the built-in float() function or create your own … Read more