Re: Python-remove duplicate output

2018-11-21 Thread dieter
drvucano...@gmail.com writes: > How to remove duplicate lines and store output into one ine I do not understand "into one ine". > ... > Current Output: > aws-opsworks > aws-opsworks Ansible > > Desired output: > aws-opsworks Ansible Looks for me as if you do not want to remove duplicate lines:

Re: Question about implementing immutability

2018-11-21 Thread dieter
Iwo Herka writes: > Let's say I want to implement immutability for user-defined class. > More precisely, a class that can be modified only in its (or its > super-class') __init__ method. My initial idea was to do it the > following fashion: > > def __setattr__(self, *args, **kwargs): >

Re: Basic pynomo instructions not working

2018-11-21 Thread dieter
Adam Funk writes: > I'm trying to use the basic stuff in pynomo > > > > which I've installed with pip3, but I run into this problem trying to > the basic stuff in the documentation: > > #v+ > $ python3 > Python 3.6.7 (default, Oct 22 2018, 11:32:17) > [GCC 8.2.

Re: Odd truth result with in and ==

2018-11-21 Thread Dan Sommers
On 11/21/18 7:09 PM, Chris Angelico wrote: > On Thu, Nov 22, 2018 at 11:04 AM Dan Sommers > <2qdxy4rzwzuui...@potatochowder.com> wrote: >> But the second one has to do an expensive subset operation. If I think >> "is elem in both sets," then I'd never write: >> >> (elem in set1) and (set1 <

Re: Odd truth result with in and ==

2018-11-21 Thread Chris Angelico
On Thu, Nov 22, 2018 at 11:04 AM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: > But the second one has to do an expensive subset operation. If I think > "is elem in both sets," then I'd never write: > > (elem in set1) and (set1 <= set2) Yes, but that doesn't mean "is elem in both

Re: Odd truth result with in and ==

2018-11-21 Thread Dan Sommers
On 11/21/18 6:45 PM, Ian Kelly wrote: > On Wed, Nov 21, 2018 at 2:53 PM Serhiy Storchaka wrote: >> >> 21.11.18 22:17, Cameron Simpson пише: >>> Can someone show me a real world, or failing that - sane looking, >>> chained comparison using "in"? >> >> s[0] == s[-1] in '\'"' >> >> Tests tha

Re: Odd truth result with in and ==

2018-11-21 Thread DL Neil
Serhiy, On 22/11/18 10:50, Serhiy Storchaka wrote: 21.11.18 22:17, Cameron Simpson пише: Can someone show me a real world, or failing that - sane looking, chained comparison using "in"?     s[0] == s[-1] in '\'"' Tests that string s starts and ends with a single or double quote. Am admir

Re: Odd truth result with in and ==

2018-11-21 Thread Ian Kelly
On Wed, Nov 21, 2018 at 2:53 PM Serhiy Storchaka wrote: > > 21.11.18 22:17, Cameron Simpson пише: > > Can someone show me a real world, or failing that - sane looking, > > chained comparison using "in"? > > s[0] == s[-1] in '\'"' > > Tests that string s starts and ends with a single or double

Re: Asyncio tasks getting cancelled

2018-11-21 Thread ike
Sorry for the latency. On Tue, Nov 06, 2018 at 03:39:24PM -0700, Ian Kelly wrote: > > What I meant was, the error message is specific to futures in the > > 'PENDING' state. Which should be set to 'RUNNING' before any actions > > occur. So it appears the tasks weren't started at all. > > Ah. I don

Re: Need help for python on my pc.

2018-11-21 Thread boB Stepp
On Wed, Nov 21, 2018 at 12:19 PM Sourav Banik wrote: > > Hello Python team, > I'm using python 3.7(32 bit) for several months on my same laptop (x64 > processor). I worked on some django project very swiftly without any > problem. But for a few days I am facing a serious problem. My python files >

Python-remove duplicate output

2018-11-21 Thread drvucanovic
How to remove duplicate lines and store output into one ine reservations = ec.describe_instances().get('Reservations', []) for reservation in reservations: for instance in reservation['Instances']: tags = {} for tag in instance['Tags']: ta

Re: Odd truth result with in and ==

2018-11-21 Thread Serhiy Storchaka
21.11.18 22:17, Cameron Simpson пише: Can someone show me a real world, or failing that - sane looking, chained comparison using "in"? s[0] == s[-1] in '\'"' Tests that string s starts and ends with a single or double quote. It can be also used with sets: elem in set1 <= set2 -- htt

