Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Chris Angelico
On Sun, Dec 31, 2017 at 7:36 AM, Ben Bacarisse wrote: > bartc writes: > >> On 30/12/2017 16:53, mm0fmf wrote: >>> On 30/12/2017 14:41, bartc wrote: it looks a bit naff >>> >>> Understatement of 2017. >> >> I'm honest about my own ideas, but my remarks were about the use of >> special symbols

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Chris Angelico
On Sun, Dec 31, 2017 at 9:43 AM, bartc wrote: > On 30/12/2017 20:36, Ben Bacarisse wrote: >> >> bartc writes: >> >>> On 30/12/2017 16:53, mm0fmf wrote: On 30/12/2017 14:41, bartc wrote: > > it looks a bit naff Understatement of 2017. >>> >>> >>> I'm honest about m

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Chris Angelico
On Sun, Dec 31, 2017 at 10:45 AM, bartc wrote: > On 30/12/2017 23:26, Gregory Ewing wrote: >> >> bartc wrote: >>> >>> B and C occur twice, so a goto is a quick way to reuse B and C without >>> needing to duplicate code, >> >> >> This only works if the repeated part happens to be at the >> tail of

Re: tkinter MP working like a charm

2017-12-30 Thread Chris Angelico
On Sun, Dec 31, 2017 at 4:02 PM, Abdur-Rahmaan Janhangeer wrote: > for beginners import * is probably fine. Even if you are using most modules > then too. else if module small maybe ok too > > just when you import just what you need, you save on resources . > Actually no; the entire module still

Re: tkinter MP working like a charm

2017-12-31 Thread Chris Angelico
On Sun, Dec 31, 2017 at 8:03 PM, Abdur-Rahmaan Janhangeer wrote: > @Chris > > hum nice point > > it seems to be related to namespace convenience > > like > > 1 from x import * > > is likelier to cause conflicts than > > 2 import x This is correct. Also, wh

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread Chris Angelico
On Sun, Dec 31, 2017 at 11:33 PM, bartc wrote: > On 30/12/2017 23:54, Chris Angelico wrote: >> >> On Sun, Dec 31, 2017 at 10:45 AM, bartc wrote: >>> >>> On 30/12/2017 23:26, Gregory Ewing wrote: >>>> >>>> >>>> bartc wrote: >

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread Chris Angelico
On Mon, Jan 1, 2018 at 3:55 AM, bartc wrote: >> The suggestion was to use them to avoid gotos. If duplicating is a good >> idea (and it's a hard line to draw) then we are not talking about the >> same cases. Given the choice of "dragging in named functions" and >> dragging in named blocks and go

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread Chris Angelico
On Mon, Jan 1, 2018 at 6:29 AM, bartc wrote: > You'll need to give an example I think. Suppose I start with this: > > def fn(a): > if a==1: > print ("One") > print ("Two") > print ("Three") > elif a==2: > print ("Four") > else: > print ("Other")

Re: ✨🍰✨ python 2018 wiki - a piece of cake ✨🍰✨

2018-01-01 Thread Chris Angelico
On Tue, Jan 2, 2018 at 9:44 AM, wrote: > On Monday, January 1, 2018 at 2:54:26 PM UTC, S. I. wrote: >> https://practical-scheme.net/wiliki/wiliki.cgi?python >> >> no register, no nothing ! just edit. >> >> ✨🍰✨ python - a piece of cake ✨🍰✨ >> >> just edit or enter acode.py entry with

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread Chris Green
n "if ...: > return"). I have always tried to enforce 'only one return per function'. If there are multiple returns it makes maintenance very difficult as 'clear up' code can get bypassed. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread Chris Angelico
On Tue, Jan 2, 2018 at 7:16 AM, Chris Green wrote: > Dennis Lee Bieber wrote: >> >> Well... "break" does bypass the rest of the block, but it still exits >> via the end of the block. I have a tendency to try for one "return" per >> procedur

Re: ... (Posting On Python-List Prohibited)

2018-01-01 Thread Chris Angelico
On Tue, Jan 2, 2018 at 8:27 AM, Wu Xi wrote: > >> Blocking of spamming and trolling prevents oppression of people who want to >> use the list, funded by PSF, for its purpose, discussion of Python. > > why are PSF funds privileged over anybody else's fund, which has zero > privilege? If you want

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread Chris Angelico
On Tue, Jan 2, 2018 at 9:11 AM, wrote: > On Monday, January 1, 2018 at 9:35:06 PM UTC, Chris Angelico wrote: >> On Tue, Jan 2, 2018 at 7:16 AM, Chris Green wrote: >> > Dennis Lee Bieber wrote: >> >> >> >> Well... "break" does byp

Re: unicode direction control characters

2018-01-02 Thread Chris Angelico
On Wed, Jan 3, 2018 at 1:30 AM, Robin Becker wrote: > I'm seeing some strange characters in web responses eg > > u'\u200e28\u200e/\u200e09\u200e/\u200e1962' > > for a date of birth. The code \u200e is LEFT-TO-RIGHT MARK according to > unicodedata.name. I tried unicodedata.normalize, but it leaves

