Re: PEP 526 - var annotations and the spirit of python

2018-07-01 Thread MRAB
On 2018-07-01 18:06, Abdur-Rahmaan Janhangeer wrote: was viewing pep526, so, finally, python cannot do without hinting the type as other languages? will python finally move to int x = 3 where int is a pre annotation? i am not arguing it's usefulness but rather, does it fit with python? PEP 526

Re: File names with slashes [was Re: error in os.chdir]

2018-07-02 Thread MRAB
On 2018-07-02 18:16, Richard Damon wrote: On 7/2/18 9:20 AM, Mikhail V wrote: [Richard Damon] The one major issue with backslashes is that they are a special character in string literals, so you either need to use raw literals a remember the few cases they still act as special characters, or r

Re: Getting posts to sort chronologically in tree view

2018-07-02 Thread MRAB
On 2018-07-02 19:02, T Berger wrote: Is there any way to set posts to appear chronologically in tree view? And why is the tree view completely out of order? My last two posts in this view are from 6/27 and 6/28. You haven't said what software you're using to view this list. Judging by your e

Re: Dealing with dicts in doctest

2018-07-05 Thread MRAB
On 2018-07-05 18:57, Steven D'Aprano wrote: I have a function which returns a dict, and I want to use doctest to ensure the documentation is correct. So I write a bunch of doctests: def func(arg): """blah blah blah >>> func(1) {'a': 1, 'b': 2, 'c': 3} """ which is correct,

Re: about main()

2018-07-05 Thread MRAB
On 2018-07-05 21:43, Jim Lee wrote: On 07/05/18 12:58, Chris Angelico wrote: On Fri, Jul 6, 2018 at 4:27 AM, Jim Lee wrote: On 07/05/18 10:47, Calvin Spealman wrote: You say "pitfall", but I say "allow developers to focus on higher-level problems and enable developers to specialize among

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread MRAB
On 2018-07-08 14:38, Steven D'Aprano wrote: On Sun, 08 Jul 2018 14:11:58 +0300, Marko Rauhamaa wrote: [snip] More importantly, this loop may never finish: # Initially quit = False # Thread 1 global quit while not quit: time.sleep(1) # Thread 2 global quit

Re: Guido van Rossum resigns as Python leader

2018-07-12 Thread MRAB
On 2018-07-12 23:20, Roel Schroeven wrote: Yes, you read that right: Guido van Rossum resigns as Python leader. See his mail: (https://mail.python.org/pipermail/python-committers/2018-July/005664.html) [snip] That's very sad news. I believe the usual practice in a dictatorship is for the eld

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread MRAB
On 2018-07-15 19:22, James Lee wrote: On 7/15/2018 3:43 AM, Steven D'Aprano wrote: No. The real ten billion dollar question is how people in 2018 can stick their head in the sand and take seriously the position that Latin-1 (let alone ASCII) is enough for text strings. Easy - for many peo

Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread MRAB
On 2018-07-16 00:10, Jim Lee wrote: On 07/15/18 16:04, Chris Angelico wrote: You claimed that Unicode was insignificant to many programs. I'm trying to say that a Unicode text string is a vital part of any program that works with text, which is pretty much anything that talks to humans. You k

Re: Cult-like behaviour [was Re: Kindness]

2018-07-16 Thread MRAB
On 2018-07-16 17:31, Steven D'Aprano wrote: On Sun, 15 Jul 2018 16:38:41 -0700, Jim Lee wrote: As I said, there are programming situations where the programmer only needs to deal with a single language - his own. This might come as a shock to you, but just because Python's native string type

Re: Unicode [was Re: Cult-like behaviour]

2018-07-16 Thread MRAB
On 2018-07-16 21:59, Marko Rauhamaa wrote: Tim Chase : While the python world has moved its efforts into improving Python3, Python2 hasn't suddenly stopped working. The sword of Damocles is hanging on its head. Unless a consortium is erected to support Python2, no vendor will be able to use it

Re: Python 4000 was Re: [SUSPICIOUS MESSAGE] Re: Cult-like behaviour]

2018-07-16 Thread MRAB
On 2018-07-17 01:25, Steven D'Aprano wrote: On Mon, 16 Jul 2018 15:09:16 -0400, Terry Reedy wrote: On 7/16/2018 11:50 AM, Dennis Lee Bieber wrote: For Python 4000 maybe Please don't give people the idea that there is any current intention to have a 'Python 4000' similar to 'Python 3

Re: Glyphs and graphemes [was Re: Cult-like behaviour]