Re: Odd truth result with in and ==

2018-11-21 Thread Chris Angelico
On Thu, Nov 22, 2018 at 8:22 AM Python wrote: > > On Thu, Nov 22, 2018 at 07:54:06AM +1100, Chris Angelico wrote: > > > if item in list == item_should_be_in_list(): > > > # "good" state, i.e. is true if item is in list and should be, or > > > isn't and shouldn't. > > > ... > > > > If I

Re: question on the 'calendar' function

2018-11-21 Thread Calvin Spealman
Sorry, but, that is largely what programming is. On Wed, Nov 21, 2018 at 4:09 PM o1bigtenor wrote: > On Wed, Nov 21, 2018 at 2:47 PM Calvin Spealman > wrote: > > > > Python and the standard library are all tools, but you still need to use > those tools to accomplish something. > > > > This is a

Re: Odd truth result with in and ==

2018-11-21 Thread Python
On Thu, Nov 22, 2018 at 07:54:06AM +1100, Chris Angelico wrote: > > if item in list == item_should_be_in_list(): > > # "good" state, i.e. is true if item is in list and should be, or isn't > > and shouldn't. > > ... > > If I saw this in _any_ language, I would want it to be parenthesize

Re: question on the 'calendar' function

2018-11-21 Thread o1bigtenor
On Wed, Nov 21, 2018 at 2:47 PM Calvin Spealman wrote: > > Python and the standard library are all tools, but you still need to use > those tools to accomplish something. > This is am understanding. What I'm doing is making tools to make tools to make tools to make tools to make decisions and I'

Re: Odd truth result with in and ==

2018-11-21 Thread Python
On Thu, Nov 22, 2018 at 06:33:54AM +1100, Chris Angelico wrote: > On Thu, Nov 22, 2018 at 6:23 AM Python wrote: > > How is the first not equivalent to either one of the second or third? > > My expectation is it should produce the same result as the second. It > > *seems* like Python is ignoring t

Re: Odd truth result with in and ==

2018-11-21 Thread Chris Angelico
On Thu, Nov 22, 2018 at 7:47 AM Python wrote: > > On Thu, Nov 22, 2018 at 07:17:52AM +1100, Cameron Simpson wrote: > > On 21Nov2018 19:40, MRAB wrote: > > >On 2018-11-21 19:18, Python wrote: > > >1 in [1,2,3] == True > > >>False > > >> > > >It's a chained comparison. It applies to '<', '<=',

Re: question on the 'calendar' function

2018-11-21 Thread Calvin Spealman
Python and the standard library are all tools, but you still need to *use* those tools to accomplish something. On Wed, Nov 21, 2018 at 12:01 PM o1bigtenor wrote: > On Wed, Nov 21, 2018 at 8:09 AM Calvin Spealman > wrote: > > > > You really have the pieces you need here. You can print a whole y

Re: Need help for python on my pc.

2018-11-21 Thread Calvin Spealman
Hi, I'm afraid attachments are stripped out of e-mails sent to this list. Anything you sent was not included, so you'll need to share them in some other way if you'd like to ask for help. On Wed, Nov 21, 2018 at 1:18 PM Sourav Banik wrote: > Hello Python team, > I'm using python 3.7(32 bit) for

Re: Odd truth result with in and ==

2018-11-21 Thread Python
On Thu, Nov 22, 2018 at 07:17:52AM +1100, Cameron Simpson wrote: > On 21Nov2018 19:40, MRAB wrote: > >On 2018-11-21 19:18, Python wrote: > >1 in [1,2,3] == True > >>False > >> > >It's a chained comparison. It applies to '<', '<=', '>', '>=', > >'==' and '!=', but also to 'in', although I've ne

Re: Question about implementing immutability

2018-11-21 Thread Calvin Spealman
If you want to create your own immutable class, maybe inherit from a namedtuple? On Wed, Nov 21, 2018 at 11:45 AM Iwo Herka wrote: > Hello, > > Let's say I want to implement immutability for user-defined class. > More precisely, a class that can be modified only in its (or its > super-class') __

Re: Question about implementing immutability