Re: Goto

2018-01-02 Thread Chris Angelico
On Wed, Jan 3, 2018 at 1:51 AM, bartc wrote: > On 29/12/2017 18:11, Chris Angelico wrote: >> >> On Sat, Dec 30, 2017 at 4:13 AM, bartc wrote: >>> >>> If you want to translate code from one language to another, and the >>> source >>> language u

Re: unicode direction control characters

2018-01-02 Thread Chris Angelico
On Wed, Jan 3, 2018 at 2:36 AM, Robin Becker wrote: > On 02/01/2018 15:18, Chris Angelico wrote: >> >> On Wed, Jan 3, 2018 at 1:30 AM, Robin Becker wrote: >>> >>> I'm seeing some strange characters in web responses eg >>> >>> u'\u

Re: Python goto

2018-01-02 Thread Chris Angelico
On Wed, Jan 3, 2018 at 5:16 AM, Rob Gaddi wrote: > On 12/28/2017 04:35 AM, Skip Montanaro wrote: >> >> Jorge> I would like to know if there is a goto command or something >> similar that >> Jorge> I can use in Python. >> >> Ned> Python does not have a goto statement. You have to use structured >>

Re: has sourceforge exposed the dirty little secret ?

2018-01-05 Thread Chris Angelico
On Sat, Jan 6, 2018 at 6:02 AM, John Gordon wrote: > In <[email protected]> "Kim of K." > writes: > >> print(emo('now you see emos')) >> OF COURSE THIS SHIT DOES NOT WORK. > > What device did you run this on? Your average terminal window isn't > going to supp

Why does __ne__ exist?

2018-01-07 Thread Chris Angelico
When you create a Python class, you can create dunder methods to define how your objects respond to the standard operators. With comparison operators, Python will happily switch the operands around to find a method to call: >>> class Spam(): ... def __lt__(self, other): ... print("%s i

Re: Why does __ne__ exist?

2018-01-07 Thread Chris Angelico
Whoops, premature send. Picking up from the last paragraph. This is good. This is correct. For inequalities, you can't assume that >= is the exact opposite of < or the combination of < and == (for example, sets don't behave like numbers, so "x <= y" is very different from "x < y or x == y"). But t

Re: Why does __ne__ exist?

2018-01-07 Thread Chris Angelico
On Mon, Jan 8, 2018 at 7:13 AM, Thomas Jollans wrote: > On 07/01/18 20:55, Chris Angelico wrote: >> Under what circumstances would you want "x != y" to be different from >> "not (x == y)" ? > > In numpy, __eq__ and __ne__ do not, in general, return boo

Re: Why does __ne__ exist?

2018-01-07 Thread Chris Angelico
On Mon, Jan 8, 2018 at 7:41 AM, bartc wrote: > On 07/01/2018 19:55, Chris Angelico wrote: > >> Under what circumstances would you want "x != y" to be different from >> "not (x == y)" ? How would this make for sane behaviour? > > > Presumably so that

Re: [OT] Re: has sourceforge exposed the dirty little secret ?

2018-01-07 Thread Chris Angelico
On Mon, Jan 8, 2018 at 9:27 AM, Gene Heskett wrote: > On Sunday 07 January 2018 16:22:57 Christian Gollwitzer wrote: > >> Am 05.01.18 um 22:15 schrieb Michael Torrie: >> > Please, no! We don't need emoji in this group. Fortunately the vast >> > majority of posters use plain text (as is the etique

Re: Why does __ne__ exist?

2018-01-07 Thread Chris Angelico
On Mon, Jan 8, 2018 at 9:32 AM, bartc wrote: > On 07/01/2018 21:51, Chris Angelico wrote: >>>>>>> dis.dis("not (x in y)") >>>> >>>> >>>> 1 0 LOAD_NAME0 (x) >>>> 2 LOAD_N

Re: Why does __ne__ exist?

2018-01-07 Thread Chris Angelico
On Mon, Jan 8, 2018 at 8:06 AM, wrote: > From the third paragraph at > https://docs.python.org/2/reference/datamodel.html#object.__ne__ "There are > no implied relationships among the comparison operators. The truth of x==y > does not imply that x!=y is false. Accordingly, when defining __eq__

Re: [OT] Re: has sourceforge exposed the dirty little secret ?

2018-01-07 Thread Chris Angelico
On Mon, Jan 8, 2018 at 10:50 AM, Gene Heskett wrote: > On Sunday 07 January 2018 17:37:14 Random832 wrote: > >> On Sun, Jan 7, 2018, at 17:27, Gene Heskett wrote: >> > > 🐍 💻 >> > >> > But here its broken and I am looking at two pairs of vertical boxes >> > because it is not properly mime'd. If you

Re: Why does __ne__ exist?

