From 137e348313436782f8cf5eccc8e707ebbdc07170 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 27 Sep 2019 10:53:23 +0200
Subject: [PATCH] neuroml: do not use "is" with strings
This works, but only because of an implementation detail: short
strings are interned as part of module code. But the rules are complicated
and we should not rely on this.
See http://guilload.com/python-string-interning/ for a nice writeup.
Python3.8 now warns about this.
---
python/moose/neuroml/MorphML.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/python/moose/neuroml/MorphML.py b/python/moose/neuroml/MorphML.py
index 57b983cf83..42f774db33 100644
--- a/python/moose/neuroml/MorphML.py
+++ b/python/moose/neuroml/MorphML.py
@@ -585,7 +585,7 @@ def set_compartment_param(self, compartment, name, value, mechanismname):
compartment.refractoryPeriod = value # compartment is a moose.LIF instance (intfire)
elif name == 'g_refrac':
_logger.info("SORRY, current moose.LIF doesn't support g_refrac.")
- elif mechanismname is 'synapse': # synapse being added to the compartment
+ elif mechanismname == 'synapse': # synapse being added to the compartment
## these are potential locations, we do not actually make synapses,
## unless the user has explicitly asked for it
if self.createPotentialSynapses:
@@ -595,7 +595,7 @@ def set_compartment_param(self, compartment, name, value, mechanismname):
## I assume below that compartment name has _segid at its end
segid = compartment.name.split('_')[-1] # get segment id from compartment name
self.segDict[segid][5].append(value)
- elif mechanismname is 'spikegen': # spikegen being added to the compartment
+ elif mechanismname == 'spikegen': # spikegen being added to the compartment
## these are potential locations, we do not actually make the spikegens.
## spikegens for different synapses can have different thresholds,
## hence include synapse_type in its name