Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-15 Thread Marko Rauhamaa
Ben Finney : > What well-defined data type exists with the following properties: > > * Mapping, key → value. > > * Each key is a sequence (e.g. `tuple`) of items such as text strings. > > * Items in a key may be the sentinel `ANY` value, which will match any > value at that position. > > * A key

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-15 Thread Zachary Ware
On Thu, Jul 16, 2015 at 1:31 AM, Ben Finney wrote: > Fine by me. What is the mapping API that needs to be implemented though? Have a look at collections.MutableMapping. -- Zach -- https://mail.python.org/mailman/listinfo/python-list

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-15 Thread Ben Finney
Ethan Furman writes: > On 07/15/2015 10:53 PM, Ben Finney wrote: > > Are those the ‘__contains__’, ‘__getitem__’ methods? What actually > > is the API of a mapping type, that would need to be customised for > > this application? > > The problem is that potential key matches are found by hashes F

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-15 Thread Ben Finney
Chris Angelico writes: > I'm not sure you really need a mapping type per se. My reasons include (but I can probably think of more) testing membership via the ‘key in mapping’ syntax. > with the "match any" concept, there's actually a potential for > ambiguities, which means you need a sequentia

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-15 Thread Ethan Furman
On 07/15/2015 10:53 PM, Ben Finney wrote: Steven D'Aprano writes: You can't use a dict for the mapping, not unless you're smarter than me, due to the requirement to hash the keys. Dang. It's the mapping that I really need to solve, I think. A mapping that has a custom “does this candidate m

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-15 Thread Chris Angelico
On Thu, Jul 16, 2015 at 3:55 PM, Ben Finney wrote: > Thanks. The part which puzzle me though: How do we teach the mapping > type about that matching behaviour? I'm not sure you really need a mapping type per se. The benefit of something like Python's dict is that it gives really fast lookups via

Re: Keypress Input

2015-07-15 Thread Terry Reedy
On 7/15/2015 9:03 PM, Rick Johnson wrote: You may have solved your input capturing problem, and i don't think a GUI is the preferred solution for a graphically deficient device anyhow, but you may well need a GUI in the future, and this would be a fine example from which to learn. This really

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-15 Thread Ben Finney
Terry Reedy writes: > On 7/15/2015 9:51 PM, Ben Finney wrote: > > What well-defined data type exists with the following properties: > > > > * Mapping, key → value. > > > > * Each key is a sequence (e.g. `tuple`) of items such as text strings. > > > > * Items in a key may be the sentinel `ANY` val

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-15 Thread Ben Finney
Steven D'Aprano writes: > Sounds like a regular expression. Remember that computer science > theoretical regular expressions don't just match strings, they can > apply to any sequence of primitive values. Good insight, thank you. > In your case, you only need two special tokens, match-one and >

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-15 Thread Terry Reedy
On 7/15/2015 9:51 PM, Ben Finney wrote: Howdy all, What well-defined data type exists with the following properties: * Mapping, key → value. * Each key is a sequence (e.g. `tuple`) of items such as text strings. * Items in a key may be the sentinel `ANY` value, which will match any value a

Re: Keypress Input

2015-07-15 Thread Michael Torrie
On 07/15/2015 07:03 PM, Rick Johnson wrote: > I think you've missed the whole point of the OP's project. He doesn't want to make a GUI. He simply wants to have his program do something like blink an LED when someone presses a big red button. He just wanted a quick way to test things out since

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-15 Thread Steven D'Aprano
On Thu, 16 Jul 2015 11:51 am, Ben Finney wrote: > Howdy all, > > What well-defined data type exists with the following properties: > > * Mapping, key → value. > > * Each key is a sequence (e.g. `tuple`) of items such as text strings. > > * Items in a key may be the sentinel `ANY` value, which

Re: Noob in Python. Problem with fairly simple test case

2015-07-15 Thread Chris Angelico
On Thu, Jul 16, 2015 at 1:33 PM, Rick Johnson wrote: > On Wednesday, July 15, 2015 at 10:11:43 PM UTC-5, Chris Angelico wrote: >> That's a neat trick, as long as you actually do have a console. > > Well if you don't have a console, another option is to use the > dialogs of the "batteries included

