Re: Spread a statement over various lines

2019-09-18 Thread Wolfgang Maier
On 17.09.19 20:59, Manfred Lotz wrote: > I have a function like follows > > def regex_from_filepat(fpat): > rfpat = fpat.replace('.', '\\.') \ > .replace('%', '.') \ > .replace('*', '.*') > > return '^' + rfpat + '$' > > > As I don't want to

Re: Can pip install packages for all users (on a Linux system)?

2018-07-24 Thread Wolfgang Maier
On 24.07.2018 20:07, John Ladasky wrote: I've been using "sudo pip3 install" to add packages from the PyPI repository. I have multiple user accounts on the computer in question. My goal is to install packages that are accessible to all user accounts. I know that using the Synaptic Package M

Re: 转发: No pip for my Python 3.6.5!

2018-07-09 Thread Wolfgang Maier
On 07/09/2018 10:14 AM, 卢 嘉幸 wrote: Hi~ I am a beginner with Python. My computer is of Windows version. And I dowloaded the lastest version of python on the https://www.python.org/ . My book, Automate the Boring Stuff With Python, teaches me to install a third-party module with the command lin

Re: Question : Input after all prompts in python

2018-06-11 Thread Wolfgang Maier
On 06/11/2018 04:19 PM, moha...@gmail.com wrote: BTW i tried the code above, but i encountered a syntax error. print(u"\u001b[{}A".format(n), flush=True, end="") ^ SyntaxError :invalid syntax That's probably because you have been running

Re: please test the new PyPI (now in beta)

2018-03-27 Thread Wolfgang Maier
For me, that's a window width issue. The sidebar with the filters only shows when the window is wide enough. Unfortunately, the text mentioning it doesn't change, so this should be fixed. On 03/27/2018 12:06 PM, Steven D'Aprano wrote: On Tue, 27 Mar 2018 10:48:15 +0100, Paul Moore wrote: By

Re: Entering a very large number

