Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Marko Rauhamaa
Lukas Barth : > On Saturday, August 1, 2015 at 10:57:19 PM UTC+2, Marko Rauhamaa wrote: >> >> def circularly_equal(l1, l2): >> length = len(l1) >> if length != len(l2): >> return False >> twice = l1 + l1 >

Re: My code won't work if I double click the saved file

2015-08-01 Thread Rustom Mody
On Saturday, August 1, 2015 at 9:28:56 PM UTC+5:30, Ben Iannitelli wrote: > Everyone else: sorry if I messed up with this post somehow, it's my first > time writing back to anyone on the newsletter. Its fine Thanks for trying to help [Just try to (hard)break your lines at around 72 columns/chars

Re: __main__ vs official module name: distinct module instances

2015-08-01 Thread Chris Angelico
On Sun, Aug 2, 2015 at 1:53 PM, Cameron Simpson wrote: > What are the implications of modifying the python invocation: > > python -m cs.app.maildb > > to effectively do this (Python pseudo code): > > M = importlib.import("cs.app.maildb") > M.__name__ = '__main__' > sys.modules['__main__'] = M

__main__ vs official module name: distinct module instances

2015-08-01 Thread Cameron Simpson
Hi All, Maybe this should be over in python-ideas, since there is a proposal down the bottom of this message. But first the background... I've just wasted a silly amount of time debugging an issue that really I know about, but had forgotten. I have a number of modules which include a main()

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Paul Rubin
Paul Rubin writes: > H([b-a, c-b, d-c, a-d]) > where H is your favorite hash function on a list of that element type. I wrote that up unclearly. H is supposed to be a hash on one element, and then you combine H(b-a), H(c-b), etc. in a commutative way, such as by adding them. Still not sure if

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Paul Rubin
Lukas Barth writes: >> [Concatenated Hashes] > Also, that still doesn't compute that one "canonical ordering"... It was intended to get rid of the need. What is the actual application? How does this sound? To circularly hash [a,b,c,d] use: H([b-a, c-b, d-c, a-d]) where H is your favorite h

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Cameron Simpson
On 01Aug2015 15:55, Lukas Barth wrote: On Sunday, August 2, 2015 at 12:32:25 AM UTC+2, Cameron Simpson wrote: Fine. This also eliminates any solution which just computes a hash. Exactly. Might I suggest instead simply starting with the leftmost element in the first list; call this elem0. T

Re: Send data to asyncio coroutine

2015-08-01 Thread Javier
El sábado, 1 de agosto de 2015, 21:15:07 (UTC+2), Marko Rauhamaa escribió: > Javier : > > > My intention now is to use the asyncio.StreamReader passed as argument > > to the asyncio.start_server callback to read objects serialized with > > pickle. The problems are that pickle cant read from it (b

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread wolfram.hinderer--- via Python-list
Am Samstag, 1. August 2015 22:34:44 UTC+2 schrieb Lukas Barth: > Hi! > > I have a list of numbers that I treat as "circular", i.e. [1,2,3] and [2,3,1] > should be the same. Now I want to rotate these to a well defined status, so > that I can can compare them. > > If all elements are unique, the

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Josh English
On Saturday, August 1, 2015 at 3:52:25 PM UTC-7, Lukas Barth wrote: > On Saturday, August 1, 2015 at 11:37:48 PM UTC+2, Emile van Sebille wrote: > > Well, it looks to me that I don't know what a 'canonical rotation' is -- > > That's because it is not defined. ;) > > I need a way to rotate one of

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Lukas Barth
On Sunday, August 2, 2015 at 1:05:32 AM UTC+2, Oscar Benjamin wrote: > Do you really need the canonical rotation or just a hash that is invariant > under rotations? Having that canonical rotation would make the code simpler and faster, probably, but a rotationally invariant hash is a good start.

Re: Send data to asyncio coroutine

