Skip to main content

Auxillary classes to implement call by reference.

Project description

PyPI - License GitHub tag (latest by date) GitHub release (latest by date) Documentation Status
PyPI PyPI - Python Version PyPI - Wheel PyPI - Status

pyCallBy

Auxillary classes to implement call by reference.

Python does not allow a user to distinguish between call-by-value and call-by-reference parameter passing. Python's standard types are passed by-value to a function or method. Instances of a class are passed by-reference (pointer) to a function or method.

By implementing a wrapper-class CallByRefParam, any types value can be passed by-reference. In addition, standard types like int or bool can be handled by derived wrapper-classes.

Example

# define a call-by-reference parameter for integer values
myInt = CallByRefIntParam()

# a function using a call-by-reference parameter
def func(param : CallByRefIntParam):
  param <= 3

# call the function and pass the wrapper object
func(myInt)

print(myInt.value)

Contributors:

License

This library is licensed under Apache License 2.0


SPDX-License-Identifier: Apache-2.0

Project details


Download files

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

Source Distribution

pyCallBy-1.0.2.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

pyCallBy-1.0.2-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page