Skip to content

Commit 137e348

Browse files
committed
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.
1 parent 2062ab2 commit 137e348

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python/moose/neuroml/MorphML.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ def set_compartment_param(self, compartment, name, value, mechanismname):
585585
compartment.refractoryPeriod = value # compartment is a moose.LIF instance (intfire)
586586
elif name == 'g_refrac':
587587
_logger.info("SORRY, current moose.LIF doesn't support g_refrac.")
588-
elif mechanismname is 'synapse': # synapse being added to the compartment
588+
elif mechanismname == 'synapse': # synapse being added to the compartment
589589
## these are potential locations, we do not actually make synapses,
590590
## unless the user has explicitly asked for it
591591
if self.createPotentialSynapses:
@@ -595,7 +595,7 @@ def set_compartment_param(self, compartment, name, value, mechanismname):
595595
## I assume below that compartment name has _segid at its end
596596
segid = compartment.name.split('_')[-1] # get segment id from compartment name
597597
self.segDict[segid][5].append(value)
598-
elif mechanismname is 'spikegen': # spikegen being added to the compartment
598+
elif mechanismname == 'spikegen': # spikegen being added to the compartment
599599
## these are potential locations, we do not actually make the spikegens.
600600
## spikegens for different synapses can have different thresholds,
601601
## hence include synapse_type in its name

0 commit comments

Comments
 (0)