Re: Noob in Python. Problem with fairly simple test case

2015-07-15 Thread Rick Johnson
On Wednesday, July 15, 2015 at 10:11:43 PM UTC-5, Chris Angelico wrote: > That's a neat trick, as long as you actually do have a console. Well if you don't have a console, another option is to use the dialogs of the "batteries included GUI" named Tkinter. from tkMessageBox import showinfo # Syn

Re: Noob in Python. Problem with fairly simple test case

2015-07-15 Thread Chris Angelico
On Thu, Jul 16, 2015 at 1:01 PM, Larry Hudson via Python-list wrote: > On 07/15/2015 05:11 AM, Chris Angelico wrote: >> >> On Wed, Jul 15, 2015 at 9:44 PM, Jason P. wrote: >>> >>> I can't understand very well what's happening. It seems that the main >>> thread gets blocked listening to the web se

Re: Noob in Python. Problem with fairly simple test case

2015-07-15 Thread Larry Hudson via Python-list
On 07/15/2015 05:11 AM, Chris Angelico wrote: On Wed, Jul 15, 2015 at 9:44 PM, Jason P. wrote: I can't understand very well what's happening. It seems that the main thread gets blocked listening to the web server. My intent was to spawn another process for the server independent of the test.

Mapping, with sequence as key, wildcard and subsequence matching

2015-07-15 Thread Ben Finney
Howdy all, What well-defined data type exists with the following properties: * Mapping, key → value. * Each key is a sequence (e.g. `tuple`) of items such as text strings. * Items in a key may be the sentinel `ANY` value, which will match any value at that position. * A key may specify that

Re: Keypress Input

2015-07-15 Thread Rick Johnson
On Friday, June 19, 2015 at 12:20:14 AM UTC-5, Christian Gollwitzer wrote: > The nonsense starts here: > > [...snip code...] > > it seems you don't understand event based programming. Duh. No need to abuse the lad. > It waits for the user input and does the dispatching, i.e. > when a key is pr

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Mark Lawrence
On 15/07/2015 23:34, Gregory Ewing wrote: Mark Lawrence wrote: IIRC the realms of the C setjmp and longjmp. Not really the same thing. A longjmp chops the stack back, whereas a tail call avoids putting something on the stack to begin with. Thanks for that :) -- My fellow Pythonistas, ask n

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Gregory Ewing
Antoon Pardon wrote: But it doesn't need to be all or nothing. How about the following possibility. When the runtime detects a serie of tail calls, it will keep the bottom three and the top three backtrace records of the serie. Whatever value you choose for N, keeping only the first/last N trac

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Gregory Ewing
Mark Lawrence wrote: IIRC the realms of the C setjmp and longjmp. Not really the same thing. A longjmp chops the stack back, whereas a tail call avoids putting something on the stack to begin with. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Gregory Ewing
Chris Angelico wrote: Which really says that TCO is impossible if you have any sort of clean-up or deallocation to be done after the call begins. The only way to truly turn your tail call into a GOTO is to do all your cleanup first. Indeed. In compilers that implement TCO, there's quite a lot m

Re: Where is "pyvenv.py" in new Python3.4 environment on CentOS7?

2015-07-15 Thread Mark Lawrence
On 15/07/2015 22:54, David Karr wrote: I'm just learning more about Python (although I've been a Java dev for many years, and C/C++ before that). Welcome to the world of sanity after years of insanity :) A book I'm reading (Learning Python Network Programming) refers to running "pyvenv". I

Where is "pyvenv.py" in new Python3.4 environment on CentOS7?

2015-07-15 Thread David Karr
I'm just learning more about Python (although I've been a Java dev for many years, and C/C++ before that). A book I'm reading (Learning Python Network Programming) refers to running "pyvenv". I can find this in my Win7 environment, but I was planning on using my CentOS7 VM for most of this. I