2015-08-01 Thread Chris Angelico
On Sun, Aug 2, 2015 at 5:33 AM, Mark Lawrence wrote: > Please keep up, 3.5 is in beta and the current default will be 3.6 :) Not sure what you mean by "default", but I've been running 3.6.0a0 for a while now :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Oscar Benjamin
On Sun, 2 Aug 2015 00:05 Oscar Benjamin wrote: On Sat, 1 Aug 2015 22:06 Lukas Barth wrote: Nice idea! But I actually really need those "canonic rotations", since I'm hashing them somewhere. Do you really need the canonical rotation or just a hash that is invariant under rotations? I don't

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Oscar Benjamin
On Sat, 1 Aug 2015 22:06 Lukas Barth wrote: Nice idea! But I actually really need those "canonic rotations", since I'm hashing them somewhere. Do you really need the canonical rotation or just a hash that is invariant under rotations? I don't know of a solution to the former that is better

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Lukas Barth
On Sunday, August 2, 2015 at 12:32:25 AM UTC+2, Cameron Simpson wrote: > Fine. This also eliminates any solution which just computes a hash. Exactly. > Might I suggest instead simply starting with the leftmost element in the > first > list; call this elem0. Then walk the second list from 0 to

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Joel Goldstick
On Sat, Aug 1, 2015 at 6:51 PM, Lukas Barth wrote: > On Saturday, August 1, 2015 at 11:37:48 PM UTC+2, Emile van Sebille wrote: >> Well, it looks to me that I don't know what a 'canonical rotation' is -- > > That's because it is not defined. ;) > > I need a way to rotate one of these lists in a wa

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Lukas Barth
On Saturday, August 1, 2015 at 11:43:28 PM UTC+2, Paul Rubin wrote: > How large are these lists supposed to be? Potentially large. Not so large though that iterating them (multiple times) should be a problem. > [Concatenated Hashes] > > If the lists are very large that doesn't sound so great d

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Lukas Barth
On Saturday, August 1, 2015 at 11:37:48 PM UTC+2, Emile van Sebille wrote: > Well, it looks to me that I don't know what a 'canonical rotation' is -- That's because it is not defined. ;) I need a way to rotate one of these lists in a way so that it will produce the same output every time, regar

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Cameron Simpson
On 01Aug2015 14:24, Lukas Barth wrote: Perhaps I should clarify a bit: - I definitely need a "canonical rotation" - just a comparison result is not enough Fine. This also eliminates any solution which just computes a hash. - It does not matter what that rotation is. Starting with the smalle

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Paul Rubin
Lukas Barth writes: > - It does not matter what that rotation is. Starting with the smallest > element was just an idea by me, any rotation that can easily produced > will do. How large are these lists supposed to be? If they're (say) 5 elements, you could make the hash code consist of the conca

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Emile van Sebille
On 8/1/2015 2:24 PM, Lukas Barth wrote: Perhaps I should clarify a bit: - I definitely need a "canonical rotation" - just a comparison result is not enough Well, it looks to me that I don't know what a 'canonical rotation' is -- there's no wikipedia article and googling yields all sorts of

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Emile van Sebille
On 8/1/2015 2:12 PM, Lukas Barth wrote: On Saturday, August 1, 2015 at 10:51:03 PM UTC+2, Emile van Sebille wrote: Is the problem to determine if one list of circular numbers 'matches' another one despite rotation status? If so, I'd do something like: Well.. no. I actually really need this "c

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Lukas Barth
Perhaps I should clarify a bit: - I definitely need a "canonical rotation" - just a comparison result is not enough - It does not matter what that rotation is. Starting with the smallest element was just an idea by me, any rotation that can easily produced will do. -- https://mail.python.org/m

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Lukas Barth
On Saturday, August 1, 2015 at 10:51:03 PM UTC+2, Emile van Sebille wrote: > Is the problem to determine if one list of circular numbers 'matches' > another one despite rotation status? If so, I'd do something like: Well.. no. I actually really need this "canonical" rotation, since I'm hashing

Re: I'm a newbie and I'm stumped...