2018-01-07 Thread Chris Angelico
On Mon, Jan 8, 2018 at 10:55 AM, Ben Finney wrote: > Chris Angelico writes: > >> So, yeah, sounds like it's basically historical. I'm still not sure >> why it was done in the first place, but it looks like it's the sort of >> thing that wouldn't be

Re: [OT] Re: has sourceforge exposed the dirty little secret ?

2018-01-07 Thread Chris Angelico
On Mon, Jan 8, 2018 at 11:07 AM, Gene Heskett wrote: > On Sunday 07 January 2018 18:25:52 Random832 wrote: > >> On Sun, Jan 7, 2018, at 17:47, Richard Damon wrote: >> > But it also says: >> > >> > Content-Transfer-Encoding: 7bit >> > >> > Which is incorrect, as the message is actually 8bit encoded

Re: [OT] Re: has sourceforge exposed the dirty little secret ?

2018-01-07 Thread Chris Angelico
On Mon, Jan 8, 2018 at 11:33 AM, Gene Heskett wrote: > And here, unifont showed them as empty boxes. So does that point the > finger of guilt to kmail? This is the TDE, R14.0.5 version. Hundreds of > bugs fixed since the fork at KDE-3.5. > Huh. I've no idea, then, but it's entirely possible that

Re: Why does __ne__ exist?

2018-01-07 Thread Chris Angelico
On Mon, Jan 8, 2018 at 11:35 AM, Ben Finney via Python-list wrote: > Chris Angelico writes: > >> On Mon, Jan 8, 2018 at 10:55 AM, Ben Finney >> wrote: >> > We've established that it is useful to allow data types to define >> > their own meaning of

Re: Why does __ne__ exist?

2018-01-07 Thread Chris Angelico
On Mon, Jan 8, 2018 at 4:21 PM, Ethan Furman wrote: > On 01/07/2018 04:57 PM, Chris Angelico wrote: >> >> On Mon, Jan 8, 2018 at 11:35 AM, Ben Finney wrote: >>> >>> Chris Angelico writes: > > >>>> Let's put it this way. Suppose th

Re: Why does __ne__ exist?

2018-01-08 Thread Chris Angelico
On Tue, Jan 9, 2018 at 3:25 AM, Cody Piersall wrote: >> Let's put it this way. Suppose that __eq__ existed and __ne__ didn't, >> just like with __contains__. Go ahead: sell the notion of __ne__. >> Pitch it, show why we absolutely need to allow this. Make sure you >> mention the potential confusio

Re: Tips or strategies to understanding how CPython works under the hood

2018-01-09 Thread Chris Angelico
On Wed, Jan 10, 2018 at 2:21 AM, Robert O'Shea wrote: > Hey all, > > Been subscribed to this thread for a while but haven't contributed much. > One of my ultimate goals this year is to get under the hood of CPython and > get a decent understanding of mechanics Guido and the rest of you wonderful >

Re: Tips or strategies to understanding how CPython works under the hood

2018-01-09 Thread Chris Angelico
On Wed, Jan 10, 2018 at 6:20 AM, ElChino wrote: > Chris Angelico wrote: > >> CPython is a stack-based interpreter, which means it loads values onto >> an (invisible) internal stack, processes values at the top of the >> stack, and removes them when it's done. >

Re: Simple graphic library for beginners

2018-01-11 Thread Chris Angelico
On Fri, Jan 12, 2018 at 12:38 AM, bartc wrote: > On 11/01/2018 05:16, Michael Torrie wrote: >> >> On 01/10/2018 01:13 PM, bartc wrote: > > >> Yes the link didn't have the simple examples I hoped for. How's this: >> - >> import pygame >> import time >> >> pygame.init()

Re: Simple graphic library for beginners

2018-01-11 Thread Chris Angelico
On Fri, Jan 12, 2018 at 5:33 AM, bartc wrote: > On 11/01/2018 15:23, Chris Angelico wrote: >> >> On Fri, Jan 12, 2018 at 12:38 AM, bartc wrote: > > >>> Although I can't run it because 'pygame' is not available. I think >>> installi

Re: Simple graphic library for beginners

2018-01-11 Thread Chris Angelico
On Fri, Jan 12, 2018 at 6:51 AM, bartc wrote: > On 11/01/2018 18:42, Chris Angelico wrote: >> >> On Fri, Jan 12, 2018 at 5:33 AM, bartc wrote: > > >>> Well, that seemed to do something, and it didn't need me to download any >>> .whl files. But then

Re: Simple graphic library for beginners

2018-01-11 Thread Chris Angelico
On Fri, Jan 12, 2018 at 7:02 AM, bartc wrote: > On 11/01/2018 19:41, Paul Moore wrote: >> >> On 11 January 2018 at 18:33, bartc wrote: > > >> python -m pip install XXX >> >> just works, for 99% of things anyone wants. In particular it works for >> pygame. >> >> Continuing to complain about a

Re: Simple graphic library for beginners

