Re: Why no '|' operator for dict?

2018-02-05 Thread Ian Kelly
On Mon, Feb 5, 2018 at 12:35 AM, Frank Millman wrote: > So I have 2 questions - > > 1. Is there any particular reason why '|' is not supported? '|' is the set union operation, roughly equivalent to the set.union method. Dicts don't have a union operation. If they did, and the same key were found

Re: Why no '|' operator for dict?

2018-02-05 Thread Frank Millman
"Ian Kelly" wrote in message news:calwzidkp3ls4s-zi3ax6no-68kw4_xdozvwa-cj+oz+apqr...@mail.gmail.com... On Mon, Feb 5, 2018 at 12:35 AM, Frank Millman wrote: > So I have 2 questions - > > 1. Is there any particular reason why '|' is not supported? '|' is the set union operation, roughly equiv

Re: Why no '|' operator for dict?

2018-02-05 Thread Maxime S
2018-02-05 9:14 GMT+01:00 Ian Kelly : > On Mon, Feb 5, 2018 at 12:35 AM, Frank Millman wrote: >> 2. Is there a better way to do what I want? > > The dict.items() view is explicitly set-like and can be unioned, so > you can do this: > > py> dict(d1.items() | d2.items()) > > As to the question of wh

Re: Why no '|' operator for dict?

2018-02-05 Thread Terry Reedy
On 2/5/2018 2:35 AM, Frank Millman wrote: I recently learned that you can create a set 'on-the-fly' from two existing sets using the '|' operator - Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license"

Re: Why no '|' operator for dict?

2018-02-05 Thread Serhiy Storchaka
05.02.18 10:14, Ian Kelly пише: On Mon, Feb 5, 2018 at 12:35 AM, Frank Millman wrote: So I have 2 questions - 1. Is there any particular reason why '|' is not supported? '|' is the set union operation, roughly equivalent to the set.union method. Dicts don't have a union operation. If they di

Re: Why no '|' operator for dict?

2018-02-05 Thread Steven D'Aprano
On Mon, 05 Feb 2018 01:14:53 -0700, Ian Kelly wrote: > On Mon, Feb 5, 2018 at 12:35 AM, Frank Millman > wrote: >> So I have 2 questions - >> >> 1. Is there any particular reason why '|' is not supported? > > '|' is the set union operation, roughly equivalent to the set.union > method. Dicts don'

Re: Why no '|' operator for dict?