2015-08-01 Thread Paulo da Silva
On 31-07-2015 02:22, Dwight GoldWinde wrote: > Please help. > > I am running Python 3.4 on my Mac mini, OS X 10.10.2, using Coderunner 2 > as my editor. > > Here’s the code: > #!/usr/bin/env python3 > word = (input('Enter a word ‘)) As is here, this code should raise a syntax error message like

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Lukas Barth
On Saturday, August 1, 2015 at 10:57:19 PM UTC+2, Marko Rauhamaa wrote: > > def circularly_equal(l1, l2): > length = len(l1) > if length != len(l2): > return False > twice = l1 + l1 > for i in range(len

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Marko Rauhamaa
Lukas Barth : > I have a list of numbers that I treat as "circular", i.e. [1,2,3] and > [2,3,1] should be the same. Now I want to rotate these to a well defined > status, so that I can can compare them. > > If all elements are unique, the solution is easy: find the minimum > element, find its inde

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Emile van Sebille
On 8/1/2015 1:34 PM, Lukas Barth wrote: Hi! I have a list of numbers that I treat as "circular", i.e. [1,2,3] and [2,3,1] should be the same. Now I want to rotate these to a well defined status, so that I can can compare them. If all elements are unique, the solution is easy: find the minimum

Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Lukas Barth
Hi! I have a list of numbers that I treat as "circular", i.e. [1,2,3] and [2,3,1] should be the same. Now I want to rotate these to a well defined status, so that I can can compare them. If all elements are unique, the solution is easy: find the minimum element, find its index, then use mylist

Re: Which Python do I need for the below?

2015-08-01 Thread Emile van Sebille
On 8/1/2015 10:09 AM, Rustom Mody wrote: On Saturday, August 1, 2015 at 10:07:37 PM UTC+5:30, Emile van Sebille wrote: Seeing that you have no responses yet I'm guessing most potential responders along with me are not opening attachments. Most recipients are not receiving at all! [I only see

Re: Send data to asyncio coroutine

2015-08-01 Thread Mark Lawrence
On 01/08/2015 20:07, Javier wrote: El sábado, 1 de agosto de 2015, 20:46:49 (UTC+2), Mark Lawrence escribió: Well! let's forget all this and let's work with python 3.4 :) Please keep up, 3.5 is in beta and the current default will be 3.6 :) -- My fellow Pythonistas, ask not what our languag

Re: Send data to asyncio coroutine

2015-08-01 Thread Mark Lawrence
On 01/08/2015 20:09, Marko Rauhamaa wrote: Mark Lawrence : On 01/08/2015 19:38, Marko Rauhamaa wrote: It is odd how an engineering forum like this one so often judges ideas based on the pedigree of the participants rather than objective technical arguments. What I find odd is that the bleati

Re: Send data to asyncio coroutine

2015-08-01 Thread Marko Rauhamaa
Javier : > My intention now is to use the asyncio.StreamReader passed as argument > to the asyncio.start_server callback to read objects serialized with > pickle. The problems are that pickle cant read from it (because dont > yield from the full stack) and that I don't know the exact length of > e

Re: Send data to asyncio coroutine

2015-08-01 Thread Marko Rauhamaa
Mark Lawrence : > On 01/08/2015 19:38, Marko Rauhamaa wrote: >> It is odd how an engineering forum like this one so often judges >> ideas based on the pedigree of the participants rather than objective >> technical arguments. > > What I find odd is that the bleating and whinging comes long after t

Re: Send data to asyncio coroutine

2015-08-01 Thread Javier
El sábado, 1 de agosto de 2015, 20:46:49 (UTC+2), Mark Lawrence escribió: > On 01/08/2015 19:38, Marko Rauhamaa wrote: > > Javier : > > > >> El sábado, 1 de agosto de 2015, 18:45:17 (UTC+2), Mark Lawrence escribió: > >>> clearly you know better than the Python core developers > >> > >> Nobody thi

Re: GvR Europython keynote described on lwn.net

2015-08-01 Thread Rick Johnson
On Saturday, August 1, 2015 at 12:45:45 AM UTC-5, Steven D'Aprano wrote: > > Yep, even the BDFL is actively developing in 2.7! He's no fool. > > Of course not. Dropbox pay him to work on their systems, > and he wants to keep his job. Thanks for confirming my point that Python3 is not worth devel

