Re: General Purpose Pipeline library?

2017-11-20 Thread duncan smith
On 20/11/17 15:48, Jason wrote: > a pipeline can be described as a sequence of functions that are applied to an > input with each subsequent function getting the output of the preceding > function: > > out = f6(f5(f4(f3(f2(f1(in)) > > However this isn't very readable and does not support co

Re: "help( pi )"

2017-11-20 Thread Cameron Simpson
On 20Nov2017 10:49, Greg Ewing wrote: Cameron Simpson wrote: Unless one had a misfortune and wanted another docstring. Good point. I guess having differing docstrings should make otherwise equal objects ineligible for merging. [...example...] I think setting the docstring of an existing i

Re: General Purpose Pipeline library?

2017-11-20 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): > Jason writes: >>I feel like I'm reinventing a wheel here. I was wondering if >>there's already something that exists? > > Why do you want this? Some time back Stephen D'Aprano demonstrated how the | operator can be defined to create pipelines in Python.

Re: __hash__ and ordered vs. unordered collections

2017-11-20 Thread Chris Angelico
On Tue, Nov 21, 2017 at 6:50 AM, Josh B. wrote: > On Monday, November 20, 2017 at 1:55:26 PM UTC-5, Chris Angelico wrote: >> But what you have is the strangeness of non-transitive equality, which >> is likely to cause problems. > > But this is exactly how Python's built-in dict and OrderedDict beh

Re: How to Generate dynamic HTML Report using Python

2017-11-20 Thread Chris Angelico
On Tue, Nov 21, 2017 at 5:47 AM, Michael Torrie wrote: > You also have this header set: >> X-Copyright: (C) Copyright 2017 Stefan Ram. All rights reserved. >> Distribution through any means other than regular usenet >> channels is forbidden. It is forbidden to publish this >> article in the world

Re: __hash__ and ordered vs. unordered collections

2017-11-20 Thread Josh B.
On Monday, November 20, 2017 at 2:31:40 PM UTC-5, MRAB wrote: > What if there are duplicate elements? > > Should that be MyColl(some_elements) == MyOrderedColl(other_elements) > iff len(some_elements) == len(other_elements) and set(some_elements) == > set(other_elements)? Yes, that's what I mea

Re: __hash__ and ordered vs. unordered collections

2017-11-20 Thread Josh B.
On Monday, November 20, 2017 at 1:55:26 PM UTC-5, Chris Angelico wrote: > But what you have is the strangeness of non-transitive equality, which > is likely to cause problems. But this is exactly how Python's built-in dict and OrderedDict behave: >>> od = OrderedDict([(1, 0), (2, 0), (3, 0)]) >>>

Re: __hash__ and ordered vs. unordered collections

2017-11-20 Thread MRAB
On 2017-11-20 17:47, Josh B. wrote: Suppose we're implementing an immutable collection type that comes in unordered and ordered flavors. Let's call them MyColl and MyOrderedColl. We implement __eq__ such that MyColl(some_elements) == MyOrderedColl(other_elements) iff set(some_elements) == set(

Re: __hash__ and ordered vs. unordered collections

2017-11-20 Thread Chris Angelico
On Tue, Nov 21, 2017 at 4:47 AM, Josh B. wrote: > Now for the question: Is this useful? I ask because this leads to the > following behavior: > unordered = MyColl([1, 2, 3]) ordered = MyOrderedColl([3, 2, 1]) s = {ordered, unordered} len(s) > 1 s = {ordered} unordere

Re: How to Generate dynamic HTML Report using Python

2017-11-20 Thread Michael Torrie
Your thoughts on scope are interesting, if unorthodox. There is a problem with your deleting names after use, which is why we rarely delete names. The problem is that deleting a name does not not necessarily or immediately destroy an object. This can lead to great confusion for programmers comin

Re: Is there something like head() and str() of R in python?

2017-11-20 Thread Mario R. Osorio
On Sunday, November 19, 2017 at 2:05:12 PM UTC-5, Peng Yu wrote: > Hi, R has the functions head() and str() to show the brief content of > an object. Is there something similar in python for this purpose? > > For example, I want to inspect the content of the variable "train". > What is the best wa

__hash__ and ordered vs. unordered collections

2017-11-20 Thread Josh B.
Suppose we're implementing an immutable collection type that comes in unordered and ordered flavors. Let's call them MyColl and MyOrderedColl. We implement __eq__ such that MyColl(some_elements) == MyOrderedColl(other_elements) iff set(some_elements) == set(other_elements). But MyOrderedColl(so

Re: General Purpose Pipeline library?

2017-11-20 Thread Bob Gailer
On Nov 20, 2017 10:50 AM, "Jason" wrote: > > a pipeline can be described as a sequence of functions that are applied to an input with each subsequent function getting the output of the preceding function: > > out = f6(f5(f4(f3(f2(f1(in)) > > However this isn't very readable and does not suppor

Re: General Purpose Pipeline library?

2017-11-20 Thread Skip Montanaro
> I feel like I'm reinventing a wheel here. I was wondering if there's already > something that exists? I've wondered from time-to-time about using shell pipeline notation within Python. Maybe the grapevine package could be a starting point? I realize that's probably not precisely what you're lo

General Purpose Pipeline library?

2017-11-20 Thread Jason
a pipeline can be described as a sequence of functions that are applied to an input with each subsequent function getting the output of the preceding function: out = f6(f5(f4(f3(f2(f1(in)) However this isn't very readable and does not support conditionals. Tensorflow has tensor-focused pip