Re: Pylint false positives

2018-08-18 Thread Chris Angelico
On Sun, Aug 19, 2018 at 9:03 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> *headscratch* >> >> So this is okay: >> >> def f(): >> for i in range(5): >> def g(): ... >> >> But this isn't: >> >> class C: >> for i in range(5): >> def m(self): ... >> >> I've missed somethin

Re: Synax error in string assignment

2018-08-18 Thread Chris Angelico
On Sun, Aug 19, 2018 at 2:47 PM, Sharan Basappa wrote: > I am not sure what the issue is with the 2nd file that assigns string to text > variable. > > Here is the code: > # -*- coding: utf-8 -*- > text = “this’s a sent tokenize test. this is sent two. is this sent three? > sent 4 is cool! Now it

Re: Pylint false positives

2018-08-18 Thread Marko Rauhamaa
Chris Angelico : > *headscratch* > > So this is okay: > > def f(): > for i in range(5): > def g(): ... > > But this isn't: > > class C: > for i in range(5): > def m(self): ... > > I've missed something here. No, you got it right. Marko -- https://mail.python.org/mailman

New books by O’Reilly

2018-08-18 Thread Larry Martell
https://imgur.com/gallery/tW1lwEl -- https://mail.python.org/mailman/listinfo/python-list

Synax error in string assignment

2018-08-18 Thread Sharan Basappa
I am not sure what the issue is with the 2nd file that assigns string to text variable. Here is the code: # -*- coding: utf-8 -*- text = “this’s a sent tokenize test. this is sent two. is this sent three? sent 4 is cool! Now it’s your turn.” from nltk.tokenize import sent_tokenize sent_tokenize_

Questions on PEP 440 - Version Identification and Dependency Specification

2018-08-18 Thread Ryan Holmes
Greetings all, I currently follow PEP 440 as it relates to my application. Right now we follow a x.y.z scheme, with y incrementing with our normal releases, z incrementing for any bug fixes for that release, and x not really incrementing unless something major happens (for example, our conversi

Re: How to multiply dictionary values with other values based on the dictionary's key?

2018-08-18 Thread Steven D'Aprano
On Sat, 18 Aug 2018 16:16:54 -0700, giannis.dafnomilis wrote: > I have the results of an optimization run in the form found in the > following pic: https://i.stack.imgur.com/pIA7i.jpg. Unless you edit your code with Photoshop, why do you think a JPEG is a good idea? That discriminates against t

Re: Pylint false positives

2018-08-18 Thread Chris Angelico
On Sun, Aug 19, 2018 at 11:13 AM, Steven D'Aprano wrote: > Obviously there is some (small) complexity cost to automating it. I > didn't specify what a fair number of methods would be (my example showed > four, but that was just an illustration, not real code). In practice I > wouldn't even conside

Re: Pylint false positives

2018-08-18 Thread Steven D'Aprano
On Sun, 19 Aug 2018 00:11:30 +0300, Marko Rauhamaa wrote: > In Python programming, I mostly run into closures through inner classes > (as in Java). Inner classes aren't closures. Its also quite expensive to be populating your application with lots of classes used only once each, which is a comm

Re: How to multiply dictionary values with other values based on the dictionary's key?

2018-08-18 Thread MRAB
On 2018-08-19 00:16, giannis.dafnomi...@gmail.com wrote: I have the results of an optimization run in the form found in the following pic: https://i.stack.imgur.com/pIA7i.jpg. How can I multiply the dictionary values of the keys FEq_(i,_j,_k,_l) with preexisting values of the form A[i,j,k,l]?

How to multiply dictionary values with other values based on the dictionary's key?

2018-08-18 Thread giannis . dafnomilis
I have the results of an optimization run in the form found in the following pic: https://i.stack.imgur.com/pIA7i.jpg. How can I multiply the dictionary values of the keys FEq_(i,_j,_k,_l) with preexisting values of the form A[i,j,k,l]? For example I want the value of key 'FEq_(0,_0,_2,_2)' mul

Re: Pylint false positives

2018-08-18 Thread Chris Angelico
On Sun, Aug 19, 2018 at 7:11 AM, Marko Rauhamaa wrote: > Chris Angelico : >> Your acceptance of closures is a perfect proof of how magic stops >> looking like magic once you get accustomed to it. > > Actually, that's a very good observation. You should stick with a > smallish kernel of primitives

Re: Pylint false positives

2018-08-18 Thread Marko Rauhamaa
Chris Angelico : > Your acceptance of closures is a perfect proof of how magic stops > looking like magic once you get accustomed to it. Actually, that's a very good observation. You should stick with a smallish kernel of primitives and derive the universe from them. Anyway, functions as first-cl

Re: Pylint false positives

2018-08-18 Thread Chris Angelico
On Sun, Aug 19, 2018 at 6:28 AM, Marko Rauhamaa wrote: > Steven D'Aprano : >>> In a word, steer clear of metaprogramming. >> >> [...] >> (2) if you mean what you say, that means no decorators, > > Correct. I don't find decorators all that useful or tasteful. > >> no closures, > > Closures I consid

Re: Pylint false positives

2018-08-18 Thread Marko Rauhamaa
Steven D'Aprano : >> In a word, steer clear of metaprogramming. > > [...] > (2) if you mean what you say, that means no decorators, Correct. I don't find decorators all that useful or tasteful. > no closures, Closures I consider ordinary programming. Nothing meta there. > no introspection ("ref

Re: Pylint false positives

2018-08-18 Thread Steven D'Aprano
On Sat, 18 Aug 2018 00:33:26 +0300, Marko Rauhamaa wrote: > Chris Angelico : >> Programming is heavily about avoiding duplicated work. > > That is one aspect, but overcondensing and overabstracting programming > logic usually makes code less obvious to its maintainer. That may very well be true

Re: defaultdict and datetime

2018-08-18 Thread MRAB
On 2018-08-18 16:43, Jason Friedman wrote: $ python3 Python 3.6.1 (default, Apr 8 2017, 09:56:20) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. import collections, datetime x = collections.defaultdict(int) x['something'] 0 x = collections

defaultdict and datetime

2018-08-18 Thread Jason Friedman
$ python3 Python 3.6.1 (default, Apr 8 2017, 09:56:20) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import collections, datetime >>> x = collections.defaultdict(int) >>> x['something'] 0 >>> x = collections.defaultdict(datetime.datetime)