-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Private variables #592
Merged
Merged
Private variables #592
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is part of a plan to try to discourage users from poking their fingers in where they don't belong. Anything in sPyNNaker's guts that isn't part of PyNN (or our documented extensions to PyNN) is off-limits and liable to change without warning!
Conflicts: spynnaker/pyNN/abstract_spinnaker_common.py spynnaker/pyNN/connections/spynnaker_poisson_control_connection.py spynnaker/pyNN/external_devices_models/push_bot/push_bot_ethernet/push_bot_ethernet_device.py spynnaker/pyNN/external_devices_models/threshold_type_multicast_device_control.py spynnaker/pyNN/models/common/multi_spike_recorder.py spynnaker/pyNN/models/common/neuron_recorder.py spynnaker/pyNN/models/neural_projections/connectors/abstract_connector.py spynnaker/pyNN/models/neural_projections/connectors/abstract_generate_connector_on_machine.py spynnaker/pyNN/models/neural_projections/connectors/array_connector.py spynnaker/pyNN/models/neural_projections/connectors/csa_connector.py spynnaker/pyNN/models/neural_projections/connectors/distance_dependent_probability_connector.py spynnaker/pyNN/models/neural_projections/connectors/fixed_number_post_connector.py spynnaker/pyNN/models/neural_projections/connectors/fixed_number_pre_connector.py spynnaker/pyNN/models/neural_projections/connectors/from_file_connector.py spynnaker/pyNN/models/neural_projections/connectors/from_list_connector.py spynnaker/pyNN/models/neural_projections/connectors/index_based_probability_connector.py spynnaker/pyNN/models/neural_projections/connectors/multapse_connector.py spynnaker/pyNN/models/neural_projections/connectors/one_to_one_connector.py spynnaker/pyNN/models/neural_projections/connectors/small_world_connector.py spynnaker/pyNN/models/neural_projections/projection_machine_edge.py spynnaker/pyNN/models/neural_projections/synapse_information.py spynnaker/pyNN/models/neuron/abstract_population_vertex.py spynnaker/pyNN/models/neuron/connection_holder.py spynnaker/pyNN/models/neuron/generator_data.py spynnaker/pyNN/models/neuron/plasticity/stdp/timing_dependence/timing_dependence_spike_nearest_pair.py spynnaker/pyNN/models/neuron/plasticity/stdp/weight_dependence/abstract_has_a_plus_a_minus.py spynnaker/pyNN/models/neuron/population_machine_vertex.py spynnaker/pyNN/models/neuron/synapse_types/synapse_type_alpha.py spynnaker/pyNN/models/pynn_population_common.py spynnaker/pyNN/models/pynn_projection_common.py spynnaker/pyNN/models/spike_source/spike_source_array.py spynnaker/pyNN/models/spike_source/spike_source_array_vertex.py spynnaker/pyNN/models/spike_source/spike_source_poisson.py spynnaker/pyNN/models/spike_source/spike_source_poisson_machine_vertex.py spynnaker/pyNN/models/spike_source/spike_source_poisson_vertex.py spynnaker/pyNN/models/utility_models/delay_extension_vertex.py spynnaker/pyNN/models/utility_models/delay_generator_data.py spynnaker/pyNN/models/utility_models/spike_injector_vertex.py
Conflicts: spynnaker/pyNN/models/neural_projections/connectors/from_list_connector.py
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is about making sPyNNaker's internal fields of objects be actually private, as much as possible. (I've not done anything about SpiNNFrontEndCommon, and I don't plan to do so either.) There will soon be a matching PR for sPyNNaker8.
A field or method is private when its name starts with
__
(double underscore) but doesn't end with more than one_
(i.e., single underscore). Python implements “private” by rewriting the name to have the class name prepended. For example, in this class:The name of the field in instances of
Foo
is actually_Foo__bar
but you're supposed to ignore that and pretend that the variable is truly private. (There's only one place in our codebase where we really need to take advantage of that knowledge.)The main awkward bit is that some fields have to remain with a single leading underscore (which is protected by convention) because they're used by subclasses, for equality checks, or for our unit test code. Can't be helped really, I guess…