2018-07-17 Thread MRAB
On 2018-07-17 03:25, Tim Chase wrote: On 2018-07-17 01:08, Steven D'Aprano wrote: In English, I think most people would prefer to use a different term for whatever "sh" and "ch" represent than "character". The term you may be reaching for is "consonant cluster"? https://en.wikipedia.org/wiki/

Re: doubling the number of tests, but not taking twice as long

2018-07-18 Thread MRAB
On 2018-07-18 22:40, Larry Martell wrote: On Tue, Jul 17, 2018 at 11:43 AM, Neil Cerutti wrote: On 2018-07-16, Larry Martell wrote: I had some code that did this: meas_regex = '_M\d+_' meas_re = re.compile(meas_regex) if meas_re.search(filename): stuff1() else: stuff2() I then had

Re: copy and paste with a program called clipboard

2018-07-19 Thread MRAB
On 2018-07-19 16:47, no@none.invalid wrote: I just installed Python 3.7 The instructions say to highlight some text and press enter to copy text. You are supposed to just right click with the mouse to paste text. I use a very useful program called Clipmate that captures from the clipboard and ke

Re: try except inside a with open

2018-07-20 Thread MRAB
On 2018-07-20 18:59, Ganesh Pal wrote: Dear python Friends, I need a quick suggestion on the below code. def modify_various_line(f): """ Try modifiying various line """ try: f.write('0123456789abcdef') f.seek(5) # Go to the 6th byte in the file print f.

Re: pattern block expression matching

2018-07-21 Thread MRAB
On 2018-07-21 15:20, aldi.kr...@gmail.com wrote: Hi, I have a long text, which tells me which files from a database were downloaded and which ones failed. The pattern is as follows (at the end of this post). Wrote a tiny program, but still is raw. I want to find term "ERROR" and go 5 lines abov

Re: Edit with IDLE pull down menu

2018-07-21 Thread MRAB
On 2018-07-22 00:44, no@none.invalid wrote: On Sat, 21 Jul 2018 14:34:15 -0700 (PDT), Rick Johnson wrote: This is really the code I keep copying. import random from random import randint a = [5, 10, 15, 20, 25, 30, 35, 40] b = ["Rock","Paper","Scissors","Lizard ","Spock"] I am lazy and don't

Re: functions vs methods

2018-07-22 Thread MRAB
On 2018-07-22 10:08, Ben Finney wrote: INADA Naoki writes: Please don't refer the FAQ entry. See this: https://bugs.python.org/issue27671 Interesting. Thanks for raising that bug report. I offer my text as a starting point for a better explanation: Because ‘len’ works with *any* seque

Re: Python 2.7.14 and Python 3.6.0 netcdf4

2018-07-23 Thread MRAB
On 2018-07-23 23:39, jorge.conr...@cptec.inpe.br wrote: Hi, Please someone can help me with this error message; for Python 2.7.14 I did: from netCDF4 import Dataset and I didn't have no message That's because you've installed netCDF4 for Python 2.7.

Re: `import somemodule` does not check all paths in `sys.path`

2018-07-28 Thread MRAB
On 2018-07-28 22:16, stefand...@gmail.com wrote: Hi everyone, I am currently investigating an interesting bug in homeassistant which is a bit hard to reproduce. I already dug so deep that I ask here, because I think the root cause has to do with how Python locates and loads modules/packages. T

Re: Python bug in ArcGIS - Urban Network analysis tool

2018-07-29 Thread MRAB
On 2018-07-29 18:56, stanimira.s...@gmail.com wrote: Hi there, I'm trying make reach analyze with Urban network analysis (UNA) tool in ArcGIS. It's based on points for buildings and pedestrian network of acceptability steets. The aim is to show how many people from each building can reach dif

Re: Python bug in ArcGIS - Urban Network analysis tool

2018-07-29 Thread MRAB
On 2018-07-29 22:00, Станимира Николова wrote: неделя, 29 юли 2018 г., 23:41:01 UTC+3, MRAB написа: On 2018-07-29 18:56, stanimira.s...@gmail.com wrote: > Hi there, > > I'm trying make reach analyze with Urban network analysis (UNA) tool in ArcGIS. It's based on point

Re: Are dicts supposed to raise comparison errors

2018-07-31 Thread MRAB
On 2018-07-31 08:40, Robin Becker wrote: A bitbucket user complains that python 3.6.6 with -Wall -b prints warnings for some reportlab code; the example boils down to the following ## C:\code\hg-repos\reportlab\tmp>cat tb.py if __name__=='__main__': d={'a':1} d[b'a'] = d['a'

Re: why doesn't an mmap.mmap object have some kind of memoryview method?

