New issue 160 by torsten....@gmail.com: Test for "basestring" instead
of "str"
http://code.google.com/p/sfepy/issues/detail?id=160
Please replace occurences of isinstance(something, str) by
isinstance(something, basestring). This is an easy change, and it makes it
more convenient to use SfePy with
from __future__ import unicode_literals
Otherwise, you have to say e.g.
mesh = Mesh.from_file(b'rectangle_tri.mesh')
(The "b" would become superfluous.)
Comment #1 on issue 160 by robert.c...@gmail.com: Test for "basestring"
instead of "str"
http://code.google.com/p/sfepy/issues/detail?id=160
Looks like a good thing to do, thanks for creating the issue.
Do you have other ideas to python 3 compatibility?
Import as many future statemens as feasible
("division", "absolute_imports", "unicode_literals", "print_function") in
every module. "division" and "absolute_imports" are especially interesting
in my opinion.
Replace % with .format().
By the way, for Python 3, the "basestring" has got to be re-changed
to "str". But this will be done by 2to3 automatically.
I would like to have a way that would work both for python 2 with "from
__future__ import unicode_literals" and python 3. Would using
types.StringType help?
I do not have a working python 3 installation yet, still using 2.6.6... I
can try 2.7. and use -3 flag to simulate it, right?
I will create a new issue for python 3 porting to discuss this.
You can start the modules with
try:
basestring
except:
basestring = str
Comment #5 on issue 160 by robert.c...@gmail.com: Test for "basestring"
instead of "str"
http://code.google.com/p/sfepy/issues/detail?id=160
Could you test using "git clone git://github.com/rc/sfepy.git"?
Sorry, not this year. I don't use Git but the plain release. I'll look
into it on the first days of the new year.
Ok, thanks! As a sidenote: using git is not that difficult, and you get
fresh fixes easily, see [1].
[1] http://docs.sfepy.org/doc-devel/dev/gitwash/index.html#using-git
Yes, it has worked. No "b" was necessary anymore. Thank you!
Comment #9 on issue 160 by robert.c...@gmail.com: Test for "basestring"
instead of "str"
http://code.google.com/p/sfepy/issues/detail?id=160
Thanks for verifying, let's close this.
Comment #10 on issue 160 by robert.c...@gmail.com: Test for "basestring"
instead of "str"
http://code.google.com/p/sfepy/issues/detail?id=160#c10
Migrated to http://github.com/sfepy/sfepy/issues/162