On Sat, Aug 27, 2016 at 01:16:42PM +1200, Greg Ewing wrote:
> Steven D'Aprano wrote:
>
> >Obviously if I write 1.1K then I'm expecting a float.
>
> Why is it obvious that you're expecting a float and not
> a decimal in that case?
Because if you search the list archives you'll see that, in the sh
>> Proposal number two: don't make any changes to the syntax, but treat
these as *literally* numeric scale factors.
>> k = kilo = 10**3
>> M = mega = 10**6
>> G = giga = 10**9
>>
>> int_value = 8*M float_value = 8.0*M
>> fraction_value = Fraction(1, 8)*M
>> decimal_value = Decimal("1.2345")*M
This
SPICE, written by Larry Nagel, introduced the concept in 1972. It is a circuit
simulator, and the language involved was a netlist language: basically a list of
components, the nodes there were connected to, and their values. It looked like
this:
R1 1 0 1K
C1 1 0 1nF
I1 1 0 1mA
SPICE was an incre
Steven D'Aprano wrote:
Why is it obvious that you're expecting a float and not
a decimal in that case?
Because if you search the list archives you'll see that, in the short
term at least, I'm not in favour of changing the default floating point
type from binary floats to decimal floats *wink
On Sat, Aug 27, 2016 at 03:24:49PM +0900, Stephen J. Turnbull wrote:
> If you want to change the *language* you need to provide answers to
> the following. I have no answers to them that I like, but maybe you
> can do better.
>
> How about 2.4Gaunitwithaveryveryveryveryveryverylongname?
Why woul
SI units are a standard that was kind of imposed top down on the computer
science community. But we learned to use KB MB so why no keep the defacto
standard we already have? Kibibytes and mibibytes were never really
adopted.
1K == 1000
1KB == 1024
1M == 1000**2
1MB == 1024**2
Suffixes, simple.
i
MRAB writes:
> When you divide 2 values, they could have the same or different units,
> but must have the same colours. The result will have a combination of
> the units (some might also cancel out), but will have the same colours.
>
> # "amp" is a unit, "current" is a colour.
>
I've been following this discussion on and off for a while, but
still fail to see how SI units, factors or the like are a use
case which is general enough to warrant changing the language.
There are packages available on PyPI for dealing with this
in a similar way we deal with decimal literals in
On 27/08/2016 10:44, Ken Kundert wrote:
> SPICE, written by Larry Nagel, introduced the concept in 1972. It is a
> circuit
> simulator, and the language involved was a netlist language: basically a list
> of
> components, the nodes there were connected to, and their values. It looked
> like
>
Ken Kundert writes:
> The rule is you cannot give unit without a scale factor, and the
> unity scale factor is _, so if you wanted to say 1 mol you would
> use 1_mol. 1mol means one milli ol. These look a little strange,
> but that is because the use they unit scale factor, which is the
> on
It really feels like the OP simply wants Python to become a language for
circuit design, with no consideration of general pulse usability, not of
other domains. Little in the proposal translates well outside his
particular domain, and the differences between domains simply make the
proposed additio
On Fri, Aug 26, 2016 at 03:23:24PM -0700, Ken Kundert wrote:
> Steven,
> This keeps coming up, so let me address it again.
>
> First, I concede that you are correct that my proposal does not provide
> dimensional analysis, so any dimensional errors that exist in this new code
> will
> not b
On Sun, Aug 28, 2016 at 4:25 AM, Steven D'Aprano wrote:
>
> Sympy (apparently) doesn't warn you if your units are incompatible, it
> just treats them as separate terms in an expression:
>
> py> 2*m + 3*K
> 3*K + 2*m
>
> which probably makes sense from the point of view of a computer algebra
> syst
On 26 August 2016 at 18:35, Steven D'Aprano wrote:
> I think that units are orthogonal to types: I can have a float of unit
> "gram" and a Fraction of unit "gram", and they shouldn't necessarily be
> treated as the same type.
I think you are mixing here what I sometimes call classes (i.e. runtime
Just to mention, these K M G suffixes are dimensionless. They can be used
simply out of convenience, like 4K is a shorthand for 4000. And 9G is
definitely easier to write and *therefore less prone to error* than a full
literal. Dimensional analysis is fine but not the only reason to add these.
poz
15 matches
Mail list logo