Re: Fwd: PYTHON BUG. deleting elements of list.

2020-09-09 Thread Nicholas Cole
On Wed, Sep 9, 2020 at 8:52 AM Chris Angelico wrote: [snip] > And if you absolutely have to mutate in place: > > items[:] = [i for i in items if i not in "bcd"] How does that work to mutate in place? -- https://mail.python.org/mailman/listinfo/python-list

List comprehension strangeness

2019-07-22 Thread Nicholas Cole
I was profiling a slow function in an application last week, and came across something that I still can’t explain. Inside a loop that was being called 4 times, inside a for loop that ran for a few dozen times there was a list compression of the form: [x.id for x in some_function()] According to t

Re: Guido van Rossum resigns as Python leader

2018-07-13 Thread Nicholas Cole
On Fri, 13 Jul 2018 at 10:31, Jim Oberholtzer wrote: > Nicholas: > > I am relatively new to Python, and my system of choice, IBM i on POWER, > now supports Python directly. The open source movement is so strong that I > think Python will be just fine. I've been a system programmer for 35 > yea

Re: Guido van Rossum resigns as Python leader

2018-07-13 Thread Nicholas Cole
On Fri, 13 Jul 2018 at 10:04, Chris Angelico wrote: > On Fri, Jul 13, 2018 at 11:54 PM, Nicholas Cole > wrote: > > Is it irrational to wonder whether projects should be looking to migrate > to > > new languages? This kind of announcement makes me worry for the futur

Re: Guido van Rossum resigns as Python leader