Re: Send data to asyncio coroutine

2015-08-01 Thread Mark Lawrence
On 01/08/2015 19:38, Marko Rauhamaa wrote: Javier : El sábado, 1 de agosto de 2015, 18:45:17 (UTC+2), Mark Lawrence escribió: clearly you know better than the Python core developers Nobody thinks that self is better than core developers, and personaly I don't think I am better than anybody,

Re: Send data to asyncio coroutine

2015-08-01 Thread Marko Rauhamaa
Javier : > El sábado, 1 de agosto de 2015, 18:45:17 (UTC+2), Mark Lawrence escribió: >> clearly you know better than the Python core developers > > Nobody thinks that self is better than core developers, and personaly > I don't think I am better than anybody, but, I have my own opinion. It is od

Re: I'm a newbie and I'm stumped...

2015-08-01 Thread Terry Reedy
On 7/30/2015 9:22 PM, Dwight GoldWinde wrote: Please help. I am running Python 3.4 on my Mac mini, OS X 10.10.2, using Coderunner 2 as my editor. Here’s the code: #!/usr/bin/env python3 word = (input('Enter a word ‘)) The outer parentheses are not needed. Ditto to the other comments, especial

Re: Send data to asyncio coroutine

2015-08-01 Thread Marko Rauhamaa
Javier : > I agree with you, Marko, I came from callbacks too. So, if GvR wants > the yield from become de-facto, does it mean that all python libraries > will evolve to become asyncio friendly libs? or that I have to write > my own library so I can use existing libraries like pickle? I think > "c

Re: Send data to asyncio coroutine

2015-08-01 Thread Javier
El sábado, 1 de agosto de 2015, 18:45:17 (UTC+2), Mark Lawrence escribió: > On 01/08/2015 17:07, Javier wrote: > > > > Asyncio is a crazy headache! I realized that I can't use asyncio tcp > > servers with pickle! Asyncio is good as a concept but bad in real life. > > > > I think python's non bloc

Re: Send data to asyncio coroutine

2015-08-01 Thread Javier
El sábado, 1 de agosto de 2015, 19:19:00 (UTC+2), Marko Rauhamaa escribió: > Javier : > > > Asyncio is a crazy headache! I realized that I can't use asyncio tcp > > servers with pickle! Asyncio is good as a concept but bad in real > > life. > > > > I think python's non blocking I/O is far from be

Re: Send data to asyncio coroutine

2015-08-01 Thread Marko Rauhamaa
Javier : > Asyncio is a crazy headache! I realized that I can't use asyncio tcp > servers with pickle! Asyncio is good as a concept but bad in real > life. > > I think python's non blocking I/O is far from being something useful > for developers till non-async code can invoke async code > transpar

Re: Which Python do I need for the below?

2015-08-01 Thread Rustom Mody
On Saturday, August 1, 2015 at 10:07:37 PM UTC+5:30, Emile van Sebille wrote: > On 7/29/2015 10:52 AM, Joe Sanders wrote: > > Hello- Which Python do I need for the below? with instructions please! > > > > [cid:image001.png@01D0C9FD.677CDED0] > > Seeing that you have no responses yet I'm guessing m

Re: Send data to asyncio coroutine

2015-08-01 Thread Mark Lawrence
On 01/08/2015 17:07, Javier wrote: Asyncio is a crazy headache! I realized that I can't use asyncio tcp servers with pickle! Asyncio is good as a concept but bad in real life. I think python's non blocking I/O is far from being something useful for developers till non-async code can invoke as

Re: Which Python do I need for the below?

2015-08-01 Thread Mark Lawrence
On 29/07/2015 18:52, Joe Sanders wrote: Hello- Which Python do I need for the below? with instructions please! Kind Regards, *Gerald"Joe"Sanders* For your 32 bit machine https://www.python.org/downloads/release/python-343/ "Windows x86 MSI installer" which is the last one listed. -- My f

Re: Which Python do I need for the below?