2018-01-11 Thread Chris Angelico
On Fri, Jan 12, 2018 at 7:34 AM, bartc wrote: > On 11/01/2018 20:12, Chris Angelico wrote: >> >> On Fri, Jan 12, 2018 at 7:02 AM, bartc wrote: >>> >>> On 11/01/2018 19:41, Paul Moore wrote: >>>> >>>> >>>> On 11 January 2018 at

Re: Simple graphic library for beginners

2018-01-11 Thread Chris Angelico
On Fri, Jan 12, 2018 at 9:21 AM, bartc wrote: > On 11/01/2018 20:53, Chris Angelico wrote: >> >> On Fri, Jan 12, 2018 at 7:34 AM, bartc wrote: > > >>> It failed on my 3.6, it failed on 3.4, it failed on 3.7 (is what 'pip' >>> does >>> r

Re: Tips or strategies to understanding how CPython works under the hood

2018-01-11 Thread Chris Angelico
On Fri, Jan 12, 2018 at 9:52 AM, Skip Montanaro wrote: >> So besides just grabbing a chunk of CPython source code and digesting it, I >> was wondering if those of you have read and understood the source code, do >> you have any tips or good starting points? > > Not mentioned yet, but maybe worth c

Re: Simple graphic library for beginners

2018-01-11 Thread Chris Angelico
On Fri, Jan 12, 2018 at 10:11 AM, bartc wrote: > On 11/01/2018 22:32, Chris Angelico wrote: >> >> On Fri, Jan 12, 2018 at 9:21 AM, bartc wrote: > > >>> As I understand it, pygame is just another add-on, which doesn't >>> inherently >>> need

Re: Simple graphic library for beginners

2018-01-11 Thread Chris Angelico
On Fri, Jan 12, 2018 at 11:57 AM, Steven D'Aprano wrote: > On Fri, 12 Jan 2018 05:42:03 +1100, Chris Angelico wrote: > >> On Fri, Jan 12, 2018 at 5:33 AM, bartc wrote: > [...] >>> Except my Python 3.6 doesn't have pip. There is a however a copy in my >>>

Re: Simple graphic library for beginners

2018-01-11 Thread Chris Angelico
On Fri, Jan 12, 2018 at 12:21 PM, bartc wrote: > On 11/01/2018 23:23, Chris Angelico wrote: >> >> On Fri, Jan 12, 2018 at 10:11 AM, bartc wrote: > > >> I'm almost ready to plonk you, but I think there is still SOME value >> in your posts. But please, stop

Re: Simple graphic library for beginners

2018-01-12 Thread Chris Angelico
On Fri, Jan 12, 2018 at 5:45 PM, Steven D'Aprano wrote: > On Fri, 12 Jan 2018 12:14:03 +1100, Chris Angelico wrote: >>> How do I deal with permissions errors? [semi-rhetorical question -- I >>> know *an* answer, but I don't know if it is the *right* answer] >>

Re: Simple graphic library for beginners

2018-01-12 Thread Chris Angelico
On Fri, Jan 12, 2018 at 9:00 PM, Paul Moore wrote: > On 12 January 2018 at 09:12, Tim Golden wrote: >> I think the shame here is that there is a learning opportunity on both >> sides. As Paul says: by and large, the huge amount of work which the Python >> Packaging team, especially the pip develo

Re: Where is the usage of (list comprehension) documented?

2018-01-14 Thread Chris Angelico
On Mon, Jan 15, 2018 at 10:01 AM, Peng Yu wrote: > Hi, > > I see the following usage of list comprehension can generate a > generator. Does anybody know where this is documented? Thanks. > > $ cat main.py > #!/usr/bin/env python > > import sys > lines = (line.rstrip('\n') for line in sys.stdin) >

Re: Can utf-8 encoded character contain a byte of TAB?

2018-01-15 Thread Chris Angelico
On Tue, Jan 16, 2018 at 8:29 AM, Peng Yu wrote: >> Just to be clear, TAB *only* appears in utf-8 as the encoding for the actual >> TAB character, not as a part of any other character's encoding. The only >> bytes that can appear in the utf-8 encoding of non-ascii characters are >> starting with

Re: Speeding up the implementation of Stochastic Gradient Ascent in Python

2018-01-17 Thread Chris Angelico
On Thu, Jan 18, 2018 at 6:28 AM, Ned Batchelder wrote: > You'll have to replace random.choice() with > random.choice(list(...)), since you can't random.choice from a set. > Side point: why can't you? You can random.sample from a set, but random.choice requires a sequence. It seems perfectly sane

Re: Speeding up the implementation of Stochastic Gradient Ascent in Python

2018-01-17 Thread Chris Angelico
On Thu, Jan 18, 2018 at 7:19 AM, Ned Batchelder wrote: > On 1/17/18 2:45 PM, Chris Angelico wrote: >> >> On Thu, Jan 18, 2018 at 6:28 AM, Ned Batchelder >> wrote: >>> >>> You'll have to replace random.choice() with >>> random.choice

Re: Very strange issues with collections.Mapping