2018-08-05 Thread MRAB
On 2018-08-06 00:28, Cameron Simpson wrote: I'm tinkering with a module which scans video files. The MP4 parser has a `discard_data` parameter which tells certain parts of the parser to discard some of the scanned data, particularly the MDAT box parse because I don't normally want to blow the mac

Re: Fishing from PyPI ?

2018-08-06 Thread MRAB
On 2018-08-03 22:43, Vincent Vande Vyvre wrote: I've received a mail askink me to confirm my identity on PyPI. The begining of the message: - Your account VinsS on PyPI

Re: ImportError: libpoppler.so.76

2018-08-08 Thread MRAB
On 2018-08-08 20:17, jorge.conr...@cptec.inpe.br wrote: Hi, I downloade an example from: http://basemaptutorial.readthedocs.io/en/latest/clip.html from mpl_toolkits.basemap import Basemap from matplotlib.path import Path from matplotlib.patches import PathPatch import matpl

Re: Non-unicode file names

2018-08-08 Thread MRAB
On 2018-08-08 23:16, Thomas Jollans wrote: On *nix, file names are bytes. In real life, we prefer to think of file names as strings. How non-ASCII file names are created is determined by the locale, and on most systems these days, every locale uses UTF-8 and everybody's happy. Of course this does

Re: Non-unicode file names

2018-08-08 Thread MRAB
On 2018-08-09 01:14, Thomas Jollans wrote: On 09/08/18 01:48, MRAB wrote: On 2018-08-08 23:16, Thomas Jollans wrote: On *nix, file names are bytes. In real life, we prefer to think of file names as strings. How non-ASCII file names are created is determined by the locale, and on most systems

Re: name 'aLOCK' is not defined When I add aLOCK = threading.RLock() behind if __name__ == "__main__"

2018-08-09 Thread MRAB
On 2018-08-09 16:16, xuanwu348 wrote: Hi team Good day The problem I meet when I add "aLOCK = threading.RLock()" to PositionB, the program will report error "name 'aLOCK' is not defined ", but when I change this code to PositionA, it can run normally, is there any difference for the code betwe

Re: Python-Tkinter issue. Multiple overlaping event routines called by single click

2018-08-11 Thread MRAB
On 2018-08-11 21:01, wfgazd...@gmail.com wrote: I have a main window open. Then I open a tk.TopLevel dialog window giving the user multiple choices. He selects one, the corresponding event is executed. Then in the underlining main window, just by chance there is another button exactly under

Re: Python 3.6 Logging time is not listed

2018-08-13 Thread MRAB
On 2018-08-13 17:37, Keep Secret wrote: #!/usr/bin/env python3 import logging Here you're configuring the logger, setting the name of the logfile and the logging level, but not specifying the format, so it uses the default format: logging.basicConfig(filename='example.log',level=logging.DE

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

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]?

Re: Python Information Form

2018-08-19 Thread MRAB
On 2018-08-19 15:41, Suman Mupparapu wrote: Hi Team, I am newbie to Python and glad to be part of the team. Sorry for starting with a help. Working on a creating a small information form ..and encountering issues when trying to edit the details using Python Flask and MYSQL DB. Placed the code

Re: zpifile.py error - no crc 32 attribute

2018-08-22 Thread MRAB
On 2018-08-22 23:43, jacob m wrote: " import zlib print(zlib.__file__)" When I don't have the zlib uploaded to my Python3.7 library, I have the following error: "Traceback (most recent call last): File "./testx.py", line 2, in import zlib ModuleNotFoundError: No module named 'zlib'" Wh

Re: Generating a specific list of intsgers