Re: A new module for performing tail-call elimination

2015-07-15 Thread Terry Reedy
On 7/15/2015 5:29 AM, Antoon Pardon wrote: On 07/13/2015 05:44 PM, Th. Baruchel wrote: Hi, after having spent much time thinking about tail-call elimination in Python (see for instance http://baruchel.github.io/blog/ ), I finally decided to write a module for that. You may find it at: https:

Re: Keypress Input

2015-07-15 Thread Michael Torrie
On 07/15/2015 01:05 PM, John McKenzie wrote: > Hello, all. > > Thanks to everyone who responded to my post. > > I decided to make sure I had something that worked with what I have now > and used Curses to finish it. However, it turns out that the extra work > and problems with using GPIO pin

Re: Keypress Input

2015-07-15 Thread John McKenzie
Hello, all. Thanks to everyone who responded to my post. I decided to make sure I had something that worked with what I have now and used Curses to finish it. However, it turns out that the extra work and problems with using GPIO pins and wiring up controllers that way is a small amount of

Re: password authentication failed

2015-07-15 Thread Chris Angelico
On Thu, Jul 16, 2015 at 3:13 AM, Gary Roach wrote: > Every time I try to do a python manage.py migrate I get: > django.db.utils.OperationalError: FATAL: password > authentication failed for user "postgres" > FATAL: password authentication failed for user "postgres" > > > DATABASES = { >

password authentication failed

2015-07-15 Thread Gary Roach
Every time I try to do a python manage.py migrate I get: django.db.utils.OperationalError: FATAL: password authentication failed for user "postgres" FATAL: password authentication failed for user "postgres" System Debian linux jessie python 2.79 Django 1.8 Postgresql 9.4.3 database Using v

EuroPython 2015: Guidebook (Mobile Schedule) available

2015-07-15 Thread M.-A. Lemburg
We are pleased to announce the official guidebook for the EuroPython 2015 conference: *** https://ep2015.europython.eu/en/events/mobile-schedule/ *** We will regularly issue updates to the guidebook when there are changes in schedule. Available for all platforms ---

A couple virtual env questions

2015-07-15 Thread Skip Montanaro
I built and installed Python from Mercurial tip (head, whatever), so I have a Python 3.6.0a0 available. I created a virtualenv using that. Q1: Suppose I install something like matplotlib into that virtualenv which itself contains extension modules. Those will depend on the include files and shared

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Marko Rauhamaa
Ian Kelly : > On Tue, Jul 14, 2015 at 11:27 AM, Marko Rauhamaa wrote: >> You'll see that the generated code is tail-call-optimized. > > This can't be done generally, though. What if, instead of a local > variable, the assignment were to a dict item? Even if the dict itself > is a local variable,

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Ian Kelly
On Tue, Jul 14, 2015 at 11:27 AM, Marko Rauhamaa wrote: > Ian Kelly : > >> On Tue, Jul 14, 2015 at 2:33 AM, Marko Rauhamaa wrote: >>> The programmer shouldn't be controlling tail call optimizations. >> >> The programmer controls it regardless. >> >> return foo() # TCO >> >> result = foo(

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Chris Angelico
On Wed, Jul 15, 2015 at 7:13 PM, Gregory Ewing wrote: > Chris Angelico wrote: >> >> I'm still interested in the explicit "replace current stack frame with >> this call" operation. Calling it "goto" seems wrong, as most languages >> with goto restrict it to _within_ a function, > > > This just sugg

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Chris Angelico
On Wed, Jul 15, 2015 at 10:00 PM, MRAB wrote: > On 2015-07-15 12:22, Mark Lawrence wrote: >> >> On 15/07/2015 10:13, Gregory Ewing wrote: >>> >>> Chris Angelico wrote: I'm still interested in the explicit "replace current stack frame with this call" operation. Calling it "goto" seem

Re: Noob in Python. Problem with fairly simple test case

2015-07-15 Thread Chris Angelico
On Wed, Jul 15, 2015 at 9:44 PM, Jason P. wrote: > I can't understand very well what's happening. It seems that the main thread > gets blocked listening to the web server. My intent was to spawn another > process for the server independent of the test. Obviously I'm doing something > wrong. I'v

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread MRAB
On 2015-07-15 12:22, Mark Lawrence wrote: On 15/07/2015 10:13, Gregory Ewing wrote: Chris Angelico wrote: I'm still interested in the explicit "replace current stack frame with this call" operation. Calling it "goto" seems wrong, as most languages with goto restrict it to _within_ a function,

Noob in Python. Problem with fairly simple test case

2015-07-15 Thread Jason P.
Hi all! I'm working in a little Python exercise with testing since the beginning. So far I'm with my first end to end test (not even finished yet) trying to: 1) Launch a development web server linked to a demo app that just returns 'Hello World!' 2) Make a GET request successfully I can't un

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Marko Rauhamaa
Ned Batchelder : > On Wednesday, July 15, 2015 at 6:56:10 AM UTC-4, Marko Rauhamaa wrote: >> Ned Batchelder : >> > I don't understand this, can you explain more? Are you saying that the >> > Python specification shouldn't specify what x becomes?: >> > >> > def who_knows(): >> > pass >>

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Mark Lawrence
On 15/07/2015 10:13, Gregory Ewing wrote: Chris Angelico wrote: I'm still interested in the explicit "replace current stack frame with this call" operation. Calling it "goto" seems wrong, as most languages with goto restrict it to _within_ a function, This just suggests to me is that most lang

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Ned Batchelder
On Wednesday, July 15, 2015 at 6:56:10 AM UTC-4, Marko Rauhamaa wrote: > Ned Batchelder : > > > On Wednesday, July 15, 2015 at 2:44:55 AM UTC-4, Marko Rauhamaa wrote: > >> The other problem for tail call elimination is the requirement that > >> functions return None by default. Smooth tail call el

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Antoon Pardon
On 07/15/2015 12:55 PM, Marko Rauhamaa wrote: > Ned Batchelder : > >> On Wednesday, July 15, 2015 at 2:44:55 AM UTC-4, Marko Rauhamaa wrote: >>> The other problem for tail call elimination is the requirement that >>> functions return None by default. Smooth tail call elimination would >>> require t