2018-01-18 Thread Chris Angelico
On Fri, Jan 19, 2018 at 8:37 AM, Jason Swails wrote: > The root cause of the issue comes down to the following check returning > true: > > isinstance([], collections.Mapping) > > Obviously you can get this behavior if you register `list` as a subclass of > the Mapping ABC, but I'm not doing that.

Re: Context manager able to write to the caller's namespace

2018-01-18 Thread Chris Angelico
On Fri, Jan 19, 2018 at 3:48 PM, Steven D'Aprano wrote: > I want to define a context manager in one module: > > # a.py > def CM: > def __enter__(self): > return self > def __exit__(self, *args): > pass > > > Then call it from another module: > > # b.py > import a > with a.C

Re: Re: Context manager able to write to the caller's namespace

2018-01-18 Thread Chris Angelico
On Fri, Jan 19, 2018 at 5:00 PM, wrote: > Hello, > > Thank you for your mail. I will answer as fast as possible. If you're going to subscribe to a mailing list, PLEASE disable your autoresponder. Otherwise, messages like this will get marked as Spam, and your legit mail will end up getting tarr

Re: Can't get python running

2018-01-20 Thread Chris Angelico
On Sun, Jan 21, 2018 at 12:08 PM, bartc wrote: > On 20/01/2018 17:16, Jim Sadler wrote: >> >> I downloaded python 3.6.4 and although everything about the installation >> seems correct (path, file size, checking on cmd to see if file installed >> correctly-it is) > > > What do you mean by 'checking

Re: Can't get python running

2018-01-20 Thread Chris Angelico
On Sun, Jan 21, 2018 at 12:40 PM, bartc wrote: > On 21/01/2018 01:21, Chris Angelico wrote: >> >> On Sun, Jan 21, 2018 at 12:08 PM, bartc wrote: >>> >>> On 20/01/2018 17:16, Jim Sadler wrote: >>>> >>>> >>>> I downloaded p

Re: Can't get python running

2018-01-20 Thread Chris Angelico
On Sun, Jan 21, 2018 at 12:46 PM, Steven D'Aprano wrote: > On Sun, 21 Jan 2018 12:21:40 +1100, Chris Angelico wrote: > >> Jim, let the installer put it where it wants to, and make sure you've >> added it to PATH. Then you should be able to type "py" to sta

Re: exec and traceback

2018-01-22 Thread Chris Angelico
On Mon, Jan 22, 2018 at 7:22 PM, wrote: > > > I'm using exec() to run a (multi-line) string of python code. If an > exception occurs, I get a traceback containing a stack frame for the string. > I've labeled the code object with a "file name" so I can identify it easily, > and when I debug, I fin

Re: python to C code generator

2018-01-23 Thread Chris Angelico
On Wed, Jan 24, 2018 at 1:45 AM, wrote: > Hey Ally, > > Cython adds a big chunk of complexity to simple things. That's the problem. That's like saying "Unicode adds a big chunk of complexity to the simple task of translating a word from Japanese into Russian". No, it doesn't; the complexity is i

Re: Processing a key pressed in Python 3.6

2018-01-23 Thread Chris Angelico
On Wed, Jan 24, 2018 at 5:50 AM, Virgil Stokes wrote: > I would appreciate help on finding a solution to following problem. This is > the general structure of the "problem" code: > >> while True >> # Get some data from the web and process it >> ... >> ... >> # Write these data to a

How to diagnose this, fails on 3.6.3, works on 3.5.2?

2018-01-24 Thread Chris Green
:- chris$ no Traceback (most recent call last): File "/home/chris/bin/no", line 59, in os.execvp("vi", ("", monthFile,)) File "/usr/lib/python3.6/os.py", line 559, in execvp _execvpe(file, args) File "/us

Re: Python call c pass a callback function on Linux

2018-01-24 Thread Chris Angelico
On Thu, Jan 25, 2018 at 9:16 AM, Jason Qian via Python-list wrote: > Hi, > > I have following code that works fine on windows. > > InvocationCB=WINFUNCTYPE(None, c_char_p, c_int) > submit = lib.submit > submit.argtypes = [ctypes.c_void_p, c_void_p,InvocationCB] > submit.restype = ctypes.c_int >

Re: How to diagnose this, fails on 3.6.3, works on 3.5.2?

2018-01-26 Thread Chris Green
Peter Otten <[email protected]> wrote: > Chris Green wrote: > > > I have a fairly simple little python program to automate starting an > > editor on a wiki page. It works fine on the system where I wrote it > > (xubuntu 16.04, python 3 version 3.5.2) but it comes u

MailingLogger 4.0.0 Released!

2018-01-26 Thread Chris Withers
cs.io/en/latest/ For more information, please see: https://github.com/Simplistix/mailinglogger/ cheers, Chris -- https://mail.python.org/mailman/listinfo/python-list

Re: error from Popen only when run from cron

