Re: Extract data

2018-05-14 Thread Steven D'Aprano
On Tue, 15 May 2018 11:53:47 +0530, mahesh d wrote: > Hii. > > I have folder.in that folder some files .txt and some files .msg files. > . > My requirement is reading those file contents . Extract data in that > files . The answer to this question is the same as the answer to your previous qu

Extract data

2018-05-14 Thread mahesh d
Hii. I have folder.in that folder some files .txt and some files .msg files. . My requirement is reading those file contents . Extract data in that files . -- https://mail.python.org/mailman/listinfo/python-list

Re: spurious BadDrawable error when running test_tk

2018-05-14 Thread dieter
Matthias Kievernagel writes: > I changed some detail in the tkinter library, > so I'm running the tk test like this: > > ./python -m test -u gui -v test_tk > > Approximately every 2 or 3 runs I get a BadDrawable error > from the X server, most of the time at the end after > the last test finished

Re: Extract

2018-05-14 Thread Cameron Simpson
On 15May2018 07:26, mahesh d wrote: I have a directory. In that folder .msg files . How can I extract those files. You can get the filenames from the directory with the os.listdir function or with the glob.glob function. If you mean "extract the contents of those files" instread of just find

Extract

2018-05-14 Thread mahesh d
Hii I have a directory. In that folder .msg files . How can I extract those files. Thanks & regards Mahesh -- https://mail.python.org/mailman/listinfo/python-list

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-14 Thread Steven D'Aprano
On Mon, 14 May 2018 18:20:13 -0500, Python wrote: > I am hardly perfect. Have you tried just wanting to be perfect more? Look, we get it: it is possible to improve the quality of your code by paying attention to what you do, by proof-reading, testing, code reviews, warnings, linters, etc. We'

Re: pylint/pyreverse with Python3

2018-05-14 Thread Rich Shepard
On Mon, 14 May 2018, summerra...@gmail.com wrote: I'm having the same issue; can you give an example command line for python2 and python3 specific installation? Summerrae, All my development is now strictly Python3. The installation depends on your OS and distribution. For a basic installat

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-14 Thread Chris Angelico
On Tue, May 15, 2018 at 9:20 AM, Python wrote: > I'm well acquainted with that pheonomenon, though I daresay that if > you proofread your own product you will often find your mistakes. You > just won't always. But, I never said review it right after you wrote > it, and in fact I don't do that (w

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-14 Thread Python
On Mon, May 14, 2018 at 12:02:47PM -0600, Ian Kelly wrote: > On Mon, May 14, 2018 at 9:38 AM, Python wrote: > > Absolutely correct. If you're not doing THOROUGH code reviews, and > > not thoroughly testing your code, your job is only half done. You > > should be your own first reviewer, and then

Re: object types, mutable or not?

2018-05-14 Thread Ben Finney
Steven D'Aprano writes: > Five years ago, the President Of the United States of America, or POTUS > for short, referred to Barrack Obama. Today, it refers to Donald Trump. > This didn't happen by mutating a single person (an object) from a > youngish black-skinned man to an oldish orange-skinn

Re: pylint/pyreverse with Python3

2018-05-14 Thread summerrae78
I'm having the same issue; can you give an example command line for python2 and python3 specific installation? Thanks! On Sunday, May 13, 2018 at 7:12:29 PM UTC-7, Terry Reedy wrote: > On 5/13/2018 1:01 PM, Rich Shepard wrote: > >   Installed here is pylint-1.7.1 and python-3.6.5. When I try t

Re: Python-list Digest, Vol 176, Issue 16

