ANN: magnitude 0.9.1

J

juan

I am happy to announce the first release of magnitude, a
library for computing with physical quantities. It is
released under the Apache v. 2 license.

A physical quantity is a number with a unit, like 10
km/h. Units can be any of the SI units, plus a bunch of
non-SI, bits, dollars, and any combination of them. They can
include the standard SI prefixes. Magnitude can operate with
physical quantities, parse their units, and print them. You
don't have to worry about unit consistency or conversions;
everything is handled transparently. By default output is
done in basic SI units, but you can specify any output unit,
as long as it can be reduced to the basic units of the
phisical quantity.

Home page: http://juanreyero.com/magnitude/

Feedback is appreciated.

Cheers,

jm
 
B

Ben Finney

I am happy to announce the first release of magnitude, a library for
computing with physical quantities. It is released under the Apache
v. 2 license.

Thanks for this module, it will be good to have a standard place for
these constants.
Home page: http://juanreyero.com/magnitude/

Feedback is appreciated.

Please don't ever recommend 'from foo import *' in end-user
documentation. It's generally a bad practice and should only be done
when the individual programmer understands the tradeoffs involved;
putting it in the documentation for a module is setting a poor
example.

When 'from foo import *' is used, I have to keep scanning back and
forth to see whether any given name that I don't recognise is defined
elsewhere in the code, or whether it's not mentioned anywhere and by
implication came in with the 'from foo import *'.

It is especially bad for someone attempting to learn how to use a
module from the examples. When attempting to read the documentation
for a module to understand what it provides, I want the namespace to
be explicit, so I can immediately see which things are part of the
module I'm trying to learn about, and which are not.
 
J

Joan M. Garcia

Ben Finney said:
Please don't ever recommend 'from foo import *' in end-user
documentation. It's generally a bad practice and should only be done
when the individual programmer understands the tradeoffs involved;
putting it in the documentation for a module is setting a poor
example.

Got it, and solved. Thanks. I have been carelessly using
it like that for a long time (I was, after all, guilty of
any name it imported into my namespace) and I didn't think
about the implications for others in the documentation.

jm
 
J

juan

Ben Finney said:
Please don't ever recommend 'from foo import *' in end-user
documentation. It's generally a bad practice and should only be done
when the individual programmer understands the tradeoffs involved;
putting it in the documentation for a module is setting a poor
example.

Got it, and solved. Thanks. I have been carelessly using
it like that for a long time (I was, after all, guilty of
any name it imported into my namespace) and I didn't think
about the implications for others in the documentation.

jm
 
B

Ben Finney

Ben Finney said:
Please don't ever recommend 'from foo import *' in end-user
documentation. [...]

Got it, and solved. Thanks.

Thanks for the quick response.

A further issue, that requires a change of interface: Please comply
with PEP 8 <URL:http://www.python.org/dev/peps/pep-0008/> for your
module interface. In particular, please name classes with TitleCase,
and functions, methods, and instance names with lower_case.

Also: "precision" is the correct spelling of that word.
 
B

Ben Finney

Ben Finney said:
A further issue, that requires a change of interface: Please comply
with PEP 8 <URL:http://www.python.org/dev/peps/pep-0008/> for your
module interface. In particular, please name classes with TitleCase,
and functions, methods, and instance names with lower_case.

In fact, if you ever hope to see this module included in the standard
library, you should make sure the entire thing is PEP 8 compliant, not
just its interface.
 
L

Laurent Pointal

(e-mail address removed) a écrit :
I am happy to announce the first release of magnitude, a
library for computing with physical quantities. It is
released under the Apache v. 2 license.

A physical quantity is a number with a unit, like 10
km/h. Units can be any of the SI units, plus a bunch of
non-SI, bits, dollars, and any combination of them. They can
include the standard SI prefixes. Magnitude can operate with
physical quantities, parse their units, and print them. You
don't have to worry about unit consistency or conversions;
everything is handled transparently. By default output is
done in basic SI units, but you can specify any output unit,
as long as it can be reduced to the basic units of the
phisical quantity.

Home page: http://juanreyero.com/magnitude/

Feedback is appreciated.

How does it compare to the scalar module ?
(see http://russp.us/scalar.htm )
 
B

Ben Finney

Laurent Pointal said:
(e-mail address removed) a écrit :
I am happy to announce the first release of magnitude, a library
for computing with physical quantities. It is released under the
Apache v. 2 license.
[...]
Home page: http://juanreyero.com/magnitude/

How does it compare to the scalar module ?
(see http://russp.us/scalar.htm )

My first response is that its web page appearance compares very
favourably. (Those backgrounds! Ugh!)

My second is that (as of a few hours ago) the magnitude documentation
doesn't make the 'from foo import *' mistake that scalar does :)
 
J

Joan M. Garcia

George Sakkis said:

Both scalar and unum treat units as variables. You are
supposed to import them, so you end up with variables like M
and S in your namespace. And they don't seem to be able to
understand prefixes as they combine with variable names.

On the other side, they both provide something that
magnitude does not have: the ability to define arbitrary
units. magnitude limits you to combinations of the standard
SI units, plus dollar and bit. It is trivial to implement
user generation of arbitrary names for these combinations,
but not of arbitrary independent units.

jm
 
J

juan

A further issue, that requires a change of interface: Please comply
with PEP 8 <URL:http://www.python.org/dev/peps/pep-0008/> for your
module interface. In particular, please name classes with TitleCase,
and functions, methods, and instance names with
lower_case.

Done, almost. I should have seen that document before. I
think magnitude is compliant now, both in its API and its
innards. The only thing missing is to raise objects instead
of strings.
Also: "precision" is the correct spelling of that word.

Now that's embarrassing. Thanks.

jm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top