2015-08-01 Thread Emile van Sebille
On 7/29/2015 10:52 AM, Joe Sanders wrote: Hello- Which Python do I need for the below? with instructions please! [cid:image001.png@01D0C9FD.677CDED0] Seeing that you have no responses yet I'm guessing most potential responders along with me are not opening attachments. If the image is of sc

Re: I'm a newbie and I'm stumped...

2015-08-01 Thread Emile van Sebille
On 7/30/2015 6:22 PM, Dwight GoldWinde wrote: I am running Python 3.4 on my Mac mini, OS X 10.10.2, using Coderunner 2 as my editor. Here¹s the code: #!/usr/bin/env python3 word = (input('Enter a word Œ)) When running this inside of Coderunner, I get the follow error, after entering the word Œs

Re: I'm a newbie and I'm stumped...

2015-08-01 Thread Joel Goldstick
On Thu, Jul 30, 2015 at 9:22 PM, Dwight GoldWinde wrote: > Please help. > > I am running Python 3.4 on my Mac mini, OS X 10.10.2, using Coderunner 2 as > my editor. > > Here’s the code: > #!/usr/bin/env python3 > word = (input('Enter a word ‘)) > > When running this inside of Coderunner, I get the

Re: Send data to asyncio coroutine

2015-08-01 Thread Javier
El martes, 21 de julio de 2015, 13:31:56 (UTC+2), Javier escribió: > Hello, I'm trying to understand and link asyncio with ordinary coroutines. > Now I just want to understand how to do this on asyncio: > > > def foo(): > data = yield 8 > print(data) > yield "bye" > > def bar()

Which Python do I need for the below?

2015-08-01 Thread Joe Sanders
Hello- Which Python do I need for the below? with instructions please! [cid:image001.png@01D0C9FD.677CDED0] Kind Regards, Gerald"Joe"Sanders Customer Global Quality Accounts 951 SanDisk Drive, building #5 | Milpitas, CA 95035 USA | cell +1,512.818.7798 corporate + 1.408.801.1000 | joe.sand...

I'm a newbie and I'm stumped...

2015-08-01 Thread Dwight GoldWinde
Please help. I am running Python 3.4 on my Mac mini, OS X 10.10.2, using Coderunner 2 as my editor. Here¹s the code: #!/usr/bin/env python3 word = (input('Enter a word Œ)) When running this inside of Coderunner, I get the follow error, after entering the word Œserendipity¹: Enter a word serendi

Re: Improper Django Project error (solved)

2015-08-01 Thread Gary Roach
On 07/30/2015 11:15 PM, dieter wrote: Gary Roach writes: Being new to Django and Python, I have two projects setup side by side, each in it's own virtualenv wrapper. The twr_project is running Django 1.7, python 2.7 and is set up to duplicate the 'Tango With Rango' tutorial. The archivedb proje

RE: My code won't work if I double click the saved file

2015-08-01 Thread Ben Iannitelli
> > On 29Jul2015 00:20, john wrote: > >> I have windows 8 running on my computer and I think I downloaded > >> python 2 and 3 simultaneously or I think my computer has built in > >> python 2 and I downloaded python 3. John, Sorry to back-track this conversation, but would you mind telling us som

Display a cleaned version of a XChat log

2015-08-01 Thread Cecil Westerhof
I discovered IRC again. ;-) I want to use Python to display a cleaned version of the XChat logs. One reason is that I keep channels open, and later want to look if there was anything interesting. But most lines are status messages that do not interest me and should be hidden from me. A *VERY* ru

Re: debugging during package development

2015-08-01 Thread Sebastian Luque
On Sat, 01 Aug 2015 15:30:34 +1000, Ben Finney wrote: > Seb writes: >> With lots of debugging to do, the last thing I'd want is to worry >> about the search path. > Short answer: you need ‘python3 ./setup.py develop’. > Medium-length answer: you need to add some infrastructure to get your > pr

Re: New module (written in C) for using the high-precision QD library

2015-08-01 Thread baruchel
Hi, Thank you for your answer. Actually this is the third version I am writing for using the QD library; the first onPython using ctypes; the second one was in Cython; this one is in C. I don't claim being a Cython expert and maybe my Cython code was not optimal but I can say the C version is s