2018-05-14 Thread Paul Moore
On 14 May 2018 at 20:02, Paul wrote: > 1) I understand the added cost of verifying the sequence. However, this > appears to be a one-time cost. E.G., if I submit this, > > random.choices(lm,cum_weights=[25,26,36,46,136],k=400 > > then the code will do an O(n log n) operation 400 times. > > If ve

ANN: DIPY 0.14.0

2018-05-14 Thread Eleftherios Garyfallidis
Hello all! We are excited to announce a new *major release* of Diffusion Imaging in Python (DIPY). *DIPY 0.14 (Tuesday, 1rst May 2018)* This release received contributions from *24 developers*. A warm thank you to each one of you for your contribution. The complete release notes are available a

Re: f-string anomaly

2018-05-14 Thread Lele Gaifax
Ken Kundert writes: > Lele, > I am using Python3.6. d has to be an object of mydict. My bad, sorry, I completely missed the premise :-|. ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@m

Re: f-string anomaly

2018-05-14 Thread Ken Kundert
Lele, I am using Python3.6. d has to be an object of mydict. Here is the code that exhibits the problem: import sys, os from inform import error, os_error class mydict(dict): def __format__(self, template): print('Template:', template) return

Re: f-string anomaly

2018-05-14 Thread MRAB
On 2018-05-14 20:24, Lele Gaifax wrote: Ken Kundert writes: Lele, I'm afraid I was unclear. The ... in the code snippet was intended to imply that these lines were appended to the end of the original code, where d was defined. Ok, but then I get a different behaviour: Python 3.6.5

Re: f-string anomaly

2018-05-14 Thread Lele Gaifax
Ken Kundert writes: > Lele, > I'm afraid I was unclear. The ... in the code snippet was intended > to imply that these lines were appended to the end of the original code, > where d was defined. Ok, but then I get a different behaviour: Python 3.6.5 (default, May 11 2018, 13:30:17)

Re: random.choices() Suggest that the code confirm that cum_weights sequence is in ascending order

2018-05-14 Thread Paul
forgot to edit the subject. Sorry. paul c. On Mon, May 14, 2018 at 12:02 PM, Paul wrote: > Hello all, >Thanks for the thoughtful (and non-snarky) replies. > > First, a suggestion for a documentation change: > > To this paragraph: > > *If neither weights nor cum_weights are specified, sele

Re: Python-list Digest, Vol 176, Issue 16

2018-05-14 Thread Paul
Hello all, Thanks for the thoughtful (and non-snarky) replies. First, a suggestion for a documentation change: To this paragraph: *If neither weights nor cum_weights are specified, selections are made with equal probability. If a weights sequence is supplied, it must be the same length as the

Re: f-string anomaly

2018-05-14 Thread Ken Kundert
Lele, I'm afraid I was unclear. The ... in the code snippet was intended to imply that these lines were appended to the end of the original code, where d was defined. -Ken On 05/14/2018 12:30 AM, Lele Gaifax wrote: > Ken Kundert writes: > >> I tried adding k and v to the local namespace: >>

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-14 Thread Ian Kelly
On Mon, May 14, 2018 at 9:38 AM, Python wrote: > Absolutely correct. If you're not doing THOROUGH code reviews, and > not thoroughly testing your code, your job is only half done. You > should be your own first reviewer, and then have a second someone > competent review it after you do. One sho

spurious BadDrawable error when running test_tk

2018-05-14 Thread Matthias Kievernagel
Dear list, I changed some detail in the tkinter library, so I'm running the tk test like this: ./python -m test -u gui -v test_tk Approximately every 2 or 3 runs I get a BadDrawable error from the X server, most of the time at the end after the last test finished successfully. As this also happe

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-14 Thread Ian Kelly
On Mon, May 14, 2018 at 9:20 AM, Python wrote: > On Sun, May 13, 2018 at 02:42:48PM +1000, Chris Angelico wrote: >> On Sun, May 13, 2018 at 2:31 PM, Python wrote: >> >> Yes, and I'd go further: I *am* too stupid to get this right. >> > >> > No, you are not. Do you ever say "dog" when you mean "d

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-14 Thread Steven D'Aprano
On Mon, 14 May 2018 10:20:06 -0500, Python wrote: > Preventing *certain classes* of bugs, mainly botching syntax, is mostly > just a matter of wanting to, That comment is very ignorant of the mental processes involved in both language processing and typing, two skills used in programming. You c

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-14 Thread Python
On Sun, May 13, 2018 at 09:46:48PM +1000, Chris Angelico wrote: > > I expect that these days it will be rare, since most C compilers would > > default to warning about it if you run with warnings enabled. > > That assumes that you regularly run with warnings enabled. While that > might seem like a

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-14 Thread Python
On Sun, May 13, 2018 at 11:05:48AM +, Steven D'Aprano wrote: > On Sat, 12 May 2018 21:42:13 -0500, Python wrote: > > > Responding to this further would essentially just require me to > > reiterate what I already wrote--I won't do that. I'll simply maintain > > that in my rather lenghty experi

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-14 Thread Python
On Sun, May 13, 2018 at 02:42:48PM +1000, Chris Angelico wrote: > On Sun, May 13, 2018 at 2:31 PM, Python wrote: > >> Yes, and I'd go further: I *am* too stupid to get this right. > > > > No, you are not. Do you ever say "dog" when you mean "dot" instead? > > Do you ever say "dad" when you mean "

Re: random.choices() Suggest that the code confirm that cum_weights sequence is in ascending order

2018-05-14 Thread Paul Moore
On 14 May 2018 at 14:07, Steven D'Aprano wrote: > On Mon, 14 May 2018 12:59:28 +0100, Paul Moore wrote: > >> The problem is that supplying cum_weights allows the code to run in >> O(log n) by using bisection. This is significantly faster on large >> populations. Adding a test that the cumulative w

Re: random.choices() Suggest that the code confirm that cum_weights sequence is in ascending order

2018-05-14 Thread Steven D'Aprano
On Mon, 14 May 2018 12:59:28 +0100, Paul Moore wrote: > The problem is that supplying cum_weights allows the code to run in > O(log n) by using bisection. This is significantly faster on large > populations. Adding a test that the cumulative weights are nondecreasing > would add an O(n) step to th

Re: random.choices() Suggest that the code confirm that cum_weights sequence is in ascending order

2018-05-14 Thread Paul Moore
On 14 May 2018 at 13:53, Chris Angelico wrote: > On Mon, May 14, 2018 at 10:49 PM, Paul Moore wrote: >> On 14 May 2018 at 13:27, Chris Angelico wrote: >>> On Mon, May 14, 2018 at 9:59 PM, Paul Moore wrote: The problem is that supplying cum_weights allows the code to run in O(log n) by

Re: random.choices() Suggest that the code confirm that cum_weights sequence is in ascending order

2018-05-14 Thread Steven D'Aprano
On Mon, 14 May 2018 22:27:24 +1000, Chris Angelico wrote: > On Mon, May 14, 2018 at 9:59 PM, Paul Moore wrote: >> The problem is that supplying cum_weights allows the code to run in >> O(log n) by using bisection. This is significantly faster on large >> populations. Adding a test that the cumula

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-14 Thread Chris Angelico
On Mon, May 14, 2018 at 10:49 PM, Rhodri James wrote: > On 13/05/18 05:31, Python wrote: >> >> No, you are not. Do you ever say "dog" when you mean "dot" instead? >> Do you ever say "dad" when you mean "mom" instead? > > > One of my aunts used to muddle family names all the time. She once called

Re: random.choices() Suggest that the code confirm that cum_weights sequence is in ascending order

2018-05-14 Thread Chris Angelico
On Mon, May 14, 2018 at 10:49 PM, Paul Moore wrote: > On 14 May 2018 at 13:27, Chris Angelico wrote: >> On Mon, May 14, 2018 at 9:59 PM, Paul Moore wrote: >>> The problem is that supplying cum_weights allows the code to run in >>> O(log n) by using bisection. This is significantly faster on larg

Re: pylint/pyreverse with Python3 [RESOLVED]

2018-05-14 Thread Rich Shepard
On Sun, 13 May 2018, Terry Reedy wrote: You have to install a package in /site-packages for each version you want to run it with. Terry, It is installed in the site-packages/ directory for both 2.7 and 3.6. Then you have to make sure you run the version you intend to run. Since both /

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-14 Thread Rhodri James
On 13/05/18 05:31, Python wrote: No, you are not. Do you ever say "dog" when you mean "dot" instead? Do you ever say "dad" when you mean "mom" instead? One of my aunts used to muddle family names all the time. She once called me by my sister's name; one would have thought the beard was a cl

Re: random.choices() Suggest that the code confirm that cum_weights sequence is in ascending order

2018-05-14 Thread Paul Moore
On 14 May 2018 at 13:27, Chris Angelico wrote: > On Mon, May 14, 2018 at 9:59 PM, Paul Moore wrote: >> The problem is that supplying cum_weights allows the code to run in >> O(log n) by using bisection. This is significantly faster on large >> populations. Adding a test that the cumulative weight

Re: Pandas cat.categories.isin list, is this a bug?

2018-05-14 Thread Matt Ruffalo
On 2018-05-14 07:05, zljubi...@gmail.com wrote: > Hi, > > I have dataframe with CRM_assetID column as category dtype: > > df.info() > > > RangeIndex: 1435952 entries, 0 to 1435951 > Data columns (total 75 columns): > startTime1435952 non-null object > CRM_assetID

Re: random.choices() Suggest that the code confirm that cum_weights sequence is in ascending order

2018-05-14 Thread Chris Angelico
On Mon, May 14, 2018 at 9:59 PM, Paul Moore wrote: > The problem is that supplying cum_weights allows the code to run in > O(log n) by using bisection. This is significantly faster on large > populations. Adding a test that the cumulative weights are > nondecreasing would add an O(n) step to the c

Re: Pandas cat.categories.isin list, is this a bug?

2018-05-14 Thread zljubisic
On Monday, 14 May 2018 13:05:24 UTC+2, zlju...@gmail.com wrote: > Hi, > > I have dataframe with CRM_assetID column as category dtype: > > df.info() > > > RangeIndex: 1435952 entries, 0 to 1435951 > Data columns (total 75 columns): > startTime1435952 non-null object

Pandas cat.categories.isin list, is this a bug?

2018-05-14 Thread zljubisic
Hi, I have dataframe with CRM_assetID column as category dtype: df.info() RangeIndex: 1435952 entries, 0 to 1435951 Data columns (total 75 columns): startTime1435952 non-null object CRM_assetID 1435952 non-null category searching a dataframe

Re: object types, mutable or not?

2018-05-14 Thread Steven D'Aprano
On Sun, 13 May 2018 13:02:01 -0700, Mike McClain wrote: [...] > It appears to me as if an object's type is totally mutable and solely > dependant on assignment. > obj = 'a1b2' type (obj) > obj = list(obj) type (obj) > > At what level does my understanding break down?

Re: random.choices() Suggest that the code confirm that cum_weights sequence is in ascending order

2018-05-14 Thread Paul Moore
The problem is that supplying cum_weights allows the code to run in O(log n) by using bisection. This is significantly faster on large populations. Adding a test that the cumulative weights are nondecreasing would add an O(n) step to the code. So while I understand the OP's problem, I don't think

Re: random.choices() Suggest that the code confirm that cum_weights sequence is in ascending order

2018-05-14 Thread Steven D'Aprano
Hi Paul, and welcome! On Sun, 13 May 2018 17:48:47 -0700, Paul wrote: > Hi, > I just learned how to use random.choices(). [...] > Consequently, I specified 'cum_weights' with a sequence which wasn't in > ascending order. I got back k results but I determined that they > weren't correct (eg,

Re: f-string anomaly

2018-05-14 Thread Thomas Jollans
On 2018-05-14 04:08, Terry Reedy wrote: > On 5/13/2018 3:22 PM, Ken Kundert wrote: > > Please do not double post. > >> I am seeing an unexpected difference between the behavior of the string >> format method and f-strings. > > Read > https://docs.python.org/3/reference/lexical_analysis.html#form

Re: f-string anomaly

2018-05-14 Thread Lele Gaifax
Ken Kundert writes: > I tried adding k and v to the local namespace: > > ... > k = 6 > v = 9 > print(f'Email: {d:{{k}} {{v}}}') > > I still got: > > NameError: name 'k' is not defined This is not what I get: Python 3.6.5 (default, May 11 2018, 13:30:17) [GCC 7.3.0]