2018-11-21 Thread Dan Sommers
On 11/21/18 11:45 AM, Iwo Herka wrote: Hello, Let's say I want to implement immutability for user-defined class. More precisely, a class that can be modified only in its (or its super-class') __init__ method. My initial idea was to do it the following fashion: def __setattr__(self, *args,

Re: Odd truth result with in and ==

2018-11-21 Thread Cameron Simpson
On 21Nov2018 19:40, MRAB wrote: On 2018-11-21 19:18, Python wrote: 1 in [1,2,3] == True False It's a chained comparison. It applies to '<', '<=', '>', '>=', '==' and '!=', but also to 'in', although I've never seen a chained comparison using 'in' in practice. Me either. In fact, I was as

Re: Odd truth result with in and ==

2018-11-21 Thread MRAB
On 2018-11-21 19:18, Python wrote: $ python3 Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. 1 in [1,2,3] == True False 1 in ([1,2,3] == True) Traceback (most recent call last): File "", line

Re: Odd truth result with in and ==

2018-11-21 Thread Chris Angelico
On Thu, Nov 22, 2018 at 6:33 AM Python wrote: > FWIW I meant my expectation is it should be the same as #3 (I confused > the 2nd item with the second subsequent thing that it did not match) > since "in" and "==" have the same precedence, and should be evaluated > in order left to right. IOW, it s

Re: Odd truth result with in and ==

2018-11-21 Thread Chris Angelico
On Thu, Nov 22, 2018 at 6:23 AM Python wrote: > > $ python3 > Python 3.5.2 (default, Nov 23 2017, 16:37:01) > [GCC 5.4.0 20160609] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> 1 in [1,2,3] == True > False > >>> 1 in ([1,2,3] == True) > Traceback (most rec

Re: Odd truth result with in and ==

2018-11-21 Thread Python
On Wed, Nov 21, 2018 at 01:18:22PM -0600, Python wrote: > $ python3 > Python 3.5.2 (default, Nov 23 2017, 16:37:01) > [GCC 5.4.0 20160609] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> 1 in [1,2,3] == True > False > >>> 1 in ([1,2,3] == True) > Traceback (

Odd truth result with in and ==

2018-11-21 Thread Python
$ python3 Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> 1 in [1,2,3] == True False >>> 1 in ([1,2,3] == True) Traceback (most recent call last): File "", line 1, in TypeError: argument of ty

Need help for python on my pc.

2018-11-21 Thread Sourav Banik
Hello Python team, I'm using python 3.7(32 bit) for several months on my same laptop (x64 processor). I worked on some django project very swiftly without any problem. But for a few days I am facing a serious problem. My python files are not showing properly by the file manager. It is just showing

Re: question on the 'calendar' function

2018-11-21 Thread mm0fmf
On 21/11/2018 12:27, o1bigtenor wrote: [Stuff clipped] What I need is to be able to have more than one calendar year options and this function seems to be limited to work with a maximum of only one year at a time. If I not reading the documentation correctly - - - please advise. (Thanking yo

Re: question on the 'calendar' function

2018-11-21 Thread o1bigtenor
On Wed, Nov 21, 2018 at 8:09 AM Calvin Spealman wrote: > > You really have the pieces you need here. You can print a whole year's > calendar with calendar.formatyear() or a single month with > calendar.monthcalendar(). If you need multiple years, call the first more > than once with each year y

Question about implementing immutability

2018-11-21 Thread Iwo Herka
Hello, Let's say I want to implement immutability for user-defined class. More precisely, a class that can be modified only in its (or its super-class') __init__ method. My initial idea was to do it the following fashion: def __setattr__(self, *args, **kwargs): if sys._getframe(1).f_c

Re: question on the 'calendar' function

2018-11-21 Thread Calvin Spealman
You really have the pieces you need here. You can print a whole year's calendar with calendar.formatyear() or a single month with calendar.monthcalendar(). If you need multiple years, call the first more than once with each year you need to print. If you need partial years, print the individual mon

Re: question on the 'calendar' function

2018-11-21 Thread o1bigtenor
On Wed, Nov 21, 2018 at 2:37 AM wrote: > > On Tuesday, November 20, 2018 at 7:53:06 PM UTC+1, o1bigtenor wrote: > > On Tue, Nov 20, 2018 at 11:50 AM Schachner, Joseph > > wrote: > > > > > > It's possible I don't understand the question. The calendar functions > > > are NOT limited to this year

Re: question on the 'calendar' function

2018-11-21 Thread marco . nawijn
On Tuesday, November 20, 2018 at 7:53:06 PM UTC+1, o1bigtenor wrote: > On Tue, Nov 20, 2018 at 11:50 AM Schachner, Joseph > wrote: > > > > It's possible I don't understand the question. The calendar functions are > > NOT limited to this year or any limited range. > > > > Example: > > import cale