2018-07-13 Thread Nicholas Cole
On Fri, 13 Jul 2018 at 08:51, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Fri, 13 Jul 2018 22:29:29 +1000, Chris Angelico wrote: > > > To be quite frank, the proposal would have quietly died on python-ideas > > if it hadn't been for Guido's explicit support early on. (I kno

Re: Import statements and multiprocessing

2018-01-31 Thread Nicholas Cole
On Tue, Jan 30, 2018 at 7:26 PM, Terry Reedy wrote: > On 1/30/2018 10:54 AM, Nicholas Cole wrote: > >> I have a strange problem on python 3.6.1 > > [involving multiprocessing] Interestingly it seems to have been a very subtle circular import problem that was showing up only

Re: Import statements and multiprocessing

2018-01-30 Thread Nicholas Cole
On Tue, Jan 30, 2018 at 4:33 PM, Nicholas Cole wrote: > On Tue, Jan 30, 2018 at 4:23 PM, Steven D'Aprano > wrote: >> On Tue, 30 Jan 2018 15:54:30 +0000, Nicholas Cole wrote: > >> I would say you're probably misinterpreting the nature of the problem. >> I

Re: Import statements and multiprocessing

2018-01-30 Thread Nicholas Cole
On Tue, Jan 30, 2018 at 4:23 PM, Steven D'Aprano wrote: > On Tue, 30 Jan 2018 15:54:30 +, Nicholas Cole wrote: > I would say you're probably misinterpreting the nature of the problem. > Import * isn't a directive that can be ignored. > > Can you show us a

Import statements and multiprocessing

2018-01-30 Thread Nicholas Cole
Dear List, I have a strange problem on python 3.6.1 I am using the multiprocessing function to parallelize an expensive operation, using the multiprocessing.Pool() and Pool.map() functions. The function I am passing to map calls a function in another file within the same model. And that file ha

Re: venv issues

2015-11-03 Thread Nicholas Cole
On Tue, Nov 3, 2015 at 1:59 PM, Chris Angelico wrote: > On Tue, Nov 3, 2015 at 9:32 PM, Nicholas Cole wrote: >> Logging in as a different user and creating a venv works perfectly, so >> it's clearly a config issue somewhere, but I've tried removing >> ~/.bash

Re: venv issues

2015-11-03 Thread Nicholas Cole
On Tue, Nov 3, 2015 at 12:27 PM, Wolfgang Maier wrote: > 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 m

venv issues

2015-11-03 Thread Nicholas Cole
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 /private/tmp/testenv/bin/python: No module named pi

Re: Python is DOOMED! Again!

2015-01-24 Thread Nicholas Cole
On Sat, Jan 24, 2015 at 5:51 AM, Steven D'Aprano wrote: > and Ruby has an experimental one: > > http://blog.codeclimate.com/blog/2014/05/06/gradual-type-checking-for-ruby/ Interesting. Ruby has avoided the magic comment, and the typing is done in annotations rather than in the function signatu

Python is DOOMED! Again!

2015-01-22 Thread Nicholas Cole
On Thursday, 22 January 2015, Chris Angelico > wrote: > On Thu, Jan 22, 2015 at 7:10 PM, Mario Figueiredo > wrote: > > Possibly one common use case will be Unions. And that factory syntax is > > really awful and long when you look at a function definition with as > > little as 3 arguments. The on

Re: Python is DOOMED! Again!

2015-01-22 Thread Nicholas Cole
On Thu, Jan 22, 2015 at 8:10 AM, Mario Figueiredo wrote: > In article <54c0a571$0$13002$c3e8da3$54964...@news.astraweb.com>, > steve+comp.lang.pyt...@pearwood.info says... >> >> The point isn't that there are no other alternative interpretations >> possible, or that annotations are the only syntax

Re: Python is DOOMED! Again!

2015-01-21 Thread Nicholas Cole
On Thu, Jan 22, 2015 at 5:56 AM, Chris Angelico wrote: > On Thu, Jan 22, 2015 at 4:50 PM, Nicholas Cole > wrote: >> I would have preferred Python to mimic: >> >> Define function add taking price1, the price2, print_error equals true. >> Price1 is a float. Price2 is

Re: Python is DOOMED! Again!

2015-01-21 Thread Nicholas Cole
I don't think that Python is doomed. I *do* think that type-hinting is useful, and Python has borrowed a syntax that is similar to that used in other languages, so that it is a familiar one to many developers. It is a stretch to call it intuitive though, either to write or to read. Personally, I w

Re: Trees

2015-01-20 Thread Nicholas Cole
On Mon, Jan 19, 2015 at 11:52 PM, Devin Jeanpierre wrote: > On Mon, Jan 19, 2015 at 3:08 PM, Steven D'Aprano > wrote: >> Zachary Gilmartin wrote: >> >>> Why aren't there trees in the python standard library? >> >> Possibly because they aren't needed? Under what circumstances would you use >> a tr

Re: XML Patch

2014-10-27 Thread Nicholas Cole
On Mon, Oct 27, 2014 at 7:28 AM, Stefan Behnel wrote: > Hi, > > please keep this on-list. Sorry about that. Wrong button! [snip] >> Yes - I want to store a series of XML diffs/patches and be able to >> generate documents by applying them. > > Could you be a little more specific? There are lots

XML Patch

2014-10-26 Thread Nicholas Cole
Hi All, I'm looking for a python library that can parse XML Documents and create xml-aware "diff" files, and then use those to patch documents. In other words, I'd like something similar to the Google diff-match-patch tools, but something which is XML aware. I can see several projects on Pypi tha

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-08-01 Thread Nicholas Cole
On Fri, Aug 1, 2014 at 12:22 PM, Chris Angelico wrote: > On Fri, Aug 1, 2014 at 9:10 PM, Wolfgang Keller wrote: >> Thankfully, all actually user-friendly operating systems (MacOS, >> TOS, RiscOS, probably AmigaOS, MacOS X) spare(d) their users the >> bottomless cesspit of "package management" and

Re: How to distribute python console program

2014-06-22 Thread Nicholas Cole
On Sun, Jun 22, 2014 at 3:51 AM, Nicholas Cannon wrote: > I have a simple program that is ran in the console with 2 modules and i was > wondering how i could like export it so i could give it to someone to use as > like a utlitie in the console? I'm assuming that the 'someone' you want to give

Re: OT: This Swift thing

2014-06-03 Thread Nicholas Cole
Swift may yet be good for PyObjC (the python bridge to the various Apple libraries); it is possible that there is some kind of translation table that PyObjC can make use of to make its own method names less ugly. Of course, I wish they had picked Python rather than inventing their own language. B

Re: why indentation should be part of the syntax

2014-03-02 Thread Nicholas Cole
On Sun, Mar 2, 2014 at 2:38 PM, Roy Smith wrote: > In article , > Stefan Behnel wrote: > >> Haven't seen any mention of it on this list yet, but since it's such an >> obvious flaw in quite a number of programming languages, here's a good >> article on the recent security bug in iOS, which was du

Python (?) webserver for WSGI

2014-02-09 Thread Nicholas Cole
On Sunday, 9 February 2014, Asaf Las > wrote: > On Sunday, February 9, 2014 11:05:58 PM UTC+2, Nicholas wrote: > > Dear List, > > > > > > > > What is the latest "best-practice" for deploying a python wsgi > > application into production? > > > > For development, I've been using CherryPyWSGIServer

Python (?) webserver for WSGI

2014-02-09 Thread Nicholas Cole
Dear List, What is the latest "best-practice" for deploying a python wsgi application into production? For development, I've been using CherryPyWSGIServer which has been working very well (and the code is small enough to actually ship with my application). But I would like some way of deploying

Re: __init__ is the initialiser

2014-02-03 Thread Nicholas Cole
On Monday, 3 February 2014, Chris Angelico wrote: > On Tue, Feb 4, 2014 at 12:50 AM, Nicholas Cole > > > wrote: > >> There have been occasional times I've wanted an "explicit destruction" > >> feature. Rather than the facetious exception I listed

Re: __init__ is the initialiser

2014-02-03 Thread Nicholas Cole
On Mon, Feb 3, 2014 at 12:07 AM, Chris Angelico wrote: > On Mon, Feb 3, 2014 at 10:40 AM, Roy Smith wrote: >> I'm reasonably sure you posted this as humor, but there is some truth in >> what you said. In the crypto/security domain, you often want to keep a >> key or cleartext around only for the

Re: Self healthcheck

2014-01-22 Thread Nicholas Cole
On Wednesday, 22 January 2014, Asaf Las wrote: > On Wednesday, January 22, 2014 5:08:25 AM UTC+2, Chris Angelico wrote: > > I assume you're talking about pure Python code, running under CPython. > > (If you're writing an extension module, say in C, there are completely > > different ways to detec

Re: Python program distribution - a source of constant friction

2014-01-16 Thread Nicholas Cole
On Tue, Jan 7, 2014 at 12:09 AM, Nicholas Cole wrote: [SNIP] > Even so, things like that are harder to create than they > could be, or less prominently documented than one might have expected. > > Case in point: I have an application a friend/colleague of mine would like > to lo

Re: Python program distribution - a source of constant friction

2014-01-06 Thread Nicholas Cole
On Monday, 6 January 2014, Chris Angelico wrote: > On Tue, Jan 7, 2014 at 10:39 AM, Nicholas Cole > > > wrote: > > But what about the end-user? The end-user who just wants a blob (he > doesn't > > care about what language it is in - he just wants to solve the pro

Python program distribution - a source of constant friction

2014-01-06 Thread Nicholas Cole
This email is inspired by a YouTube video of a talk that Jessica McKellar recently gave. I was struck by her analysis that it is hard to remain a popular language (as Python currently is) and her call to action to address friction points that make it hard for a non-Python audience to use Python an

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Nicholas Cole
I hardly know which of the various threads on this topic to reply to! No one is taking Python 2.7 away from anyone. It is going to be on the net for years to come. Goodness! I expect if I wanted to go and download Python 1.5 I could find it easily enough. Like everyone else, when Python 3 came

Packaging a private project

2013-12-16 Thread Nicholas Cole
Dear List, What is the best way to distribute a private, pure python, Python 3 project that needs several modules (some available on pypi but some private and used by several separate projects) in order to run? I'd like to include everything that my project needs to run in a single package. The

Re: PEP 450 Adding a statistics module to Python

2013-08-11 Thread Nicholas Cole
On Sun, Aug 11, 2013 at 12:50 PM, Skip Montanaro wrote: > > See the Rationale of PEP 450 for more reasons why “install NumPy” is not > > a feasible solution for many use cases, and why having ‘statistics’ as a > > pure-Python, standard-library package is desirable. > > I read that before posting

Re: Suggestion: PEP for popping slices from lists

2013-08-08 Thread Nicholas Cole
On Thu, Aug 8, 2013 at 2:32 PM, Neatu Ovidiu wrote: > On Thursday, August 8, 2013 4:08:13 PM UTC+3, Nicholas wrote: > > On Thu, Aug 8, 2013 at 12:50 PM, Neatu Ovidiu wrote: > > > > > > > > > > On Thursday, August 8, 2013 2:44:05 PM UTC+3, Neatu Ovidiu wrote: > > > > > On Thursday, August 8, 2013

Re: Suggestion: PEP for popping slices from lists

2013-08-08 Thread Nicholas Cole
On Thu, Aug 8, 2013 at 12:50 PM, Neatu Ovidiu wrote: > On Thursday, August 8, 2013 2:44:05 PM UTC+3, Neatu Ovidiu wrote: > > On Thursday, August 8, 2013 2:12:53 PM UTC+3, Nicholas wrote: > > > > > On Thu, Aug 8, 2013 at 11:38 AM, Neatu Ovidiu > wrote: > > > > > > > > > > > > > > > > > > > > > >

Re: Suggestion: PEP for popping slices from lists

2013-08-08 Thread Nicholas Cole
On Thu, Aug 8, 2013 at 11:38 AM, Neatu Ovidiu wrote: > > > > But what's your use case? > > > > Does it occur often enough that you cannot afford a two-liner like > I think uses cases are plenty. > > The possible cases I can think of would be better served with list comprehensions (what you seem t

Re: PEP8 revised: max line lengths

2013-08-03 Thread Nicholas Cole
On Friday, 2 August 2013, Chris “Kwpolska” Warrick wrote: [snip] > > So, what are you feasting for? Nothing? I have long since ceased to be amazed at the number of people who would like their personal and arbitrary preferences, and the rationalisations that go with them, to be validated and en

Re: Switch statement

2013-03-10 Thread Nicholas Cole
On Sun, Mar 10, 2013 at 8:42 PM, Mitya Sirenef wrote: > On 03/10/2013 10:16 AM, Joseph L. Casale wrote: > >> I have a switch statement composed using a dict: >> > > > > > > switch = { > > 'a': func_a, > > 'b': func_b, > > 'c': func_c > > } > > switch.get(var, default)() > > > > > > As a result of

Re: PyWart: Module access syntax

2013-01-12 Thread Nicholas Cole
On Fri, Jan 11, 2013 at 6:01 AM, Rick Johnson wrote: > > Python's module/package access uses dot notation. > > mod1.mod2.mod3.modN > > Like many warts of the language, this wart is not so apparent when first > learning the language. The dot seems innocently sufficient, however, in > truth it is

Re: Tarfile and usernames

2012-12-30 Thread Nicholas Cole
On Sun, Dec 30, 2012 at 8:07 PM, Albert Hopkins wrote: > > > On Sun, Dec 30, 2012, at 01:57 PM, Nicholas Cole wrote: > > Dear List, > > I'm hoping to use the tarfile module in the standard library to move some > files between computers. > > I can't see do

Tarfile and usernames

2012-12-30 Thread Nicholas Cole
Dear List, I'm hoping to use the tarfile module in the standard library to move some files between computers. I can't see documented anywhere what this library does with userids and groupids. I can't guarantee that the computers involved will have the same users and groups, and would like the ar

Re: sys.path in python3.3

2012-08-27 Thread Nicholas Cole
On Mon, Aug 27, 2012 at 10:05 AM, Ned Deily wrote: > In article <503b3247$0$6877$e4fe5...@news2.news.xs4all.nl>, > Hans Mulder wrote: >> On 26/08/12 20:47:34, Nicholas Cole wrote: >> It has been changed to >> >> ~/Library/Python/$py_version_short/lib/python/

Re: sys.path in python3.3

2012-08-27 Thread Nicholas Cole
On Mon, Aug 27, 2012 at 12:18 AM, Ned Deily wrote: > In article > , > Nicholas Cole wrote: >> It certainly does exist. Distutils will happily put packages into it, >> but import won't find them. > > That's odd! It works for me on 10.8 and it worked for

Re: sys.path in python3.3

2012-08-26 Thread Nicholas Cole
On Sun, Aug 26, 2012 at 10:23 PM, Ned Deily wrote: > In article > , > Nicholas Cole wrote: > >> On Sun, Aug 26, 2012 at 8:21 PM, Ned Deily wrote: >> > In article >> > , >> > Nicholas Cole wrote: >> >> In all previous versions of pytho

Re: sys.path in python3.3

2012-08-26 Thread Nicholas Cole
On Sun, Aug 26, 2012 at 8:21 PM, Ned Deily wrote: > In article > , > Nicholas Cole wrote: >> In all previous versions of python, I've been able to install packages >> into the path: >> >> ~/Library/Python/$py_version_short/site-packages >> >> bu

sys.path in python3.3

2012-08-26 Thread Nicholas Cole
Dear List, In all previous versions of python, I've been able to install packages into the path: ~/Library/Python/$py_version_short/site-packages but in the rc builds of python 3.3 this is no longer part of sys.path. Before I go hacking the install, is there a reason that this path was removed?

Re: from future import pass_function

2012-07-25 Thread Nicholas Cole
On Wed, Jul 25, 2012 at 9:40 AM, Ulrich Eckhardt wrote: > What do you think? > I enjoyed the question, but actually I don't think this is a good idea. 1. If you really needed something like this, you could define it easily. def do_nothing(*args, **keywords): return None 2. If it were a bui

Re: 'string_escape' in python 3

2012-04-07 Thread Nicholas Cole
On Sat, Apr 7, 2012 at 12:10 AM, Ian Kelly wrote: import codecs codecs.getdecoder('unicode_escape')(s)[0] > 'Hello: this is a test' > > Cheers, > Ian Thanks, Ian. I had assumed that if a unicode string didn't have a .decode method, then I couldn't use a decoder on it, so it hadn't occu

'string_escape' in python 3

2012-04-06 Thread Nicholas Cole
In Python 2 given the following raw string: >>> s = r"Hello\x3a this is a test" the escaping could be removed by use of the following: >>> s.decode('string_escape') In Python 3, however, the only way I can see to achieve the same result is to convert into a byte stream and then back: >>> bytes

Re: Dialog boxes in curses

2011-08-13 Thread Nicholas Cole
On Sat, Aug 13, 2011 at 4:37 PM, Irmen de Jong wrote: > On 13-8-2011 17:21, f...@slick.airforce-one.org wrote: >> Hello. >> >> I've googled for hints but I didn't find anything, I hope it's not an >> RTFM question :^) >> >> I want to have dialog boxes (a message with Yes/No/Cancel options, >> poss

Re: Python 2.7 module path problems on OS X

2010-09-06 Thread Nicholas Cole
On Sun, Sep 5, 2010 at 8:57 PM, Ned Deily wrote: > In article > , >  Nicholas Cole wrote: > >> On Sun, Sep 5, 2010 at 10:20 AM, Ned Deily wrote: >> > I'm not sure why you think it is broken.  The Apple 2.6 and the >> > python.org 2.7 have differ

Re: Python 2.7 module path problems on OS X

2010-09-05 Thread Nicholas Cole
On Sun, Sep 5, 2010 at 10:20 AM, Ned Deily wrote: > I'm not sure why you think it is broken.  The Apple 2.6 and the > python.org 2.7 have different site-package directories in different > locations.  That is to be expected.  The Apple-supplied Python comes > with some additional packages pre-insta

Python 2.7 module path problems on OS X

2010-09-05 Thread Nicholas Cole
Dear List, I have a horrible feeling that this is in some way related to the new user installation directory in 2.7,or some problem with the framework built, but I'm having great trouble with the module search path on 2.7. I usually install modules to install_lib = ~/Library/Python/$py_version_sh

Re: weakref.proxy behaviour in python 3.0

2010-08-21 Thread Nicholas Cole
On Sat, Aug 21, 2010 at 3:31 PM, Mark Dickinson wrote: [SNIP] > So my guess is that the change was unintentional. > > It's probably worth a bug report.  Even if the behaviour isn't going > to change in either 2.x or 3.x (and it probably isn't), it might be > possible to clarify the docs. Dear M

weakref.proxy behaviour in python 3.0

2010-08-21 Thread Nicholas Cole
Dear List, I've searched for information on this without success. Has weakref.proxy changed in Python 3? I couldn't see any note in the documentation, but the following code behaves differently on Python 2.6.1 and Python 3: import weakref class Test(object): pass realobject = Test() pobject =