On 08/30/2018 01:49 PM, Marko Ristin-Kaufmann wrote:
classC(A):
# C.some_func also inherits the contracts from A.
# It weakens the precondition:
# it operates either on sorted lists OR
# the lists that are shorter than 10 elements.
#
# It
Neil Girdhar wrote:
Powers of other numbers have to keep the same behavior since in general
those kinds of expressions don't create rational numbers.
There are infinitely many other rational numbers that *could*
be given the same treatment, though, e.g. (-8) ** (2/3). If
you don't want to
On 2018-08-30 00:07, Greg Ewing wrote:> Jonathan Goble wrote:
>> How? Raising something to the 2/3 power means squaring it and then
>> taking the cube root of it.
>
> On reflection, "wrong" is not quite accurate. A better
> word might be "surprising".
>
> (-1) ** (2/3) == 1 would imply that 1 **
def example_func(x, y):
def __assert_before__(example_func):
#implicit, AST-able assertion expressions
# ... code
def __assert_after__(example_func):
#
def __assert_after__invariants_02(example_func):
# "
But these need to be composed / mixed in in MRO
Sooner or later authors and maintainers of libraries change public
interfaces of their creations.
Usually one of the two approaches is taken:
1. Outright breaking change
2. Soft deprecation later followed by [1]
While [1] is perfectly suitable for libraries with limited audience, [2] is
what
I would also like to point out that the current behavior of Fraction
is consistent with other parts of the numeric system, e.g.
1/1 produces 1.0 (rather than 1)
math.sqrt(4) produces 2.0 (rather than 2)
1j-1j produces 0j (rather than 0.0 or 0)
So in general the type of the output is determined by
On Thu, Aug 30, 2018 at 5:31 PM James Lu wrote:
> It would be nice if there was a DSL for describing neural networks (Keras).
>
> model.add(Dense(units=64, activation='relu', input_dim=100))
> model.add(Dense(units=10, activation='softmax'))
>
>
Why not JSON or XML for cross-language
If you want, feel free to take some of the code from:
https://docs.openstack.org/debtcollector/latest/reference/index.html
It was made for a similar purpose (and uses warnings module at its
lowest level) and may offer some things that could be in this new
warnings module.
Code is at:
On Fri, Aug 31, 2018 at 03:40:22AM +0200, Guido van Rossum wrote:
> On Fri, Aug 31, 2018 at 3:19 AM, Michael Selik wrote:
>
> > On Thu, Aug 30, 2018 at 5:31 PM James Lu wrote:
> >
[James]
> >> It would be nice if there was a DSL for describing neural networks
> >> (Keras).
> >>
> >>
In 20 years of programming Python, I have never wanted to augment two
distinct variables by two distinct return values from a function.
I'm sure it's possible to construct some situation where that would be
convenient, and presumably the OP actually encountered that. But the need
is exceedingly
On Thu, Aug 30, 2018 at 9:41 PM Guido van Rossum wrote:
> On Fri, Aug 31, 2018 at 3:19 AM, Michael Selik wrote:
>
>> On Thu, Aug 30, 2018 at 5:31 PM James Lu wrote:
>>
>>> It would be nice if there was a DSL for describing neural networks
>>> (Keras).
>>>
>>> model.add(Dense(units=64,
Hi Ethan,
You are right, I deleted it without noticing.
It should say: pre(len(lst) < 10).
Le jeu. 30 août 2018 à 23:02, Ethan Furman a écrit :
> On 08/30/2018 01:49 PM, Marko Ristin-Kaufmann wrote:
>
> > classC(A):
> > # C.some_func also inherits the contracts from A.
> > # It
> Rather,
>
because Python has become a big and very complete programming
>
environment, and a fairly large language, implementing new syntax
>
requires that a feature increase expressiveness substantially.
That makes sense.
> By comparison,
> x, y += a, b
>
is neither more expressive, nor
On Fri, Aug 31, 2018 at 3:19 AM, Michael Selik wrote:
> On Thu, Aug 30, 2018 at 5:31 PM James Lu wrote:
>
>> It would be nice if there was a DSL for describing neural networks
>> (Keras).
>>
>> model.add(Dense(units=64, activation='relu', input_dim=100))
>> model.add(Dense(units=10,
Why shouldn't Python be better at implementing Domain Specific Languages?
>From Johnathan Fine:
> I really do wish we could have language that had all of Ruby's
> strengths, and also all of Python's. That would be really nice. Quite
> something indeed.
> Languages do influence each other. Ruby
On Fri, Aug 31, 2018 at 4:04 AM, David Mertz wrote:
> On Thu, Aug 30, 2018 at 9:41 PM Guido van Rossum wrote:
>
>> On Fri, Aug 31, 2018 at 3:19 AM, Michael Selik wrote:
>>
>>> On Thu, Aug 30, 2018 at 5:31 PM James Lu wrote:
>>>
It would be nice if there was a DSL for describing neural
On Fri, Aug 31, 2018, 12:08 AM Guido van Rossum wrote:
> Hm. YAML is indeed a great, readable alternative to JSON or XML. But the
> term DSL implies (to me) more than just nested key-value pairs. (Though who
> knows maybe that's all Keras needs, and then it's a poor argument for
> having a DSL.)
On Thu, Aug 30, 2018 at 2:09 AM Greg Ewing
wrote:
> Jeroen Demeyer wrote:
> > On 2018-08-30 06:39, Neil Girdhar wrote:
> >
> >> I'd like these to be Fraction(1), Fraction(1), and Fraction(0).
> >
> > Why? I cannot think of any natural use case why you would want Fractions
> > for a few special
There are a lot of misunderstandings in this thread. It's probably best to
start by reading up on the roots of unity (
https://en.wikipedia.org/wiki/Root_of_unity). The key ideas are that a
real number has two complex square roots, three complex cube roots, and so
on.
Normally, in Python, we
On Thu, Aug 30, 2018, 2:08 AM Greg Ewing
wrote:
> Also, Fraction(1) for the second case would be flat-out wrong.
>
How? Raising something to the 2/3 power means squaring it and then taking
the cube root of it. -1 squared is 1, and the cube root of 1 is 1. Or am I
having a 2:30am brain fart?
>
On Thu, Aug 30, 2018 at 4:30 PM, Jonathan Goble wrote:
> On Thu, Aug 30, 2018, 2:08 AM Greg Ewing
> wrote:
>>
>> Also, Fraction(1) for the second case would be flat-out wrong.
>
>
> How? Raising something to the 2/3 power means squaring it and then taking
> the cube root of it. -1 squared is 1,
Jeroen Demeyer wrote:
On 2018-08-30 06:39, Neil Girdhar wrote:
I'd like these to be Fraction(1), Fraction(1), and Fraction(0).
Why? I cannot think of any natural use case why you would want Fractions
for a few special cases on an operation which returns non-Fractions
generically.
Also,
Jonathan Goble wrote:
How? Raising something to the 2/3 power means squaring it and then
taking the cube root of it.
On reflection, "wrong" is not quite accurate. A better
word might be "surprising".
(-1) ** (2/3) == 1 would imply that 1 ** (3/2) == -1.
I suppose that could be considered true
On 2018-08-30 11:05, Jonathan Fine wrote:
I'm used to using a number theory computer algebra system
https://pari.math.u-bordeaux.fr/.
I don't think that a comparison with PARI is very relevant because PARI
doesn't really have a type system the way that Python does. For example
the fraction
On Thu, Aug 30, 2018 at 5:11 AM Jonathan Fine wrote:
> Hi Neil
>
> We wrote
>
> >> This gives the same results as Python's Fraction, except for your
> >> example [6]. There, it gives the Fraction(0) you ask for.
> >>
> >> If the smart mathematicians and computer scientists that wrote gp/pari
>
Neil Girdhar wrote:
we want branch continuity in the power.
After all, floating point values have some inaccuracy, and we wouldn't
want chaotic behavior, i.e., small changes to the power to have drastic
changes to the result.
This is not like Fraction where we know that x ** Fraction(1, 3)
On 2018-08-30 11:11, Jonathan Fine wrote:
If anyone has time and ready access, it would help to know what
https://www.sympy.org/en/index.html does with this.
It handles such powers symbolically, not actually returning a numerical
result:
>>> from sympy import Rational
>>> Rational(1,2) **
With gmpy2 (note that mpq=fractions, mpfr=floating-point reals):
>>> from gmpy2 import mpq
>>> mpq("1/1") ** mpq("2/3")
mpfr('1.0')
>>> mpq("-1/1") ** mpq("2/3")
mpfr('nan')
>>> mpq("0/1") ** mpq("2/3")
mpfr('0.0')
___
Python-ideas mailing list
On Thu, Aug 30, 2018 at 5:27 AM Greg Ewing
wrote:
> Neil Girdhar wrote:
> > we want branch continuity in the power.
> > After all, floating point values have some inaccuracy, and we wouldn't
> > want chaotic behavior, i.e., small changes to the power to have drastic
> > changes to the result.
>
>> Right, but we already have some special cases:
>
> In [8]: Fraction(2, 3) ** Fraction(3, 1)
> Out[8]: Fraction(8, 27)
>
> Fraction.__pow__ already tries to return Fraction objects where possible.
>
I think the main point to see here is what the scope of a built-in function
should be.
For a
Jeroen Demeyer wrote
from sympy import Rational
Rational(1,2) ** Rational(2,3)
> 2**(1/3)/2
Rational(1,1) ** Rational(2,3)
> 1
Rational(-1,1) ** Rational(2,3)
> (-1)**(2/3)
Rational(0,1) ** Rational(2,3)
> 0
Thank you very much for this, Jeroen. Most helpful.
Perhaps
On 30.08.2018 03:27, 大野隆弘 wrote:
> Dear all,
>
> I would like to use zipfile encryption as python standard library.
> https://github.com/python/cpython/blob/master/Lib/zipfile.py
>
> Below document says "currently" cannot.
> https://github.com/python/cpython/blob/master/Doc/library/zipfile.rst
>
On Thu, 30 Aug 2018 at 08:38, Neil Girdhar wrote:
>
> There are a lot of misunderstandings in this thread. It's probably best to
> start by reading up on the roots of unity
> (https://en.wikipedia.org/wiki/Root_of_unity). The key ideas are that a real
> number has two complex square roots,
Sorry if this gets double posted. Can people using Google Groups
*please* adjust the mail headers so that mailing list posters can
reply without getting errors? Ideally stop using Google Groups, but if
you have to, please consider those that don't. Specifically, please
remove the Google Groups
Neil Girdhar writes:
> There are a lot of misunderstandings in this thread. It's probably
> best to start by reading up on the roots of unity (
> https://en.wikipedia.org/wiki/Root_of_unity).
That's not very polite, especially in context where somebody has
already conceded that his "wrong"
On Thu, Aug 30, 2018 at 4:01 AM Paul Moore wrote:
> On Thu, 30 Aug 2018 at 08:38, Neil Girdhar wrote:
> >
> > There are a lot of misunderstandings in this thread. It's probably best
> to start by reading up on the roots of unity (
> https://en.wikipedia.org/wiki/Root_of_unity). The key ideas
Hi,
@David Mertz, Eric Fahlgren re inheritance: thank you very much for your
suggestions. I will try to see how inheritance can be implemented with
metaclasses and annotations and put it into icontract library.
@David Mertz re costs:
> Adding a new feature, even if it is *technically* backwards
On Wed, 29 Aug 2018 at 23:08, Marko Ristin-Kaufmann
wrote:
>
> Hi,
> I think we got entangled in a discussion about whether design-by-contract is
> useful or not. IMO, the personal experience ("I never used/needed this
> feature") is quite an inappropriate rule whether something needs to be
>
On Thu, Aug 30, 2018 at 4:38 AM Stephen J. Turnbull <
turnbull.stephen...@u.tsukuba.ac.jp> wrote:
> Neil Girdhar writes:
>
> > There are a lot of misunderstandings in this thread. It's probably
> > best to start by reading up on the roots of unity (
> >
Thank you for responding.
I'm afraid that Windows doesn't and won't support AES zip archive and AES
implementation itself is not small task(at least for me), so I would say
AES support can be next.
https://blogs.msdn.microsoft.com/oldnewthing/20180515-00/?p=98755
Hi Neil
You wrote:
> Would there be any problem with changing:
> In [4]: Fraction(1, 1) ** Fraction(2, 3)
> Out[4]: 1.0
> In [5]: Fraction(-1, 1) ** Fraction(2, 3)
> Out[5]: (-0.4998+0.8660254037844387j)
> In [6]: Fraction(0, 1) ** Fraction(2, 3)
> Out[6]: 0.0
> I'd like these to
Hi Neil
We wrote
>> This gives the same results as Python's Fraction, except for your
>> example [6]. There, it gives the Fraction(0) you ask for.
>>
>> If the smart mathematicians and computer scientists that wrote gp/pari
>> get the same answers, it suggests to me that improvement would be
>>
On Thu, Aug 30, 2018 at 5:51 AM Nicolas Rolin
wrote:
>
>
>
>>> Right, but we already have some special cases:
>>
>> In [8]: Fraction(2, 3) ** Fraction(3, 1)
>> Out[8]: Fraction(8, 27)
>>
>> Fraction.__pow__ already tries to return Fraction objects where possible.
>>
>
>
> I think the main point
Hi Neil
Summary: You say something should be done. But by who? Perhaps the
should starts with you.
Warning: This has been written quickly, and might have rough edges. If
so, I apologise.
You wrote
> But I'm only asking for fractional powers of -1, 0, and 1. Is that really a
> complex issue?
(You're still not fixing your mail headers. Please do, it's hard to be
bothered responding if I keep having to fix your mails in order to do
so).
On Thu, 30 Aug 2018 at 11:28, Neil Girdhar wrote:
>
> But I'm only asking for fractional powers of -1, 0, and 1. Is that really a
> complex issue?
On Thu, Aug 30, 2018 at 3:44 AM Marko Ristin-Kaufmann <
marko.ris...@gmail.com> wrote:
> Related to the text I emphasized, would you mind to explain a bit more
> in-depth which features you have in mind? I see contracts formally written
> out and automatically verified as a completely
On Thu, Aug 30, 2018 at 7:03 AM Jonathan Fine wrote:
> Hi Neil
>
> Summary: You say something should be done. But by who? Perhaps the
> should starts with you.
>
What does this mean? Are you asking who is going to do the
implementation? I posted here to get feedback about whether it would be
I think you could take the implementation further and decide that any power
of Fraction(1) is Fraction(1) and any positive power of Fraction(0) is
Fraction(0).
I woudn't be shocked that Fraction(1) ** 3.7 == Fraction(1) and Fraction(0)
** 3.7 == 0.
However the implementation for Fraction(-1)
On Thu, 30 Aug 2018 at 14:06, Nicolas Rolin wrote:
> I think you could take the implementation further and decide that any
> power of Fraction(1) is Fraction(1) and any positive power of Fraction(0)
> is Fraction(0).
> I woudn't be shocked that Fraction(1) ** 3.7 == Fraction(1) and
> Fraction(0)
Hey, no worries. I do think though that people should feel free to suggest
ideas even if they have never contributed anything. I read python-ideas
for the discussion. Thank you for your feedback about my suggestion.
On Thu, Aug 30, 2018 at 8:18 AM Jonathan Fine wrote:
> Hi Neil
>
> When I
On Thu, 30 Aug 2018 at 12:04, Jonathan Fine wrote:
> First, the docs for the fraction module could be improved. Here's the
> page and it's history.
>
> https://docs.python.org/3/library/fractions.html
> https://github.com/python/cpython/commits/3.7/Doc/library/fractions.rst
>
> Already,
Hi Neil
When I wrote my previous message, I didn't know who you were, or your
previous contributions. Perhaps I should have. But I didn't.
If I had known, my remarks would have been different. In particular, I
would have acknowledged your previous contributions. I apologise for
any offence I may
Thu, 30 Aug 2018 at 12:55, Neil Girdhar wrote:
>
> On Thu, Aug 30, 2018 at 7:13 AM Paul Moore wrote:
>>
>> (You're still not fixing your mail headers. Please do, it's hard to be
>> bothered responding if I keep having to fix your mails in order to do
>> so).
>
>
> Sorry about that, I don't
Thanks for the feedback.
On Thu, Aug 30, 2018 at 7:13 AM Paul Moore wrote:
> (You're still not fixing your mail headers. Please do, it's hard to be
> bothered responding if I keep having to fix your mails in order to do
> so).
>
> On Thu, 30 Aug 2018 at 11:28, Neil Girdhar wrote:
> >
> > But
On Thu, Aug 30, 2018 at 7:13 AM Paul Moore wrote:
> (You're still not fixing your mail headers. Please do, it's hard to be
> bothered responding if I keep having to fix your mails in order to do
> so).
>
Sorry about that, I don't understand where it's coming from. I'm never
using google
Yeah, you're right, my original mail was posted on google groups. Sorry
for the trouble.
On Thu, Aug 30, 2018 at 8:15 AM Paul Moore wrote:
> Thu, 30 Aug 2018 at 12:55, Neil Girdhar wrote:
> >
> > On Thu, Aug 30, 2018 at 7:13 AM Paul Moore wrote:
> >>
> >> (You're still not fixing your mail
On Wed, Aug 29, 2018 at 09:39:05PM -0700, Neil Girdhar wrote:
> Would there be any problem with changing:
>
> In [4]: Fraction(1, 1) ** Fraction(2, 3)
> Out[4]: 1.0
>
> In [5]: Fraction(-1, 1) ** Fraction(2, 3)
> Out[5]: (-0.4998+0.8660254037844387j)
>
> In [6]: Fraction(0, 1) **
57 matches
Mail list logo