2018-01-27 Thread Chris Angelico
On Sun, Jan 28, 2018 at 2:58 AM, Larry Martell wrote: > I have a script that does this: > > subprocess.Popen(['service', 'some_service', 'status'], > stdout=subprocess.PIPE, stderr=subprocess.STDOUT) > > When I run it from the command line it works fine. When I run it from > cron I get: > > su

Re: Text Strip() now working constantly.

2018-01-27 Thread Chris Angelico
On Sun, Jan 28, 2018 at 4:25 AM, George Shen wrote: > Hi Python Group, > > I am not sure if I am doing this correctly however, I believe I found a bug > that involves the striping of a text string. If you're implying that it's a bug in Python, no it isn't. If you're trying to understand the bug i

Re: Text Strip() now working constantly.

2018-01-27 Thread Chris Angelico
On Sun, Jan 28, 2018 at 5:46 AM, wrote: > Hi, I'm a begginer in Python, i have a question... > > can we use replace method to do it. > > E.g. a='cm_text.data' > a.replace('.data', ''), this will return output as 'cm_text'. Yep! That works too. Be aware, though, that it might replace ".data"

Re: Compression of random binary data

2018-01-27 Thread Chris Angelico
On Sun, Jan 28, 2018 at 4:26 PM, wrote: > If it is then show him this > > 387,420,489 > = > 00110011 00111000 00110111 00101100 00110100 00110010 0011 00101100 > 00110100 00111000 00111001 > > 9^9 = ⬇️ (^ = to the power of) > = 387,420,489 > > But > > 9^9 > = > 00111001 0100 00111001 I

Re: Fwd: Text Strip() now working constantly.

2018-01-28 Thread Chris Angelico
On Mon, Jan 29, 2018 at 1:07 AM, Steven D'Aprano wrote: > On Sat, 27 Jan 2018 11:25:35 -0600, George Shen wrote: > >> I have attached a JPG that clearly illustrate the issue. > [...] >> Please see the JPG. > > And what of us who are blind or visually impaired and use a screen reader > to read text

Re: Where has the practice of sending screen shots as source code come from?

2018-01-28 Thread Chris Angelico
On Mon, Jan 29, 2018 at 3:36 AM, Steven D'Aprano wrote: >> Certainly easier for the average user than trying to do a >> slightly tricky rectangle selection within the Windows console. > > But I'm not seeing that it could possibly be easier than selecting text > and hitting copy and paste. Not even

Re: Where has the practice of sending screen shots as source code come from?

2018-01-28 Thread Chris Warrick
On 28 January 2018 at 20:19, Chris Angelico wrote: > The vanilla Windows console (conhost.exe IIRC) is far from ideal for > copying and pasting from It’s been fixed in recent Windows 10 releases (select and Ctrl+C works now). > Windows error popups are *impossible* to copy text fr

Re: Where has the practice of sending screen shots as source code come from?