Re: xlrd 0.9.4 released!

2015-07-15 Thread Karim
On 15/07/2015 08:27, Chris Withers wrote: Hi All, I'm pleased to announce the release of xlrd 0.9.4: http://pypi.python.org/pypi/xlrd/0.9.4 This release includes the following changes: - Automated tests are now run on Python 3.4 - Use ElementTree.iter() if available, not deprecated getiter

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Marko Rauhamaa
Ned Batchelder : > On Wednesday, July 15, 2015 at 2:44:55 AM UTC-4, Marko Rauhamaa wrote: >> The other problem for tail call elimination is the requirement that >> functions return None by default. Smooth tail call elimination would >> require that Python leave the default return value unspecified

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Ned Batchelder
On Wednesday, July 15, 2015 at 2:44:55 AM UTC-4, Marko Rauhamaa wrote: > Gregory Ewing : > > > Marko Rauhamaa wrote: > > >> It might even be tail-call optimized by Python. Only you can't count > >> on it because the language spec doesn't guarantee it. > > > > The language spec might permit it, bu

EuroPython 2015: Guggenheim and Fine Arts Museum

2015-07-15 Thread M.-A. Lemburg
EuroPython is not the only attraction in Bilbao to attend in July. The city also hosts the famous *Guggenheim Museum*, featuring modern art in an amazing building designed by Frank O. Gehry. See below for a special deal we have available for the Guggenheim. You can also find the *Fine Arts Museu

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Marko Rauhamaa
Gregory Ewing : > A tail call *is* a goto. That's how you implement one in assembly > language -- you write a jump instruction instead of a call > instruction. The jump doesn't have to be to the same function. In functional programming languages you might not even have a call stack. Instead, you

Re: Improve usage of Python 3

