Open linas opened 4 years ago
@noskill @vsbogd followup to #2398
Python still has single global atomspace, which is used to call type constructors without specifying atomspace explicitly: https://github.com/opencog/atomspace/blob/2c99e42c9b7f6141da942853f92ebfb39c1e642f/opencog/cython/opencog/type_constructors.pyx#L14-L21
why did you close this? Of the two functions, only one is needed, both cannot possibly be needed.
This is almost finished, thanks to pull req #2416
These are not needed; they should be called automatically, when from opencog.atomspace import * is called.
If we follow through with the changes I've made in #2550, you shouldn't do from opencog.atomspace import *
- and generally this is bad Python practice. In this case there is name pollution because it imports TruthValue
and you should use the TruthValue
from type_constructors
.
Either importing everything from opencog.atomspace
should be discouraged, or one can simply add __all__
list in the module to limit what gets exported when doing a *
import.
What is actually left to be done in this issue?
What is actually left to be done in this issue?
cd tests
grep -r initialize_opencog
grep -r finalize_opencog
There are also likely users in other github repos...
In various places, e.g.
tests/cython/bindlink/test_bindlink.py
we see this python code:These are not needed; they should be called automatically, when
from opencog.atomspace import *
is called.So for example, farther down in that file:
Since python no longer has a single, global atomspace, the call to
initialize_opencog(self.atomspace)
is pointless. Only the type_ctor thing is needed.... although even that could be automated. When one does theatomspace = AtomSpace()
it should automatically set the type_ctr_atomspace.This is a followup to discussions in pull req #2398