2018-02-05 Thread Andre Müller
You can use keyword-argument unpacking in a dict-constructor. Values of duplicate keys are overwritten from left to right. The last wins. >>> dict1 = {'foo': 13, 'bar': 42} >>> dict2 = {'foo': 42, 'hello': 'world'} >>> {**dict1, **dict2} {'bar': 42, 'foo': 42, 'hello': 'world'} {**dict2, **dict1

Fwd: Problem during setup

2018-02-05 Thread Денис Олегович
-- Forwarded message -- From: Денис Олегович Date: Sun, Feb 4, 2018 at 12:54 PM Subject: Problem during setup To: python-list@python.org I tried to install python 3.5 and python 3.6, but the same mistake interrupt process "Windows 7 Service Pack 1 applicable updates are required"

From recovery.js to recoveryjsonlz4

2018-02-05 Thread Cecil Westerhof
I have a script to get the number of windows and tabs that firefox uses. It always used a file recovery.js, but it changed to recovery.jsonlz4. Looking at the extension I would think it is an lz4 compressed file. But when I use: import lz4 I see that it is deprecated. How should I work with t

Python "Bad syntax"

2018-02-05 Thread darkorbitaknaentou
  Hi, I have a problem in continuing the function.   I'm a beginner, I'm learning from a textbook. I'm going to put the following examples from a textbook that displays "wrong syntax"   for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":             if letter in "AEIOU":                 print(letter, "

Re: Fwd: Problem during setup

2018-02-05 Thread Michael Torrie
On 02/05/2018 07:53 AM, Денис Олегович wrote: > I tried to install python 3.5 and python 3.6, but the same mistake > interrupt process > "Windows 7 Service Pack 1 applicable updates are required" Log file > attached. I tried to install some updates for Windows, but unsuccessully, > may be I don' t

Re: Python "Bad syntax"

2018-02-05 Thread Ian Kelly
On Mon, Feb 5, 2018 at 10:13 AM, wrote: > > Hi, I have a problem in continuing the function. > > I'm a beginner, I'm learning from a textbook. I'm going to put the following > examples from a textbook that displays "wrong syntax" It would be very helpful if you would copy/paste the exact error m

Re: Python "Bad syntax"

2018-02-05 Thread Phil Boutros
wrote: >   > Hi, I have a problem in continuing the function. >   > I'm a beginner, I'm learning from a textbook. I'm going to put the > following examples from a textbook that displays "wrong syntax" >   for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": >             if letter in "AEIOU": >      

Re: Python "Bad syntax"

2018-02-05 Thread Christian Gollwitzer
Am 05.02.18 um 18:13 schrieb darkorbitaknaen...@centrum.cz: Hi, I have a problem in continuing the function. I'm a beginner, I'm learning from a textbook. I'm going to put the following examples from a textbook that displays "wrong syntax" for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":      

Re: Python "Bad syntax"

2018-02-05 Thread Phil Boutros
Phil Boutros wrote: > > Which version of python are you using? That syntax for "print" > started in python 3 (since print became a function). > > Try adding: > > from __future__ import print_function > > before your code if you're still using python 2.x Altough, testing it in Python2,

Re: Python "Bad syntax"

2018-02-05 Thread Chris Angelico
On Tue, Feb 6, 2018 at 4:28 AM, Phil Boutros wrote: > wrote: >> >> Hi, I have a problem in continuing the function. >> >> I'm a beginner, I'm learning from a textbook. I'm going to put the >> following examples from a textbook that displays "wrong syntax" >> > for letter in "ABCDEFGHIJKLMNOP

Re: Python "Bad syntax"

2018-02-05 Thread Bob van der Poel
On Mon, Feb 5, 2018 at 10:13 AM, wrote: > > Hi, I have a problem in continuing the function. > > I'm a beginner, I'm learning from a textbook. I'm going to put the > following examples from a textbook that displays "wrong syntax" > > >> for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": >>>

Django-CheetahTemplate 0.2

2018-02-05 Thread Oleg Broytman
Hello! Django-CheetahTemplate version 0.2. WHAT IS Django-CheetahTemplate Django-CheetahTemplate is a Django template backend to use CheetahTemplate3 in Django. It's a brand new project created for the new custom Django template backends API. It works with Python 2.7 or Python 3.4+, Django 1.11

Re: "None" and "pass"

2018-02-05 Thread Alain Ketterlin
r...@zedat.fu-berlin.de (Stefan Ram) writes: > A participant of my Python course asked whether one could > also use "None" instead of "pass". What do you think? > > def f(): > pass > > can also be written as > > def f(): > None > > . Is there any place where "None" could not be use

Re: "None" and "pass"

2018-02-05 Thread Chris Angelico
On Tue, Feb 6, 2018 at 6:47 AM, Alain Ketterlin wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: > >> A participant of my Python course asked whether one could >> also use "None" instead of "pass". What do you think? >> >> def f(): >> pass >> >> can also be written as >> >> def f():

Re: Where has the practice of sending screen shots as source code come from?

2018-02-05 Thread Peter J. Holzer
On 2018-01-28 15:04:26 +, Steven D'Aprano wrote: > I'm seeing this annoying practice more and more often. Even for trivial > pieces of text, a few lines, people post screenshots instead of copying > the code. For your amusment, here is how a well-known German tech news site publishes source-

Re: "None" and "pass"

2018-02-05 Thread Ben Finney
Chris Angelico writes: > As one special case, I would accept this sort of code: > > def f(): > ... > > (three dots representing the special value Ellipsis) > > It's a great short-hand for "stub". I would not accept that. An even better way to write a stub function is to write a docstring:

Re: "None" and "pass"

2018-02-05 Thread Chris Angelico
On Tue, Feb 6, 2018 at 8:39 AM, Ben Finney wrote: > Chris Angelico writes: > >> As one special case, I would accept this sort of code: >> >> def f(): >> ... >> >> (three dots representing the special value Ellipsis) >> >> It's a great short-hand for "stub". > > I would not accept that. > > An

Re: From recovery.js to recoveryjsonlz4

2018-02-05 Thread breamoreboy
On Monday, February 5, 2018 at 1:28:16 PM UTC, Cecil Westerhof wrote: > I have a script to get the number of windows and tabs that firefox > uses. It always used a file recovery.js, but it changed to > recovery.jsonlz4. > > Looking at the extension I would think it is an lz4 compressed file. > But

libxml2 installation/binding issue with Python 3.6.4

2018-02-05 Thread Priest, Matt
Hello, I am not sure if this is the correct place to post an issue/question like this, but here goes... I've successfully (?) installed Python 3.6.4 and libxml2, with the ultimate goal of installing GTK+ 3.22.0. However, I'm running into this error: python3 Python 3.6.4 (default, Feb 5 2018,

Re: libxml2 installation/binding issue with Python 3.6.4

2018-02-05 Thread Terry Reedy
On 2/5/2018 6:11 PM, Priest, Matt wrote: Hello, I am not sure if this is the correct place to post an issue/question like this, but here goes... I've successfully (?) installed Python 3.6.4 and libxml2, with the ultimate goal of installing GTK+ 3.22.0. However, I'm running into this error:

Re: libxml2 installation/binding issue with Python 3.6.4

2018-02-05 Thread dieter
"Priest, Matt" writes: > ... > I've successfully (?) installed Python 3.6.4 and libxml2, with the ultimate > goal of installing GTK+ 3.22.0. You might also try "lxml" - which is an alternative for "libxml2". > However, I'm running into this error: > ... > import libxml2mod > ImportError: >