2018-01-28 Thread Chris Angelico
On Mon, Jan 29, 2018 at 7:13 AM, Chris Warrick wrote: > On 28 January 2018 at 20:19, Chris Angelico wrote: >> The vanilla Windows console (conhost.exe IIRC) is far from ideal for >> copying and pasting from > > It’s been fixed in recent Windows 10 releases (select and Ctrl+C

Re: Where has the practice of sending screen shots as source code come from?

2018-01-28 Thread Chris Angelico
On Mon, Jan 29, 2018 at 7:41 AM, wrote: > On Sunday, January 28, 2018 at 3:27:06 PM UTC-5, Chris Angelico wrote: >> On Mon, Jan 29, 2018 at 7:13 AM, Chris Warrick wrote: >> > On 28 January 2018 at 20:19, Chris Angelico wrote: >> >> The vanilla Windows console

Re: Issues while using CallerLookup Package

2018-01-29 Thread Chris Angelico
On Mon, Jan 29, 2018 at 9:52 PM, Mark.luther0987 via Python-list wrote: > I accessed the CallerLookup package from below link > https://pypi.python.org/pypi/CallerLookup > > and faced the following issue- > RESTART: > C:\Users\hp\Desktop\CallerLookup-1.2.94\CallerLookup-1.2.94\CallerLookup\M

Re: Where has the practice of sending screen shots as source code come from?

2018-01-29 Thread Chris Angelico
On Tue, Jan 30, 2018 at 6:43 AM, John Ladasky wrote: > On Sunday, January 28, 2018 at 7:07:11 AM UTC-8, Steven D'Aprano wrote: >> >> (The day a programmer posts a WAV file of themselves reading their code >> out aloud, is the day I turn my modem off and leave the internet forever.) > > What's a...

Re: Where has the practice of sending screen shots as source code come from?

2018-01-29 Thread Chris Angelico
On Tue, Jan 30, 2018 at 11:40 AM, Abdur-Rahmaan Janhangeer wrote: > well maybe screenshot of shell sessions to show varying formatted test > cases might be valid (like the increasingly popular practise of coding py > on android) Maybe, but that isn't code. > also, sreenshot sources tend to be sy

Re: Variable scope in nested functions

2018-01-29 Thread Chris Angelico
On Tue, Jan 30, 2018 at 1:48 PM, Prahallad Achar wrote: > def a() : > Print (value) > def b() : > Value = 100 > Return b > > Its a nested function. How can I use variable value just one function > above the parent function. > This is possible in tcl.. Is it possible in Python

Re: Where has the practice of sending screen shots as source code come from?

2018-01-29 Thread Chris Angelico
On Tue, Jan 30, 2018 at 12:56 PM, Abdur-Rahmaan Janhangeer wrote: > > XD since we were elaborating on the reasons why users use screenshot, well i > was elaborating why users use screenshot, not me. those are some reasons i > came across being admin in some whatsapp groups and python lists (wher

Re: [OT] Text as digitization [was Re: Where has the practice of sending screen shots as source code come from?]

2018-01-30 Thread Chris Angelico
On Wed, Jan 31, 2018 at 3:09 AM, Steven D'Aprano wrote: > On Tue, 30 Jan 2018 05:48:15 -0800, Rustom Mody wrote: > >> Text is a highly stylized unnatural medium > [chomp] > >> That people who have not been cultured in a certain way can do >> aggravating things like talking with pics instead of tex

Re: checksum problem

2018-01-30 Thread Chris Angelico
On Wed, Jan 31, 2018 at 6:21 AM, Peter Pearson wrote: > On Tue, 30 Jan 2018 11:24:07 +0100, jak wrote: >> with open(fname, "rb") as fh: >> for data in fh.read(m.block_size * blocks): >> m.update(data) >> return m.hexdigest() >> > > I believe your "for data in fh.re

Re: PyPy support breaking CPython compatibility?

2018-01-30 Thread Chris Angelico
On Wed, Jan 31, 2018 at 6:35 AM, Etienne Robillard wrote: > Hi, > > I managed to patch Schevo and Durus to run under PyPy 5.9. However, I'm > afraid the changes is breaking Python 2.7 compatibility. > > I'm not sure how I should distribute my changes to the respective projects. > > Since I decided

Re: PyPy support breaking CPython compatibility?

2018-01-30 Thread Chris Angelico
On Wed, Jan 31, 2018 at 7:58 AM, Etienne Robillard wrote: > Hi Ned, > > > Le 2018-01-30 à 15:14, Ned Batchelder a écrit : >> >> I'm curious what you had to change for PyPy? (Unless it's a Py2/Py3 thing >> as Chris mentions.) > > > Please take a

Re: PyPy support breaking CPython compatibility?

2018-01-31 Thread Chris Angelico
On Wed, Jan 31, 2018 at 8:15 PM, Etienne Robillard wrote: > > > Le 2018-01-30 à 16:38, Ned Batchelder a écrit : >>> >>> I'm confused by this: >>> >>> -if os.environ.get('SCHEVO_OPTIMIZE', '1') == '1': >>> +if os.environ.get('SCHEVO_OPTIMIZE', '1') == True: >>> >> I was also curious about this: whe

Re: Help to debug my free library

2018-01-31 Thread Chris Angelico
On Thu, Feb 1, 2018 at 5:58 AM, Victor Porton wrote: > LibComCom is a C library which passes a string as stdin of an OS command and > stores its stdout in another string. Something like the built-in subprocess module does? ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Help to debug my free library

2018-01-31 Thread Chris Angelico
On Thu, Feb 1, 2018 at 6:26 AM, Victor Porton wrote: > Chris Angelico wrote: > >> On Thu, Feb 1, 2018 at 5:58 AM, Victor Porton wrote: >>> LibComCom is a C library which passes a string as stdin of an OS command >>> and stores its stdout in another string. >

Re: Help to debug my free library

2018-01-31 Thread Chris Angelico
On Thu, Feb 1, 2018 at 6:41 AM, Victor Porton wrote: > [email protected] wrote: > >> Le mercredi 31 janvier 2018 20:13:06 UTC+1, Chris Angelico a écrit : >>> On Thu, Feb 1, 2018 at 5:58 AM, Victor Porton wrote: >>> > LibComCom is a C library which

Re: Help to debug my free library

2018-01-31 Thread Chris Angelico
On Thu, Feb 1, 2018 at 9:31 AM, alister via Python-list wrote: > On Thu, 01 Feb 2018 06:48:03 +1100, Chris Angelico wrote: > >> On Thu, Feb 1, 2018 at 6:41 AM, Victor Porton wrote: >>> [email protected] wrote: >>> >>>> Le mercredi 31 janvier 2

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

2018-02-01 Thread Chris Angelico
On Fri, Feb 2, 2018 at 4:01 AM, superchromix wrote: > > Our own programming discussion newsgroup, located at comp.lang.idl-pvwave, > started receiving spam messages several months ago. > > Two weeks ago, access to comp.lang.idl-pvwave was blocked by Google Groups. > > When trying to access comp.l

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

2018-02-01 Thread Chris Angelico
On Fri, Feb 2, 2018 at 4:50 AM, wrote: > On Thursday, February 1, 2018 at 6:01:58 PM UTC+1, superchromix wrote: >> Our own programming discussion newsgroup, located at comp.lang.idl-pvwave, >> started receiving spam messages several months ago. >> >> Two weeks ago, access to comp.lang.idl-pvwave

Re: Create an alias to an attribute on superclass

2018-02-01 Thread Chris Angelico
On Fri, Feb 2, 2018 at 5:22 AM, Sean DiZazzo wrote: > Hi! > > I basically just want to create an alias to an attribute on an item's > superclass. So that after I create the subclass object, I can access the > alias attribute to get the value back. > > > class Superclass(object): > def __in

Re: Create an alias to an attribute on superclass

2018-02-01 Thread Chris Angelico
On Fri, Feb 2, 2018 at 5:44 AM, Sean DiZazzo wrote: > On Thursday, February 1, 2018 at 10:37:32 AM UTC-8, Chris Angelico wrote: >> On Fri, Feb 2, 2018 at 5:22 AM, Sean DiZazzo wrote: >> > Hi! >> > >> > I basically just want to create an alias to an attribut

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

2018-02-02 Thread Chris Green
gure) that aggregates feeds from two public NNTP servers which provides some robustness if things go wrong with either. By configuring the time for which posts are retained by leafnode (to quite a long time) I can search back a long way. As I only read a few tens of newsgroups this doesn't