2015-07-15 Thread Terry Reedy
On 7/14/2015 12:28 PM, Marcos wrote: Hi! Just like many, I want the projects in which I work on to move to Python 3. And incredibly, there are a few users on the same project who refuse to use python 3 simply because of the print statement. That has probably already been discussed, but since I

Re: A new module for performing tail-call elimination

2015-07-15 Thread Antoon Pardon
On 07/13/2015 05:44 PM, Th. Baruchel wrote: > Hi, after having spent much time thinking about tail-call elimination > in Python (see for instance http://baruchel.github.io/blog/ ), I finally > decided to write a module for that. You may find it at: > > https://github.com/baruchel/tco > > Tail-cal

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Gregory Ewing
Chris Angelico wrote: I'm still interested in the explicit "replace current stack frame with this call" operation. Calling it "goto" seems wrong, as most languages with goto restrict it to _within_ a function, This just suggests to me is that most language designers are not very imaginative. :-

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Antoon Pardon
On 07/15/2015 02:41 AM, Terry Reedy wrote: > On 7/14/2015 10:02 AM, Antoon Pardon wrote: >> On 07/14/2015 03:43 PM, Chris Angelico wrote: >>> On Tue, Jul 14, 2015 at 11:38 PM, Marko Rauhamaa >>> wrote: > No, tail call optimization doesn't change the behavior of the program, for the worse

Re: data visualization - graph

2015-07-15 Thread Mark Lawrence
On 15/07/2015 09:08, Kasper Jepsen wrote: Hi, I am looking for a solution to graph charts from real time measurements on the web like: http://pvoutput.org/intraday.jsp?id=16919&sid=14707&gs=1&dxa=1&dt=20150715 I have some solar systems i like to save data into an sql datab

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Antoon Pardon
On 07/14/2015 07:48 PM, Steven D'Aprano wrote: > On Wed, 15 Jul 2015 03:29 am, Marko Rauhamaa wrote: > >> Chris Angelico : >> >>> On Tue, Jul 14, 2015 at 11:38 PM, Marko Rauhamaa >>> wrote: No, tail call optimization doesn't change the behavior of the program, for the worse anyway. >>> I

data visualization - graph

2015-07-15 Thread Kasper Jepsen
Hi, I am looking for a solution to graph charts from real time measurements on the web like: http://pvoutput.org/intraday.jsp?id=16919&sid=14707&gs=1&dxa=1&dt=20150715 I have some solar systems i like to save data into an sql database - and then i like to have some web ser

Re: Improve usage of Python 3

2015-07-15 Thread Chris Angelico
On Wed, Jul 15, 2015 at 2:28 AM, Marcos wrote: > And incredibly, there are a few users on the same project who refuse to use > python 3 simply because of the print statement. Solution: Explain to them the massive benefits of the print function. It may be simpler to omit the parentheses in the cas

Re: Can't install/uninstall Python

2015-07-15 Thread udhay prakash pethakamsetty
On Tuesday, 14 July 2015 17:24:22 UTC+5:30, Chris Angelico wrote: > On Tue, Jul 14, 2015 at 7:20 AM, Thomas Via wrote: > > I'm trying to reinstall Python 2.7.9/2.7.10, but during the installation, it > > didn't let me, which gave me this: > > > > "There is a problem with this Windows Installer pa

Re: Why pay DICE When TheGongzuo.com is !! FREE !!

2015-07-15 Thread Ian Kelly
On Tue, Jul 14, 2015 at 8:47 PM, Steve Hayes wrote: > On Tue, 14 Jul 2015 17:31:31 -0700 (PDT), trentonwesle...@gmail.com > wrote: > >>Greetings! >>You been Invited as a Beta User for TheGongzuo.com ( Absolutely Extended >>Trial). >>We bring to you TheGongzuo.com, Top notch highly talented IT (In

Improve usage of Python 3

2015-07-15 Thread Marcos
Hi! Just like many, I want the projects in which I work on to move to Python 3. And incredibly, there are a few users on the same project who refuse to use python 3 simply because of the print statement. That has probably already been discussed, but since I actually couldn't find anything re