Re: Storing dictionary locations as a string and using eval - alternatives?

2015-08-20 Thread Peter Otten
dieter wrote: > Victor Hooi writes: >> ... > I did not read your message body - just your "subject". That was a mistake ;) > Instead of (the potentially insecure) "eval", I use "json.loads" > (combined with a "json.dumps" to get the "json" representation). > See the "json" module documentation.

Re: Check if dictionary empty with == {}

2015-08-20 Thread Skip Montanaro
On Wed, Aug 19, 2015 at 10:16 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > So maybe it's a micro-optimization? Note, however, that the original post compared "mydict == {}" with "not mydict". In that case, it's decidedly not an optimization: firefly% python2.7 -m timeit

Re: RPI.GPIO Help

2015-08-20 Thread John McKenzie
Thanks for the reply. Also, thanks to Laura who replied via email. Tried a bunch of things based off these comments and I always ended up with one of two situations, the channel conflict error, or an instant run and quit issue. This new version of the code runs but is unresponsive. I removed

Re: RPI.GPIO Help

2015-08-20 Thread MRAB
On 2015-08-20 16:12, John McKenzie wrote: Thanks for the reply. Also, thanks to Laura who replied via email. Tried a bunch of things based off these comments and I always ended up with one of two situations, the channel conflict error, or an instant run and quit issue. This new version of t

Re: Check if dictionary empty with == {}

2015-08-20 Thread Laurent Pointal
Anton wrote: > Probably a silly question. > Let's say I have a dictionary mydict and I need to test if a dictionary is > empty. > > I would use > > if not mydict: > """do something""" > > But I just came across a line of code like: > > if mydict == {}: > """do something""" > > which s

Re: RPI.GPIO Help

2015-08-20 Thread alister
On Thu, 20 Aug 2015 16:45:53 +0100, MRAB wrote: > On 2015-08-20 16:12, John McKenzie wrote: >> >> Thanks for the reply. Also, thanks to Laura who replied via email. >> >> Tried a bunch of things based off these comments and I always ended >> up >> with one of two situations, the channel conf

Re: Check if dictionary empty with == {}

2015-08-20 Thread Steven D'Aprano
On Thu, 20 Aug 2015 11:54 pm, Skip Montanaro wrote: > On Wed, Aug 19, 2015 at 10:16 PM, Steven D'Aprano < > steve+comp.lang.pyt...@pearwood.info> wrote: > >> So maybe it's a micro-optimization? > > > Note, however, that the original post compared "mydict == {}" with "not > mydict". In that case

PyDev 4.3.0 released

2015-08-20 Thread Fabio Zadrozny
Release Highlights: --- * Fixed parser for Python 3.x to support async and await as regular names too (PyDev-593). * The new search dialog now has a 'whole word' option which automatically adds `*` to the search * Search backend updated to Lucene 5.2.1 (instant search

Re: Check if dictionary empty with == {}

2015-08-20 Thread Skip Montanaro
On Thu, Aug 20, 2015 at 12:44 PM, Steven D'Aprano wrote: > Testing for "any Falsey value" and "an empty dict" are not the same, > naturally they will perform differently. Sure, but the OP's original note explicitly said he had a dict and asked how to test if it was emp

SQLite3 and web server

2015-08-20 Thread Cecil Westerhof
At the moment I serve a AngularJS web application with: python3 -m http-server This only servers static html pages with the data contained in js files, like: $scope.links = [ { desc: 'Album',url: 'https://plus.google.com/collection/MuwPX' },

Re: [python-sqlite] Re: pysqlite 2.8.0 released

2015-08-20 Thread Gerhard Häring
Yes, I forgot to "setup.py sdist upload". It's fixed now. Sorry for the trouble. I'm of course looking forward to hear if SQLAlchemy still works ok with this release. On Wed, Aug 19, 2015 at 10:10 PM, wrote: > Hi Gerhard - > > is the download missing? On Pypi I see 2.8.0 is registered but no >

Re: pysqlite 2.8.0 released

2015-08-20 Thread zzzeek
Hi Gerhard - is the download missing? On Pypi I see 2.8.0 is registered but no download file: https://pypi.python.org/pypi/pysqlite/2.8.0 pip fails: $ ./bin/pip install pysqlite==2.8.0 --upgrade --force Collecting pysqlite==2.8.0 Could not find a version that satisfies the requirement pysql

Re: SQLite3 and web server

2015-08-20 Thread Steven D'Aprano
On Fri, 21 Aug 2015 04:11 pm, Cecil Westerhof wrote: > At the moment I serve a AngularJS web application with: > python3 -m http-server > > This only servers static html pages with the data contained in js > files, Ah, so you're one of *them*. People who serve static content out of Javascr