Re: Trace back error just trying to run a simple import of requests

2018-02-02 Thread Chris Angelico
On Sat, Feb 3, 2018 at 2:25 AM, Grant Edwards wrote: > On 2018-02-01, MRAB wrote: >> On 2018-02-01 22:32, Grant Edwards wrote: >>> On 2018-02-01, William Sewell wrote: >>> My python script which I run daily just blew up. So, I went into python to diagnose and just typed in the first l

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

2018-02-03 Thread Chris Angelico
On Sun, Feb 4, 2018 at 6:34 AM, Mark Lawrence wrote: > On 03/02/18 17:56, Peter J. Holzer wrote: >> You seem to confuse the mailing-list and the newsgroup. The mailing-list >> doesn't have a spam problem, and it is already (lightly) moderated. >> >> The newsgroup does have a spam problem (as well

Re: 2.6.7: Does socket.gethostbyaddr truncate?

2018-02-04 Thread Chris Angelico
On Tue, Jan 30, 2018 at 11:05 PM, Antoon Pardon wrote: > I am using python 2.6.7 to do a little network programming, but it seems I > don't > get all the results. > > When I call socket.gethostbyaddr(IP) entry [1] of the result is a list of 34 > addresses. > > However when I use: dig -x IP I get

Re: Help on convert PyObject to string (c) Python 3.6

2018-02-04 Thread Chris Angelico
On Mon, Feb 5, 2018 at 3:52 AM, Jason Qian via Python-list wrote: > Hi, > >This is the case of calling python from c and the python function will > return a string. > >It seems python been called correctly, but got error when convert the > python string to c string. > > -- c -- > >PyO

Re: Parsing Nested List

2018-02-04 Thread Chris Angelico
On Mon, Feb 5, 2018 at 9:26 AM, Stanley Denman wrote: > I am trying to parse a Python nested list that is the result of the > getOutlines() function of module PyPFD2 using pyparsing module. This is the > result I get. what in the world are 'expandtabs' and why is that making a > difference to m

Re: 3.6.4 IDLE

2018-02-04 Thread Chris Angelico
On Mon, Feb 5, 2018 at 8:09 AM, Rob Alspach wrote: > Hi Everybody! I just installed python 3.6.4 it was a fresh install (no > former versions). I have never used python but have some IS background. The > videos I am seeing online all show the IDE / IDLE; however, it does not > install for me. I am

Re: Python "Bad syntax"

2018-02-05 Thread Chris Angelico
On Tue, Feb 6, 2018 at 4:28 AM, Phil Boutros wrote: > wrote: >> >> Hi, I have a problem in continuing the function. >> >> I'm a beginner, I'm learning from a textbook. I'm going to put the >> following examples from a textbook that displays "wrong syntax" >> > for letter in "ABCDEFGHIJKLMNOP

Re: "None" and "pass"

2018-02-05 Thread Chris Angelico
On Tue, Feb 6, 2018 at 6:47 AM, Alain Ketterlin wrote: > [email protected] (Stefan Ram) writes: > >> A participant of my Python course asked whether one could >> also use "None" instead of "pass". What do you think? >> >> def f(): >> pass >> >> can also be written as >> >> def f():

Re: "None" and "pass"

2018-02-05 Thread Chris Angelico
On Tue, Feb 6, 2018 at 8:39 AM, Ben Finney wrote: > Chris Angelico writes: > >> As one special case, I would accept this sort of code: >> >> def f(): >> ... >> >> (three dots representing the special value Ellipsis) >> >> It's

<    39   40   41   42   43   44   45   46   47   48   >