2018-03-23 Thread Wolfgang Maier
On 03/23/2018 01:30 PM, Wolfgang Maier wrote: On 03/23/2018 01:16 PM, ast wrote: Hi I found this way to put a large number in a variable. C = int( "28871482380507712126714295971303939919776094592797" "22700926516024197432303799152733116

Re: Entering a very large number

2018-03-23 Thread Wolfgang Maier
On 03/23/2018 01:16 PM, ast wrote: Hi I found this way to put a large number in a variable. C = int( "28871482380507712126714295971303939919776094592797" "22700926516024197432303799152733116328983144639225" "94197780311092934965557841894944174093380561511397" "421542416933972905423711002751

Re: curious asymmetry in range limiting

2018-03-20 Thread Wolfgang Maier
On 03/20/2018 03:21 PM, Robin Becker wrote: I don't know how I never came across this before, but there's a curious asymmetry in the way ranges are limited 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 "lic

Re: Console

2018-03-07 Thread Wolfgang Maier
On 03/07/2018 03:41 PM, Jeremy Jamar St. Julien wrote: I had an problem when trying to start the python GUI. It said there was a subprocess startup error. I was told to start IDLE in a console with idlelib and see what python binary i was runnning IDLE with. Im using windows 10 and i guess cons

Re: Ways to make a free variable local to a function?

2018-03-06 Thread Wolfgang Maier
On 03/05/2018 07:44 PM, Terry Reedy wrote: On 3/5/2018 9:34 AM, Chris Angelico wrote: On Tue, Mar 6, 2018 at 12:52 AM, Terry Reedy wrote: On 3/5/2018 7:12 AM, Kirill Balunov wrote: # 1. By passing through local variable's default values def func_local_1(numb, _int = int, _float = floa

Re: Is there are good DRY fix for this painful design pattern?

2018-02-27 Thread Wolfgang Maier
On 26.02.2018 15:41, Steven D'Aprano wrote: I have a class with a large number of parameters (about ten) assigned in `__init__`. The class then has a number of methods which accept *optional* arguments with the same names as the constructor/initialiser parameters. If those arguments are None, the

Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro

2018-02-09 Thread Wolfgang Maier
On 02/09/2018 12:23 PM, John Ladasky wrote: On Friday, February 9, 2018 at 12:50:16 AM UTC-8, Tim Golden wrote: Gmane offers a newsgroup interface to the mailing list I haven't visited GMane in a few years, but I found it difficult to navigate. In particular, I found searching to be cumberso

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Wolfgang Maier
On 11/02/2017 06:09 PM, Skip Montanaro wrote: Eh, what can I say? I guess I was paying too much attention to the baseball game. Yes, "else" handles the "fall off the end" termination, not the "exit early" termination. My apologies. I do think that having a way to spell "do this when the loop exit

Re: A use-case for for...else with no break

2017-11-02 Thread Wolfgang Maier
On 11/02/2017 12:45 PM, Alberto Berti wrote: "Steve" == Steve D'Aprano writes: py> for x in "abcdefgh": Steve> ... print(x, end='') Steve> ... py> efghpy> Steve> "For ... else" to the rescue! py> for char in "abcdefgh": Steve> ... print(char, end='

Re: Code Snippets

2017-11-01 Thread Wolfgang Maier
On 01.11.2017 18:25, Stefan Ram wrote: I started to collect some code snippets: Sleep one second __import__( "time" ).sleep( 1 ) Get current directory __import__( "os" ).getcwd() Get a random number __import__( "random" ).random() And so on. You get the idea. However, re

Re: matplot plot hangs

2017-11-01 Thread Wolfgang Maier
On 01.11.2017 00:40, Andrew Z wrote: hello, learning python's plotting by using matplotlib with python35 on fedora 24 x86. Installed matplotlib into user's directory. tk, seemed to work - http://www.tkdocs.com/tutorial/install.html#installlinux - the window shows up just fine. but when trying

Re: Textwrap doesn't honour NO-BREAK SPACE

2017-09-29 Thread Wolfgang Maier
On 29.09.2017 11:05, Wolfgang Maier wrote: On 29.09.2017 07:25, Steve D'Aprano wrote: I'm pretty sure this is a bug. Yes, it is a bug, but a known one: https://bugs.python.org/issue20491 The fix got backported even to 3.5, but I guess it depends which minor version you are ru

Re: Textwrap doesn't honour NO-BREAK SPACE

2017-09-29 Thread Wolfgang Maier
On 29.09.2017 07:25, Steve D'Aprano wrote: I don't have Python 3.6 installed, can somebody check to see whether or not it shows the same (wrong) behaviour? import textwrap text = ('Lorum ipsum dolor sit amet, consectetur adipiscing' ' elit ZZZ\xa0ZZZ sed do euismod tempor incididunt'

Re: Simple board game GUI framework

2017-09-12 Thread Wolfgang Maier
On 11.09.2017 12:58, Paul Moore wrote: I'm doing some training for a colleague on Python, and I want to look at a bit of object orientation. For that, I'm thinking of a small project to write a series of classes simulating objects moving round on a chess-style board of squares. I want to concent

Re: Proposed new syntax

2017-08-10 Thread Wolfgang Maier
On 08/10/2017 04:28 PM, Steve D'Aprano wrote: Every few years, the following syntax comes up for discussion, with some people saying it isn't obvious what it would do, and others disagreeing and saying that it is obvious. So I thought I'd do an informal survey. What would you expect this syntax

Re: Write this accumuator in a functional style

2017-07-10 Thread Wolfgang Maier
On 07/11/2017 08:11 AM, Steven D'Aprano wrote: I have a colleague who is allergic to mutating data structures. Yeah, I know, he needs to just HTFU but I thought I'd humour him. Suppose I have an iterator that yields named tuples: Parrot(colour='blue', species='Norwegian', status='tired and shag

Re: Transitioning from Linux to Windows

2017-06-03 Thread Wolfgang Maier
On 03.06.2017 15:44, chitt...@uah.edu wrote: I am looking for suggestions, ideas. I have developed python (3.6.x, 2.7.x) scripts that run well as a user on an ubuntu/16.04 system - the scripts look for files, parses the files, assembles an output for the user. I first cd into a particular dir

Re: Python not able to find package but it is installed

2017-05-31 Thread Wolfgang Maier
On 05/30/2017 09:27 PM, Mahmood Naderan via Python-list wrote: Well yes. It looks in other folders But $ find /opt -name openpyxl /opt/rocks/lib/python2.6/site-packages/openpyxl So, your pip knows about a search path that python doesn't know. That can have a number of reasons still and one

Re: Python not able to find package but it is installed

2017-05-30 Thread Wolfgang Maier
On 05/30/2017 10:18 AM, Mahmood Naderan via Python-list wrote: Hello, Although I have installed a package via pip on a centos-6.6, python interpreter still says there is no such package! Please see the output below $ python exread2.py input.xlsx tmp/output Traceback (most recent call last): Fi

Re: How to update python from 3.5.2 to 3.5.3 on Linux

2017-05-03 Thread Wolfgang Maier
On 03.05.2017 17:11, Thomas Nyberg wrote: On 05/03/2017 11:04 AM, Daiyue Weng wrote: nope, I was thinking it might be good to update to 3.5.3 for security reasons? (CCing back in python-list since I accidentally dropped it.) I wouldn't worry about it. Package managers tend to usually take ca

Re: Python 3.5+ Arrow keys and others in the console

2017-04-16 Thread Wolfgang Maier
On 16.04.2017 10:56, Vincent Vande Vyvre wrote: Hi, I'm using Python 3.5 and 3.6 in venv and I see a strange behaviour in the interactive interpreter. The arrow keys can't be used to move the cursor into the current line of code or to rewrite the last lines. With the 3.5 I can use the backspac

Re: Disallowing instantiation of super class

2017-02-24 Thread Wolfgang Maier
On 24.02.2017 01:19, Irv Kalb wrote: Hi, I have built a set of three classes: - A super class, let's call it: Base - A class that inherits from Base, let's call that: ClassA - Another class that inherits from Base, let's call that: ClassB ClassA and ClassB have some code in their __init__ m

Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-15 Thread Wolfgang Maier
On 15.02.2017 13:42, poseidon wrote: On 15/02/17 12:16, Wolfgang Maier wrote: On 15.02.2017 10:33, poseidon wrote: In /usr/lib/python3.6/site-packages I wrote a file tau4.pth. It contains the line /home/poseidon/tau4/swr/py3/src In /home/poseidon/tau4/swr/py3/src there's an __init__.py

Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-15 Thread Wolfgang Maier
On 15.02.2017 10:33, poseidon wrote: In /usr/lib/python3.6/site-packages I wrote a file tau4.pth. It contains the line /home/poseidon/tau4/swr/py3/src In /home/poseidon/tau4/swr/py3/src there's an __init__.py file, so it should be possible to write import tau4 in my programs. No, that's no

Re: subprocess problem

2017-02-09 Thread Wolfgang Maier
On 09.02.2017 01:56, Andreas Paeffgen wrote: The Problem with the subprocess code is: Using the sourcecode functioning as normal. The frozen app with cx_freeze on every platform just returns an empty result Here is the code in short: def get_path_pandoc(): settings = QSettings('Pandoc', '

Re: subprocess problem

2017-02-09 Thread Wolfgang Maier
On 09.02.2017 01:56, Andreas Paeffgen wrote: The Problem with the subprocess code is: Using the sourcecode functioning as normal. The frozen app with cx_freeze on every platform just returns an empty result Here is the code in short: def get_path_pandoc(): settings = QSettings('Pandoc', '

Re: Rename file without overwriting existing files

2017-01-30 Thread Wolfgang Maier
On 01/30/2017 03:49 AM, Steve D'Aprano wrote: This code contains a Time Of Check to Time Of Use bug: if os.path.exists(destination) raise ValueError('destination already exists') os.rename(oldname, destination) In the microsecond between checking for the existence of the destin

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-06 Thread Wolfgang Maier
On 1/6/2017 15:04, Peter Otten wrote: Example: you are looking for the minimum absolute value in a series of integers. As soon as you encounter the first 0 it's unnecessary extra work to check the remaining values, but the builtin min() will continue. The solution is a minimum function that allo

Re: is modulefinder.ModuleFinder working at all?

2016-11-10 Thread Wolfgang Maier
On 10.11.2016 01:02, Steve D'Aprano wrote: On Thu, 10 Nov 2016 08:08 am, Wolfgang Maier wrote: Hi, I just used the stdlib's modulefinder.ModuleFinder (intended to find modules used by a script) for the first time in my life and it just doesn't seem to work like documented a

Re: is modulefinder.ModuleFinder working at all?

2016-11-09 Thread Wolfgang Maier
On 09.11.2016 22:48, Skip Montanaro wrote: I've not used it before, but I suspect it's meant to be used in "freeze" type environments. In that situation, you really do want everything reachable, whether the script imported it or not. Hmm, but that's exactly the problem. It *is* supposed to repo

is modulefinder.ModuleFinder working at all?

2016-11-09 Thread Wolfgang Maier
Hi, I just used the stdlib's modulefinder.ModuleFinder (intended to find modules used by a script) for the first time in my life and it just doesn't seem to work like documented at all. Not sure what is going on, but if I try the usage example from https://docs.python.org/3/library/modulefinde

Re: difference with parenthese

2016-10-17 Thread Wolfgang Maier
On 17.10.2016 16:45, chenyong20...@gmail.com wrote: Hi Wolfgang, thanks for your kind reply. I try to explain what I got from your reply: for code1, when running "foo = outer()", since outer() is callable, function outer() is running and it returns an object, which referring to function inner(

Re: difference with parenthese

2016-10-17 Thread Wolfgang Maier
On 17.10.2016 10:52, chenyong20...@gmail.com wrote: Hi, i'm confused by a piece of code with parenthese as this: code 1-- def outer(): ... def inner(): ... print 'inside inner' ... return inner ... foo = outer() foo foo() inside inner

Re: Appending to a list, which is value of a dictionary

2016-10-15 Thread Wolfgang Maier
On 15.10.2016 18:16, Steve D'Aprano wrote: # Python 3 only: use a dict comprehension py> d = {x:[] for x in (1, 2, 3)} py> d {1: [], 2: [], 3: []} dict (and set) comprehensions got backported so this works just as well in Python 2.7 Wolfgang -- https://mail.python.org/mailman/listinfo/pytho

Re: cmd prompt does not recognizes python command on Windows 7

2016-08-10 Thread Wolfgang Maier
Try py instead of python. That invokes a thing called the python launcher (see https://docs.python.org/3/using/windows.html#python-launcher-for-windows for more details). Best, Wolfgang On 10.08.2016 06:46, sh.aja...@gmail.com wrote: Hi Everyone i have installed python 3.5 , but the python

Re: from a module return a class

2016-03-19 Thread Wolfgang Maier
On 18.03.2016 16:08, John Gordon wrote: In kevind0...@gmail.com writes: As requested , full code for promptUser_PWord So promptUser_PWord is a module? Well, I'm confused. You gave us this bit of code: user_pword = promptUser_PWord() But that can't work if promptUser_PWord is a mo

Re: from a module return a class

2016-03-18 Thread Wolfgang Maier
On 3/18/2016 20:19, kevind0...@gmail.com wrote: so what I get from the various postings is promptUser_PWord must be converted to a class. True? A simple function would also do. Just make sure that the return is inside a callable block. -- https://mail.python.org/mailman/listinfo/python-li

Re: non printable (moving away from Perl)

2016-03-11 Thread Wolfgang Maier
On 11.03.2016 15:23, Fillmore wrote: On 03/11/2016 07:13 AM, Wolfgang Maier wrote: One lesson for Perl regex users is that in Python many things can be solved without regexes. How about defining: printable = {chr(n) for n in range(32, 127)} then using: if (set(my_string) - set(printable

Re: non printable (moving away from Perl)

2016-03-11 Thread Wolfgang Maier
On 11.03.2016 13:13, Wolfgang Maier wrote: One lesson for Perl regex users is that in Python many things can be solved without regexes. How about defining: printable = {chr(n) for n in range(32, 127)} then using: if (set(my_string) - set(printable)): break Err, I meant: if (set

Re: non printable (moving away from Perl)

2016-03-11 Thread Wolfgang Maier
One lesson for Perl regex users is that in Python many things can be solved without regexes. How about defining: printable = {chr(n) for n in range(32, 127)} then using: if (set(my_string) - set(printable)): break On 11.03.2016 01:07, Fillmore wrote: Here's another handy Perl regex wh

Re: Continuing indentation

2016-03-02 Thread Wolfgang Maier
On 3/2/2016 21:43, Skip Montanaro wrote: Running flake8 over some code which has if statements with multiple conditions like this: if (some_condition and some_other_condition and some_final_condition): play_bingo() the tool complains that the indentation of the c

Re: subprocess startup error

2016-02-26 Thread Wolfgang Maier
On 26.02.2016 15:57, Emile van Sebille wrote: On 2/26/2016 6:49 AM, Oscar Benjamin wrote: On 26 February 2016 at 13:30, Peter Otten <__pete...@web.de> wrote: Shweta Dinnimani wrote: i saved my file as string.py since than i'm facing this error Rename that file to something that does not clas

Re: How to read from a file to an arbitrary delimiter efficiently?

2016-02-24 Thread Wolfgang Maier
On 25.02.2016 07:50, Steven D'Aprano wrote: I have a need to read to an arbitrary delimiter, which might be any of a (small) set of characters. For the sake of the exercise, lets say it is either ! or ? (for example). You are not alone with your need. http://bugs.python.org/issue1152248 discu

Re: Finding in which class an object's method comes from

2016-02-04 Thread Wolfgang Maier
On 04.02.2016 10:00, Chris Angelico wrote: On Thu, Feb 4, 2016 at 7:54 PM, ast wrote: It is strange but I dont have the same result that you: (Python 3.4) class A: def a(self):pass class B(A): def b(self):pass class C(B): def c(self):pass obj = C() obj.a > Curious. It appears

Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO

2016-02-03 Thread Wolfgang Maier
On 03.02.2016 04:26, Rick Johnson wrote: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO A long, long time a ago, in a sleepy little Scandinavian village, somewhere outsi

Re: python-2.7.3 vs python-3.2.3

2016-01-26 Thread Wolfgang Maier
On 26.01.2016 15:34, Matt Wheeler wrote: The only slight issue you might encounter is that Python 3.2 is quite old now and actually not as well supported as Python 2.7 (many projects support Python 2.7 or 3.3+ only). Best to just try out your script and find out though. Right. For example, pi

Re: python-2.7.3 vs python-3.2.3

2016-01-26 Thread Wolfgang Maier
I have used 2.7 and 3.2 side-by-side for two years or so on Ubuntu 12.04. Never encountered any problem except for a few times that I accidentally tried to run something with python when I should have used python3. Cheers, Wolfgang On 26.01.2016 13:26, Gene Heskett wrote: Greetings; I have

Re: Installing on linux - missing devel packages

2016-01-21 Thread Wolfgang Maier
On 1/21/2016 8:27, Chris Angelico wrote: This is a Linux packaging question, more than a Python one. On Debian systems, the way to do that is "apt-get build-dep python3"; check your own package manager for an equivalent - it'll probably be called builddep or similar. Yes, you'd run: dnf buil

Re: How to simulate C style integer division?

2016-01-21 Thread Wolfgang Maier
On 1/21/2016 15:00, Jussi Piitulainen wrote: Steven D'Aprano writes: So my guess is that the fastest, and certainly the most obvious, way to get the same integer division behaviour as C99 would be: def intdiv(a, b): # C99 style integer division with truncation towards zero. n = a//b

Re: Powerful perl paradigm I don't find in python

2016-01-18 Thread Wolfgang Maier
On 1/18/2016 14:05, Charles T. Smith wrote: On Fri, 15 Jan 2016 14:20:17 +0100, Wolfgang Maier wrote: pattern = pattern_str.compile() try: matches = pattern.findall(some_str, endpos=some_str.index(tail)) except ValueError: # do something if tail is not found pass Oh! I

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread Wolfgang Maier
On 15.01.2016 12:04, Charles T. Smith wrote: On Fri, 15 Jan 2016 11:42:24 +0100, Wolfgang Maier wrote: On 15.01.2016 10:43, Peter Otten wrote: Charles T. Smith wrote: while ($str != $tail) { $str ~= s/^(head-pattern)//; use ($1); } things = [] while some_str != tail

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread Wolfgang Maier
On 15.01.2016 10:43, Peter Otten wrote: Charles T. Smith wrote: while ($str != $tail) { $str ~= s/^(head-pattern)//; use ($1); } For those whose Perl's a little rusty: what does this do? A self-contained example might also be useful... Right, an explanation would certainly get yo

Re: filter a list of strings

2015-12-03 Thread Wolfgang Maier
On 03.12.2015 10:27, c.bu...@posteo.jp wrote: > > I often saw constructions like this >x for x in y if ... > But I don't understand that combination of the Python keywords (for, > in, if) I allready know. It is to complex to imagine what there really > happen. > > I understand this >for x

Re: static variables

2015-12-01 Thread Wolfgang Maier
On 01.12.2015 09:26, Ulli Horlacher wrote: Steven D'Aprano wrote: A better and more general test is: if hasattr(a, 'x'): print('attribute of a') Fine! I have now: def a(x=None): if not hasattr(a,'x'): a.x = 0 a.x += 1 print('%d:' % a.x,x) This simply counts the calls of a() But

Re: Unbuffered stderr in Python 3

2015-11-04 Thread Wolfgang Maier
On 04.11.2015 11:43, Wolfgang Maier wrote: On 04.11.2015 11:24, Steven D'Aprano wrote: On Wed, 4 Nov 2015 07:19 pm, Wolfgang Maier wrote: On 04.11.2015 04:18, Steven D'Aprano wrote: This is one of the offending line from our code base: print('<4>Suspicious answer

Re: Unbuffered stderr in Python 3

2015-11-04 Thread Wolfgang Maier
On 04.11.2015 11:24, Steven D'Aprano wrote: On Wed, 4 Nov 2015 07:19 pm, Wolfgang Maier wrote: On 04.11.2015 04:18, Steven D'Aprano wrote: This is one of the offending line from our code base: print('<4>Suspicious answer "{}"!'.format(answer), f

Re: Unbuffered stderr in Python 3

2015-11-04 Thread Wolfgang Maier
On 04.11.2015 04:18, Steven D'Aprano wrote: On Wednesday 04 November 2015 09:25, Terry Reedy wrote: On 11/3/2015 10:42 AM, Chris Angelico wrote: On Wed, Nov 4, 2015 at 2:00 AM, Random832 wrote: Nobody writes: It's probably related to the fact that std{in,out,err} are Unicode streams. Th

Re: venv issues

2015-11-03 Thread Wolfgang Maier
On 03.11.2015 11:32, Nicholas Cole wrote: I'm using python3.5 (installed from binaries) on the latest OS X. I have a curious issue with virtual environments on this machine (but not on my other machine). $ python3.5 -m venv testenv $ source testenv/bin/activate (testenv)$ python -m pip /privat

Re: Unbuffered stderr in Python 3

2015-11-02 Thread Wolfgang Maier
On 02.11.2015 11:48, Wolfgang Maier wrote: Since Python3.3, the print function has a flush keyword argument that accepts a boolean and lets you do just this. Rewrite your example as: import sys, time def test(): # Simulate a slow calculation that prints status and/or error # messages to

Re: Unbuffered stderr in Python 3

2015-11-02 Thread Wolfgang Maier
On 02.11.2015 08:52, Steven D'Aprano wrote: In Python 2, stderr is unbuffered. In most other environments (the shell, C...) stderr is unbuffered. It is usually considered a bad, bad thing for stderr to be buffered. What happens if your application is killed before the buffer fills up? The error

Re: unsupported operand type(s) python v2.7

2015-10-20 Thread Wolfgang Maier
On 20.10.2015 10:44, ngangsia akumbo wrote: def n(): 34 * 2 def g(): 4 + 2 Your n and g functions do not have an explicit return so, after doing their calculations and throwing the result away, they return None. def ng(): return n() + g() ng() Trac

Re: python.org bugs

2015-09-28 Thread Wolfgang Maier
On 28.09.2015 09:30, Laura Creighton wrote: If you just send them to webmas...@python.org they will get dealt with (probably by me). Laura Does that apply to bugs on pypi, too? You still cannot select Python 3.5 as the Python Version for wheels and other files uploaded to pypi over the web

Re: PIP does not appear to handle diacritics correctly.

2015-09-09 Thread Wolfgang Maier
On 09.09.2015 21:59, Tim Golden wrote: Well on my Win8.1 machine I created a local user with the name you give and did a fresh install of the very latest Python 3.5rc. I installed from the 32-bit web installer and the only variation from the defaults was to add Python to the PATH (the last check

Re: PIP does not appear to handle diacritics correctly.

2015-09-09 Thread Wolfgang Maier
On 09.09.2015 10:23, Chris Angelico wrote: On Wed, Sep 9, 2015 at 5:59 PM, Laszlo Lebrun via Python-list wrote: Whenever I start PIP, I get: "Fatal error in launcher: Unable to create process using '"C:\Users \BürgerGegenFluglärm\AppData\Local\Programs\Python\Python35-32 \python.exe" "C:\Use

Re: Setuptools: no module named 'html.entities'

2015-03-16 Thread Wolfgang Maier
On 03/16/2015 12:53 AM, Jason Friedman wrote: Hello, This is Python 3.3.2 on Linux. I downloaded Setuptools (https://pypi.python.org/packages/source/s/setuptools/setuptools-14.3.tar.gz), exploded the tarball, and I get: python setup.py build Traceback (most recent call last): File "", line 1

when may sys.executable be empty

2015-03-11 Thread Wolfgang Maier
From the documentation of sys.executable: A string giving the absolute path of the executable binary for the Python interpreter, on systems where this makes sense. If Python is unable to retrieve the real path to its executable, sys.executable will be an empty string or None. So on which

Re: Letter class in re

2015-03-09 Thread Wolfgang Maier
On 03/09/2015 03:04 PM, Wolfgang Maier wrote: On 03/09/2015 02:33 PM, Albert-Jan Roskam wrote: On Mon, 3/9/15, Tim Chase wrote: "[^\d\W_]+" means something like "one or more (+) of 'not (a digit, a non-word, an underscore)

Re: Letter class in re

2015-03-09 Thread Wolfgang Maier
On 03/09/2015 02:33 PM, Albert-Jan Roskam wrote: On Mon, 3/9/15, Tim Chase wrote: "[^\d\W_]+" means something like "one or more (+) of 'not (a digit, a non-word, an underscore)'. interesting (using Python3.4 and U+2188 ROMAN NUMERAL ONE HUNDRED

Re: Letter class in re

2015-03-09 Thread Wolfgang Maier
On 03/09/2015 01:26 PM, Antoon Pardon wrote: Op 09-03-15 om 12:17 schreef Tim Chase: On 2015-03-09 11:37, Wolfgang Maier wrote: On 03/09/2015 11:23 AM, Antoon Pardon wrote: Does anyone know what regular expression to use for a sequence of letters? There is a class for alphanumerics but I

Re: Letter class in re

2015-03-09 Thread Wolfgang Maier
On 03/09/2015 11:23 AM, Antoon Pardon wrote: I am using PLY for a parsing task which uses re for the lexical analysis. Does anyone know what regular expression to use for a sequence of letters? There is a class for alphanumerics but I can't find one for just letters, which I find odd. I am using

Re: Speeding up permutations generation

2015-03-06 Thread Wolfgang Maier
On 03/06/2015 05:14 PM, Gene Heskett wrote: On Friday 06 March 2015 06:22:34 Dave Angel wrote: 30414093201713378043612608166064768844377641568960512L What utility output that as an L ? One called the python interactive interpreter used by many people on this list (though it

Re: Speeding up permutations generation

2015-03-06 Thread Wolfgang Maier
On 03/06/2015 09:34 AM, Mark Lawrence wrote: On 06/03/2015 06:44, Abhiram R wrote: Hi all, Is there a way to generate permutations of large arrays of sizes say,in the hundreds, faster than in the time itertools.permutations() can return? ​-Abhiram.R /~Never give up/ If there is I'd guess tha

Re: rst and pypandoc

2015-03-02 Thread Wolfgang Maier
On 03/02/2015 08:59 AM, alb wrote: Hi everyone, I'm writing a document in restructured text and I'd like to convert it to latex for printing. To accomplish this I've used semi-successfully pandoc and the wrapper pypandoc. My biggest issue is with figures and references to them. We've our macro

Re: PyPI, reStructuredText and readthedocs problems

2015-03-02 Thread Wolfgang Maier
On 03/02/2015 11:33 AM, INADA Naoki wrote: PyPI parses your README strictly. $ rst2html.py --strict README.rst README.rst:700: (INFO/1) Duplicate implicit target name: "fingerprint". Exiting due to level-1 (INFO) system message. But I don't know how to avoid this error when converting from mark

Re: Python path on windows

2015-02-20 Thread Wolfgang Maier
On 20.02.2015 19:25, Ian Kelly wrote: On Fri, Feb 20, 2015 at 8:16 AM, loial wrote: On Friday, February 20, 2015 at 2:54:26 PM UTC, Ian wrote: On Feb 20, 2015 7:46 AM, "loial" wrote: On Linux we use #!/usr/bin/env python At the start of scripts to ensure that the python execut

Re: pypandoc and restructured text

2015-02-20 Thread Wolfgang Maier
On 20.02.2015 15:59, alb wrote: My installation is the following: pandoc 1.5.1.1 python 2.6.6 debian squeeze Any idea why? Should I upgrade somehow beyond what the debian repository delivers? I have pandoc 1.12.2.1 and it recognizes the figure directive just fine (tested with html output so

Re: what would be the regular expression for null byte present in a string

2015-01-14 Thread Wolfgang Maier
On 01/13/2015 02:40 PM, Shambhu Rajak wrote: I have a string that I get as an output of a command as: '\x01\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00*10232ae8944a*\x02\x00\x00\x00\x00\x00\x00\x00\n' I want to fetch ‘*10232ae8944a*’ from the above string. I want to find a re pattern that coul

Re: what would be the regular expression for null byte present in a string

2015-01-14 Thread Wolfgang Maier
On 01/13/2015 02:40 PM, Shambhu Rajak wrote: I have a string that I get as an output of a command as: '\x01\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x0010232ae8944a\x02\x00\x00\x00\x00\x00\x00\x00\n' I want to fetch ‘*10232ae8944a*’ from the above string. I want to find a re pattern that could

Re: Why does argparse return None instead of [] if an append action isn't used?

2015-01-09 Thread Wolfgang Maier
On 01/09/2015 03:44 PM, Adam Funk wrote: I noticed in use that if an option with the 'append' action isn't used, argparse assigns None to it rather than an empty list, & confirmed this interactively: #v+ import argparse parser = argparse.ArgumentParser() parser.add_argument('--foo', action='app

Re: Style question: Importing modules from packages - 'from' vs 'as'

2014-12-04 Thread Wolfgang Maier
On 04.12.2014 22:30, Chris Angelico wrote: On Fri, Dec 5, 2014 at 7:56 AM, Wolfgang Maier wrote: On 04.12.2014 19:05, Chris Angelico wrote: With os.path it definitely is. With the actual code in question, it's a Python 2.7 project that mostly uses relative imports - inside package.mo

Re: Style question: Importing modules from packages - 'from' vs 'as'

2014-12-04 Thread Wolfgang Maier
On 04.12.2014 19:05, Chris Angelico wrote: With os.path it definitely is. With the actual code in question, it's a Python 2.7 project that mostly uses relative imports - inside package.module1 is "import module2" etc - and I was writing an external script that calls on one of the modules. What

Re: Style question: Importing modules from packages - 'from' vs 'as'

2014-12-04 Thread Wolfgang Maier
On 12/03/2014 12:02 PM, Chris Angelico wrote: When importing a module from a subpackage, it's sometimes convenient to refer to it throughout the code with a one-part name rather than two. I'm going to use 'os.path' for the examples, but my actual use-case is a custom package where the package nam

Re: A syntax question

2014-11-10 Thread Wolfgang Maier
You may want to read: https://docs.python.org/3/faq/programming.html?highlight=global#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value from the Python docs Programming FAQ section. It explains your problem pretty well. As others have hinted at, always provide concrete Python

Re: Different behaviour in list comps and generator expressions

2014-11-08 Thread Wolfgang Maier
On 08.11.2014 22:31, Wolfgang Maier wrote: On 08.11.2014 02:50, Steven D'Aprano wrote: The following list comprehension and generator expression are almost, but not quite, the same: [expr for x in iterable] list(expr for x in iterable) The difference is in the handling of StopIter

Re: Different behaviour in list comps and generator expressions

2014-11-08 Thread Wolfgang Maier
On 08.11.2014 02:50, Steven D'Aprano wrote: The following list comprehension and generator expression are almost, but not quite, the same: [expr for x in iterable] list(expr for x in iterable) The difference is in the handling of StopIteration raised inside the expr. Generator expressions con

Re: A bug?

2014-10-27 Thread Wolfgang Maier
On 10/27/2014 05:01 PM, uma...@gmail.com wrote: I use python 3.4.0 version. In the course of developing / running a python program, I have encountered a problem. I have reproduced below a simple program to bring it out. d = [[0]*3]*4 dd = [1,2,3,4,5,6,7,8,9,10,11,12] for i in range(4): ...

Re: Status of side-effecting functions in python

2014-10-25 Thread Wolfgang Maier
On 25.10.2014 19:27, Rustom Mody wrote: Moved from other (Seymore's) thread where this is perhaps not relevant On Saturday, October 25, 2014 1:15:09 PM UTC+5:30, Steven D'Aprano wrote: Rustom Mody wrote: On Saturday, October 25, 2014 11:20:03 AM UTC+5:30, Chris Angelico wrote: On Sat, Oct 25

Re: Truthiness

2014-10-23 Thread Wolfgang Maier
On 10/23/2014 04:47 PM, Alain Ketterlin wrote: Simon Kennedy writes: Just out of academic interest, is there somewhere in the Python docs where the following is explained? 3 == True False if 3: print("It's Twue") It's Twue i.e. in the if statement 3 is True but not in t

Re: Truthiness

2014-10-23 Thread Wolfgang Maier
On 10/23/2014 04:30 PM, Simon Kennedy wrote: Just out of academic interest, is there somewhere in the Python docs where the following is explained? https://docs.python.org/3/library/stdtypes.html#truth-value-testing 3 == True False as opposed to: https://docs.python.org/3/library/stdtyp

Re: stressing problem with Python < 3.3.3 / 2.7.6 and Mac OS 10.9 Mavericks

2014-10-14 Thread Wolfgang Maier
On 14.10.2014 22:30, Ned Deily wrote: In article , Wolfgang Maier wrote: I'm not a regular MacPython user, but today I had to build Mac wheels for different versions of Python. To test the wheel files I set up a fresh Mac OS 10.9 Mavericks and and installed Python 3.2, 3.3, 3.4 fro

stressing problem with Python < 3.3.3 / 2.7.6 and Mac OS 10.9 Mavericks

2014-10-14 Thread Wolfgang Maier
Hi, I'm not a regular MacPython user, but today I had to build Mac wheels for different versions of Python. To test the wheel files I set up a fresh Mac OS 10.9 Mavericks and and installed Python 3.2, 3.3, 3.4 from the python.org download page on it. Then I struggled for the rest of the after

Re: Thoughts on python classes to represent an ebook reader

2014-10-01 Thread Wolfgang Maier
On 01.10.2014 10:14, math math wrote: Hi, I hope there are people here with strong OOP experience. Which classes would an object-oriented python programmer create for the design of a e-book reader for example? I am not really interested in the code, just the OOP classes that would come to one

any way to tell at runtime whether a callable is implemented in Python or C ?

2014-09-26 Thread Wolfgang Maier
Hi, is there any reliable and inexpensive way to inspect a callable from running Python code to learn whether it is implemented in Python or C before calling into it ? Thanks, Wolfgang -- https://mail.python.org/mailman/listinfo/python-list

Re: GCD in Fractions

2014-09-23 Thread Wolfgang Maier
On 09/23/2014 02:50 PM, Steven D'Aprano wrote: Normally, gcd is only defined for non-negative integers. Wolfram Mathworld, for example, doesn't mention negative values at all (as far as I can see): http://mathworld.wolfram.com/GreatestCommonDivisor.html although buried deep in the documentatio

Re: GCD in Fractions

2014-09-23 Thread Wolfgang Maier
On 09/23/2014 10:16 AM, blindanagram wrote: What is the rationale for gcd(x, y) in Fractions returning a negative value when y is negtive? I guess it is implemented this way because its main use is in the Fraction constructor. For example gcd(3, -7) returns -1, which means that a co-prime

  1   2   >