2018-08-24 Thread MRAB
On 2018-08-24 22:54, Ian Kelly wrote: On Fri, Aug 24, 2018 at 3:47 PM wrote: I am looking for a program able to output a set of integers meeting the following requirement: a(n) is the minimum k > 0 such that n*2^k - 3 is prime, or 0 if no such k exists Could anyone get me started? (I am an

Re: regex pattern to extract repeating groups

2018-08-27 Thread MRAB
On 2018-08-28 00:58, Malcolm wrote: On 28/08/2018 7:09 AM, John Pote wrote: On 26/08/2018 00:55, Malcolm wrote: I am trying to understand why regex is not extracting all of the characters between two delimiters. The complete string is the xmp IFD data extracted from a .CR2 image file. I do

Re: Question about floating point

2018-08-28 Thread MRAB
On 2018-08-28 15:11, Frank Millman wrote: Hi all I know about this gotcha - x = 1.1 + 2.2 x 3.3003 According to the docs, the reason is that "numbers like 1.1 and 2.2 do not have exact representations in binary floating point." So when I do this - y = 3.3 y 3.3 what exactly

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-08-30 Thread MRAB
On 2018-08-30 17:57, pjmcle...@gmail.com wrote: On Thursday, August 30, 2018 at 9:28:09 AM UTC-4, Steven D'Aprano wrote: On Thu, 30 Aug 2018 05:21:30 -0700, pjmclenon wrote: > my question is ... at the moment i can only run it on windows cmd prompt > with a multiple line entry as so:: > > pyth

Re: Object-oriented philosophy

2018-09-06 Thread MRAB
On 2018-09-06 21:24, Michael F. Stemper wrote: On 2018-09-06 09:35, Rhodri James wrote: On 06/09/18 15:04, Michael F. Stemper wrote: Net net is that the only thing that ended up being common was the __init__ methods. Two of the classes have identical __init__ methods; the third has a superset o

Re: Object-oriented philosophy

2018-09-07 Thread MRAB
On 2018-09-07 20:51, Michael F. Stemper wrote: On 2018-09-06 16:00, MRAB wrote: On 2018-09-06 21:24, Michael F. Stemper wrote: On 2018-09-06 09:35, Rhodri James wrote: Is it worth creating the superclass in Python?  It sounds like it's a bit marginal in your case.  I'm not that s

Re: Object-oriented philosophy

2018-09-07 Thread MRAB
On 2018-09-07 21:08, Michael F. Stemper wrote: On 2018-09-07 14:51, Michael F. Stemper wrote: On 2018-09-06 16:00, MRAB wrote: On 2018-09-06 21:24, Michael F. Stemper wrote: A word of advice: don't use a "bare" except, i.e. one that doesn't specify what exception(s) it

Re: Trying to use threading.local()

2018-09-12 Thread MRAB
On 2018-09-12 17:16, Steven D'Aprano wrote: I'm originally posted this on the Python-Ideas list, but this is probably more appropriate. import time from threading import Thread, local def func(): pass def attach(value): func.__params__ = local() func.__params__.value = value

Re: Help on PyList 3.7.0

2018-09-13 Thread MRAB
On 2018-09-13 21:50, Jason Qian via Python-list wrote: Hey, Need some help on PyList. #get path PyObject *path = PyObject_GetAttrString(sys, "path"); #new user path PyObject* newPath = PyUnicode_DecodeUTF8(userPath, strlen( userPath ), errors); #append newPath to path PyList_Append(path, ne

Re: Image processing libraries in python

2018-09-14 Thread MRAB
On 2018-09-14 18:04, tejaswi wrote: Hello everyone, I was looking to work with images in python. I saw two packages related to this, Pillow and scipy.ndimage. I was wondering what purposes each of these serve. I've previously used matlab/octave's image processing facilities and found them quite

Re: Copy constructor and assignment operator

2018-09-15 Thread MRAB
On 2018-09-15 19:47, Ajay Patel wrote: I have created below code and i want to restrict an object copy. What are the methods called for copy constructor and assignment operator? Basically i don't want to allow below operation. p = Point(1,3) p2 = Point(6,7) => How to disallow below operations

Re: Copy constructor and assignment operator

2018-09-16 Thread MRAB
o dictionary. If the |__deepcopy__()| implementation needs to make a deep copy of a component, it should call the |deepcopy()| <#copy.deepcopy> function with the component as first argument and the memo dictionary as second argument.""" On Sun, Sep 16, 2018 at 1:12 AM MRAB <ma

Re: dll file missing error

2018-09-16 Thread MRAB
On 2018-09-15 22:22, benjamin bulley wrote: I encounter a dll error message while trying to run python. I uninstalled the program just to reinstall to find the same problem. Please help as I am quite new to this. You haven't given any details. Which version of Windows? Which DLL? Which version

Re: Subscribe

2018-09-16 Thread MRAB
On 2018-09-16 18:09, Darya Boot wrote: If you want to subscribe to this list, then follow the instructions here: https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: Can't import array in 3.7 python version

2018-09-18 Thread MRAB
On 2018-09-18 18:48, Cruey Cruel wrote: I have subscribe to python list, please provide me any resolution forpreviois below email What error message does it print? It might be that you have a named a file the same as one of those in Python's standard library, e.g. "array.py". If that's not

Re: missing- api-ms-win-crt-runtime-|1-1-0.dll

2018-09-18 Thread MRAB
On 2018-09-18 19:43, Gene Heskett wrote: On Tuesday 18 September 2018 12:45:38 Chandan Kumar Abhimanyu wrote: how I download and install api-ms-win-crt-runtime-|1-1-0.dll when I am downloading by googling it is not installable file. -- *Chandan Kumar Abhimanyu* *+91 9876852058* *Department

Re: python3.7 problem with validation - it doesnt work

2018-09-19 Thread MRAB
On 2018-09-19 13:12, alon.naj...@gmail.com wrote: python3.7 problem with validation - it doesn't work. In what way doesn't it work? Does your computer explode? [snip] def printMessage(self): global UserSymbol global UserStockPrice global RadioButtonBellow

Re: Multiple problems with Python 3.7 under Windows 7 Home Premium

2018-09-21 Thread MRAB
On 2018-09-22 01:02, Michael Torrie wrote: On 09/21/2018 07:22 AM, Spencer Graves wrote: PYTHON - M PIP INSTALL PYAUDIO   "python -m pip install pyaudio" stopped with 'error: Microsoft visual C++14.0 is required.  Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visuals

Re: P = (2^N) - Q

2018-09-23 Thread MRAB
On 2018-09-23 19:59, Musatov wrote: If P is the set of primes, how do I write a program outputting the values of Q as an integer sequence with 1 integer of Q for each N? Let the first prime be P1 P1=2 so if N=0, Q=-1 as 2=(2^0) - (-1) Let the second prime be P2 P2=3 so if N=1, Q=-1 as 3=(2^1

Re: regex string matching python3

2018-10-01 Thread MRAB
On 2018-10-01 18:49, nanman3...@gmail.com wrote: I have a string like this: b'\tC:94.3%[S:89.9%,D:4.4%],F:1.7%,M:4.0%,n:1440\n' And I would like to extract the numbers corresponding to S,D,F and M in this string and convert them into an array like this: [ '89.9', '4.4', '1.7', '4.0'] Any he

Re: Replacing : with "${" at the beginning of the word and adding "}" at the end of the word

2018-10-02 Thread MRAB
On 2018-10-02 14:04, zljubi...@gmail.com wrote: I have to execute the same sql in two different programs. Each of them marks parameters differently. Anyway, I have found the solution. cnv_sel = re.sub(r"(:(.+?)\b)", r"${\2}", sel) A slightly better solution would be: cnv_sel = re.sub(r":(\w+

Re: Creating dice game : NEED HELP ON CHECKING ELEMENTS IN A LIST

2018-10-06 Thread MRAB
On 2018-10-06 19:10, eliteanarchyra...@gmail.com wrote: Hi, I am new to python and would like someones help on the following: After rolling 5 dice and putting the results into a list, I need to check if any dice is not a 1 or 5. if all dice in the list are either a 1 or 5 , I want to calculate

Re: Is this mailbox manipulation working by luck, or can't I understand my own code?

2018-10-13 Thread MRAB
On 2018-10-13 16:15, Chris Green wrote: I use a Python script (called directly by '| ' in .forward) which routes incoming mail to various mailboxes according to the mailing list it's from (plus a few other criteria). The first lines of the program are:- #!/usr/bin/python # #

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-10-13 Thread MRAB
On 2018-10-14 00:13, pjmcle...@gmail.com wrote: On Wednesday, June 13, 2018 at 7:14:06 AM UTC-4, INADA Naoki wrote: ​> 1st is this script is from a library module online open source If it's open source, why didn't you show the link to the soruce? I assume your code is this: https://github.com/

Re: SSHLibrary (PyNaCl and Cryptography) inst for Python 3.6.4 in Windows 10

2018-10-18 Thread MRAB
On 2018-10-18 07:28, Saila wrote: keskiviikko 17. lokakuuta 2018 20.18.55 UTC+3 Thomas Jollans kirjoitti: On 2018-10-17 16:41, Saila wrote: > Hi > Has somebody been able to install SSHLIbrary from sources (all libs with offline installations) on virtual Win 10 for Python 3.6.4? > > Python 3.6.

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-10-20 Thread MRAB
On 2018-10-20 13:47, Peter J. Holzer wrote: On 2018-10-20 05:24:37 -0700, pjmcle...@gmail.com wrote: On Saturday, October 13, 2018 at 7:24:14 PM UTC-4, MRAB wrote: > with open(join("docs", path), encoding="utf-8") as f: hello MRAB and google forum I feel somewhat exc

Re: How to compare timestamps in python

2018-10-23 Thread MRAB
On 2018-10-23 16:18, Asad wrote: Hi All , I have just playing with python , I am stuck for the following problem : file1 : Patching tool version 12.1.0.2.0 Production on Fri Feb 23 01:10:28 2018 Bootstrapping registry and package to current versions...done statement ERR-2001: table

Re: Function factory?

2018-10-24 Thread MRAB
On 2018-10-24 09:58, f...@lutix.org wrote: Hello everyone, I have 2 functions whose aim is to read a pdf file, the first one manages an uploaded file, the another one fecth a remote one (via an url). They are quite the same: def handle_uploaded_file(path,file): #if

Re: regular expression problem

2018-10-28 Thread MRAB
On 2018-10-28 18:51, Karsten Hilbert wrote: Dear list members, I cannot figure out why my regular expression does not work as I expect it to: #--- #!/usr/bin/python from __future__ import print_function import re as regex rx_works = '\$<[^<:]+?::.*?::\d*?>\$|\$<[^<:]+?

Re: regular expression problem

2018-10-28 Thread MRAB
On 2018-10-28 21:04, Karsten Hilbert wrote: On Sun, Oct 28, 2018 at 09:43:27PM +0100, Karsten Hilbert wrote: Let my try to explain the expression I am actually after (assuming .compile with re.VERBOSE): rx_works = ' \$< # start of match is literal '$<' anywhere

Re: regular expression problem

2018-10-29 Thread MRAB
On 2018-10-29 08:02, Karsten Hilbert wrote: On Sun, Oct 28, 2018 at 11:14:15PM +, MRAB wrote: > - lines can contain several placeholders > > - placeholders start and end with '$' > > - placeholders are parsed in three passes > > - the pass in which a plac

Re: FW: error code

2018-11-02 Thread MRAB
On 2018-11-02 17:53, Steve Gonzales wrote: [snip] Hello Python, I have installed c:\Python37 to my path and I still experience this issue "'python' is not recognized as an internal or external command, operable program or batch file.". I just installed the latest python version win 64bit usin

Re: pyglet, i don't understand why this code isn't working

2018-11-02 Thread MRAB
On 2018-11-02 19:58, songbird wrote: hello, :) my question is below, a bit of background first. i'm very new to python and picking it up by working on a project for fun. please don't critique my style or lack of classes/objects in the code yet - i'm way too new. :) my current p

Re: Overwhelmed by the Simplicity of Python. Any Recommendation?

2018-11-07 Thread MRAB
On 2018-11-07 09:20, Thomas Jollans wrote: On 06/11/2018 22:51, Lie Ryan wrote: I like to step through my code line by line, it's impossible to do it with object-oriented programming language. I suggest pudb, it's a curses based debugger, which is nicer than pdb, but doesn't require tedious I

Re: install open cv on windows 10 and python 3.5

2016-04-01 Thread MRAB
On 2016-04-01 20:11, saxr...@gmail.com wrote: Τη Παρασκευή, 1 Απριλίου 2016 - 1:56:52 μ.μ. UTC+3, ο χρήστης sax...@gmail.com έγραψε: hello, i have windows 10 and python 3.5 and i want to use open cv but i think so opencv work only on python 2.7 ? and i install this http://www.lfd.uci.edu/~gohl

Re: Drowning in a teacup?

2016-04-01 Thread MRAB
On 2016-04-01 21:27, Fillmore wrote: notorious pass by reference vs pass by value biting me in the backside here. Proceeding in order. I need to scan a list of strings. If one of the elements matches the beginning of a search keyword, that element needs to snap to the front of the list. I achie

Re: install open cv on windows 10 and python 3.5

2016-04-01 Thread MRAB
On 2016-04-01 22:37, Xristos Xristoou wrote: Τη Παρασκευή, 1 Απριλίου 2016 - 1:56:52 μ.μ. UTC+3, ο χρήστης Xristos Xristoou έγραψε: hello, i have windows 10 and python 3.5 and i want to use open cv but i think so opencv work only on python 2.7 ? and i install this http://www.lfd.uci.edu/~gohlk

Re: pow() & modulo QUESTION

2016-04-01 Thread MRAB
On 2016-04-02 00:08, vaulhau...@gmail.com wrote: Having trouble performing the pow() function with real numbers. I want to also take a modulo value Weirdly, this works fine ; pow(2,6000,400) = 176 However, this returns an error ; pow(1.4142, 6000, 400) I have tried also the math.pow() f

Re: i cant seem to figure out the error

2016-04-03 Thread MRAB
On 2016-04-03 16:06, anthony uwaifo wrote: hi everyone, please i need help with this assignment. I have written a code and i still get an error. please help me debug my code. instructions: - Create a constructor that takes in an integer and assigns this to a `balance` property. - C

Re: i cant seem to figure out the error

2016-04-03 Thread MRAB
On 2016-04-03 18:34, Jason Friedman wrote: - Create a method called `withdraw` that takes in cash withdrawal amount and updates the balance accordingly. if amount is greater than balance return `"invalid transaction"` def withdraw(self, amount): self.amount=amount if(amount >

Re: Plot/Graph

2016-04-03 Thread MRAB
On 2016-04-04 01:04, Muhammad Ali wrote: On Sunday, April 3, 2016 at 2:35:58 PM UTC-7, Oscar Benjamin wrote: On 3 Apr 2016 22:21, "Muhammad Ali" wrote: > > How do I convert/change/modify python script so that my data could be extracted according to python script and at the end it generates ano

Re: How to make sphinx to recognize functools.partial?

2016-04-03 Thread MRAB
On 2016-04-04 01:26, George Trojan wrote: Yet another sphinx question. I am a beginner here. I can't make sphinx to recognize the following (abbreviated) code: ''' module description :func:`~pipe` and :func:`~spipe` read data passed by LDM's `pqact`. ''' def _pipe(f, *args): '''doc str

Re: Request Help With Function

2016-04-04 Thread MRAB
On 2016-04-04 20:42, Wildman via Python-list wrote: I am working on a Linux gui program where I want to be able to click a Help button and open a man page using a viewer. I wrote a search function that can be called several times, if needed, with different arguments. I wrote a test program that

Re: How can I install

2016-04-04 Thread MRAB
On 2016-04-04 20:51, Mohamed Ali via Python-list wrote: I have tried to install python and nltk but I couldn't. Please could you please help me because I need to work on natural language processing using Python. You haven't given any details. -- https://mail.python.org/mailman/listinfo/pytho

Re: Plot/Graph

2016-04-04 Thread MRAB
On 2016-04-04 23:35, Muhammad Ali wrote: On Sunday, April 3, 2016 at 5:19:15 PM UTC-7, MRAB wrote: On 2016-04-04 01:04, Muhammad Ali wrote: > On Sunday, April 3, 2016 at 2:35:58 PM UTC-7, Oscar Benjamin wrote: >> On 3 Apr 2016 22:21, "Muhammad Ali" wrote: >> > &

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread MRAB
On 2016-04-11 01:13, Fillmore wrote: Sorry guys. It was not my intention to piss off anyone...just trying to understand how the languare works I guess that the answer to my question is: there is no such thing as a one-element tuple, and Python will automatically convert a one-element tuple to

Re: Guido sees the light: PEP 8 updated

2016-04-16 Thread MRAB
On 2016-04-17 00:11, Chris Angelico wrote: On Sun, Apr 17, 2016 at 9:02 AM, Dennis Lee Bieber wrote: I still miss the Amiga -- in which one could /push/ a window to the back of the stack while still retaining input focus! Made it nice for transcribing stuff from a visible window to a te

Re: Why are my files in in my list - os module used with sys argv

2016-04-18 Thread MRAB
On 2016-04-19 00:44, Sayth Renshaw wrote: Hi Why would it be that my files are not being found in this script? from pyquery import PyQuery as pq import pandas as pd import os import sys if len(sys.argv) == 2: print("no params") sys.exit(1) dir = sys.argv[1] mask = sys.argv[2] files

Re: Python path and append

2016-04-25 Thread MRAB
On 2016-04-25 20:08, Joaquin Alzola wrote: Strip() = white spaces. Description The method strip() returns a copy of the string in which all chars have been stripped from the beginning and the end of the string (default whitespace characters). Use to remove return carriage--> line[:-1] 1. In

Re: Howw to prevent the duplication of any value in a column within a CSV file (python)

2016-04-26 Thread MRAB
On 2016-04-26 21:07, Adam Davis wrote: On Tuesday, 26 April 2016 20:52:54 UTC+1, Ian wrote: On Tue, Apr 26, 2016 at 1:05 PM, Joaquin Alzola wrote: > Just an example. Didn't use the csv but just hope that it helps. > > name=[] > name_exist="Dop" > > with open("dop.csv") as f: > for line

Re: Pythonic style

2016-04-28 Thread MRAB
On 2016-04-28 06:16, Rustom Mody wrote: On Thursday, April 28, 2016 at 9:26:21 AM UTC+5:30, Chris Angelico wrote: My rule of thumb is: Dunders are for defining, not for calling. It's not a hard-and-fast rule, but it'll get you through 99%+ of situations. Neat and clever. Should get in the docs

Re: Dunder docs again (was Pythonic style)

2016-04-28 Thread MRAB
On 2016-04-28 12:45, Rustom Mody wrote: On Thursday, April 28, 2016 at 4:46:43 PM UTC+5:30, MRAB wrote: On 2016-04-28 06:16, Rustom Mody wrote: > On Thursday, April 28, 2016 at 9:26:21 AM UTC+5:30, Chris Angelico wrote: >> My rule of thumb is: Dunders are for defining, not for call

Re: Dunder docs again (was Pythonic style)

2016-04-28 Thread MRAB
On 2016-04-28 13:25, Marko Rauhamaa wrote: MRAB : 'pythonic-ness'? Surely it's 'pythonicity'! :-) Doubt it: Full Definition of generic [...] —generically \-i-k(ə-)lē\ adverb —genericness noun http://www.merriam-webster.com/dictionary/generic> I can

Re: about special characters

2016-04-29 Thread MRAB
On 2016-04-30 00:52, Ben Finney wrote: Jianling Fan writes: I am trying to use python 27 copying some of my folders and files to another directory. (There has never been a Python 27. I assume Python 2.7 is what you meant.) My code works good for other files but I have some problem to copy

Re: about special characters

2016-04-29 Thread MRAB
On 2016-04-30 03:35, eryk sun wrote: On Fri, Apr 29, 2016 at 8:48 PM, Ben Finney wrote: Steven D'Aprano writes: On Sat, 30 Apr 2016 09:52 am, Ben Finney wrote: > (There has never been a Python 27. I assume Python 2.7 is what you > meant.) I believe that Python X.Y shows up as "PythonXY" und

Re: about special characters

2016-04-30 Thread MRAB
On 2016-04-30 19:13, Jianling Fan wrote: Hello everyone, Thanks very much for all your replies and sorry for the inconvience. This is my first time to post question in this list. I am using python 2.7 in Windows 7 Enterprise version. Here is the the filename that cause the problem: "Decock-201

Re: Need help understanding list structure

2016-05-03 Thread MRAB
On 2016-05-03 18:54, Dan Strohl via Python-list wrote: I added a __repr__ method at the end of the gedcom library like so: def __repr__(self): """ Format this element as its original string """ result = repr(self.level()) if self.pointer() != "": result += '

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread MRAB
On 2016-05-06 20:10, DFS wrote: getAddresses.py Scrapes addresses from www.usdirectory.com and stores them in a SQLite database, or writes them to text files for mailing labels, etc Now, just by typing 'fast food Taco Bell 10 db all' you can find out how many Taco Bells are within 10 miles of

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread MRAB
On 2016-05-07 00:58, DFS wrote: On 5/6/2016 7:29 PM, Ethan Furman wrote: On 05/06/2016 04:12 PM, DFS wrote: On 5/6/2016 4:30 PM, MRAB wrote: If you don't want to use the 'with' statement, note that closing the file is: f.close() It needs the "()&quo

Re: pylint woes

2016-05-07 Thread MRAB
On 2016-05-08 03:14, Stephen Hansen wrote: On Sat, May 7, 2016, at 06:16 PM, DFS wrote: Why is it better to zip() them up and use: for item1, item2, item3 in zip(list1, list2, list3): do something with the items than for j in range(len(list1)): do something with list1[j], list2[j],

Re: json.loads(...) ValueError: Expecting value: line 1 column 1 (char 0)

2016-05-09 Thread MRAB
On 2016-05-09 20:56, zljubi...@gmail.com wrote: Hi, in python3 my variable looks like this: a = b'{"uuid":"5730e8666ffa02.34177329","error":""}' str(a) = 'b\'{"uuid":"5730e8666ffa02.34177329","error":""}\'' If I execute the following command I get the error: json.loads(str(a)) Traceback (mo

Re: What should a decorator do if an attribute already exists?

2016-05-10 Thread MRAB
On 2016-05-10 17:06, Stephen Hansen wrote: On Tue, May 10, 2016, at 08:45 AM, Steven D'Aprano wrote: I have a decorator that adds an attribute to the decorated function: [...] My question is, what should I do if the decorated function already has an instrument attribute? 1. raise an exception?

Re: pylint woes

2016-05-10 Thread MRAB
On 2016-05-10 23:36, DFS wrote: [snip] If lists are still being created: * at every moment in time, len(list1) returns a length that doesn't change even if data is added to the list after the call to len(). Example: If the list has 100 items in it at the point len(list) is called: for i in ra

Re: Average calculation Program *need help*

2016-05-12 Thread MRAB
On 2016-05-12 16:47, kob...@gmail.com wrote: Hello all, I have been struggling with this code for 3 hours now and I'm still stumped. My problem is that when I run the following code: -- #this function will get the total

<    7   8   9   10   11   12   13   14   15   16   >