Re: Compression of random binary data

2017-10-23 Thread Chris Angelico
On Mon, Oct 23, 2017 at 11:18 PM, alister via Python-list wrote: > On Mon, 23 Oct 2017 10:41:55 +0100, Paul Moore wrote: > >> On 23 October 2017 at 10:32, wrote: >>> According to this website. This is an uncompressable stream. >>> >>> https://en.m.wikipedia.org/wiki/Incompressible_string >>> >>>

Re: choice of web-framework

2017-10-23 Thread Chris Warrick
On 23 October 2017 at 21:37, John Black wrote: > Chris, thanks for all this detailed information. I am confused though > with your database recommendation. You say you teach SQLAlchemy but > generally use PostgreSQL yourself. I can maybe guess why there seems to > be this c

Re: Compression of random binary data

2017-10-23 Thread Chris Angelico
On Tue, Oct 24, 2017 at 2:28 AM, Paul Moore wrote: > Hope this helps put the subject into context. Compression is a very > technical subject, to "do it right". Special cases can be worked out, > sure, but the "hidden assumptions" in a method are what make the > difference between a "compression al

Re: choice of web-framework

2017-10-24 Thread Chris Angelico
On Tue, Oct 24, 2017 at 6:57 AM, Chris Warrick wrote: > On 23 October 2017 at 21:37, John Black wrote: >> Chris, thanks for all this detailed information. I am confused though >> with your database recommendation. You say you teach SQLAlchemy but >> generally use Postgr

Re: Compression of random binary data

2017-10-24 Thread Chris Angelico
On Wed, Oct 25, 2017 at 9:11 AM, Steve D'Aprano wrote: > On Wed, 25 Oct 2017 02:40 am, Lele Gaifax wrote: > >> Steve D'Aprano writes: >> >>> But given an empty file, how do you distinguish the empty file you get >>> from 'music.mp3' and the identical empty file you get from 'movie.avi'? >> >> Tha

Re: Determine the container class of an object in Python 3

2017-10-25 Thread Chris Angelico
On Thu, Oct 26, 2017 at 12:25 PM, qrious wrote: > > Class1 is instantiated in Class2 as follows. Class2 also contains another > variable, say: > > class Class2: > class1 = Class1() > a = 0 > > I want to create a method myDef() in Class1 that can read or write to a. How > do I access a fr

Re: Python noob having a little trouble with strings

2017-10-27 Thread Chris Angelico
On Sat, Oct 28, 2017 at 1:14 AM, Christopher Reimer wrote: > On Oct 27, 2017, at 1:49 AM, Peter J. Holzer wrote: >> >> BTW, I find it hard to believe that PyCharm for the Mac "comes with" >> Python 2.6. Python 2.6 is quite old. The Linux version isn't bundled >> with a python interpreter and just

Re: Just a quick question about main()

2017-10-27 Thread Chris Angelico
On Sat, Oct 28, 2017 at 5:05 AM, ROGER GRAYDON CHRISTMAN wrote: > While teaching my introductory course in Python, I occasionally see > submissions containing the following two program lines, even before > I teach about functions and modules: > > if __name__ = '__main__': > ... main() > > When I

Re: Just a quick question about main()

2017-10-27 Thread Chris Angelico
On Sat, Oct 28, 2017 at 5:23 AM, Chris Angelico wrote: > On Sat, Oct 28, 2017 at 5:05 AM, ROGER GRAYDON CHRISTMAN wrote: >> While teaching my introductory course in Python, I occasionally see >> submissions containing the following two program lines, even before >> I teac

testfixtures 5.3.0 released!

2017-10-28 Thread Chris Withers
ailing list... cheers, Chris -- https://mail.python.org/mailman/listinfo/python-list

Re: Coding style in CPython implementation

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 5:42 AM, Στέφανος Σωφρονίου wrote: > Greetings everyone. > > I have noticed that in many if conditions the following syntax is used: > > a) if (variable == NULL) { ... } > b) if (variable == -1) { ... } > c) if (variable != NULL) { ... } > > What I wanted to ask is, is ther

Re: Ide vs ide

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 6:10 AM, Stefan Ram wrote: > Rustom Mody writes: >>Useful python programs are often small; even tiny > > We must not forget that tiny programs are just large > problems with the size masterfully hidden. > > For example, the »print« of Python is actually implemented >

Re: Problem with subprocess.Popen and EINTR

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 8:56 AM, Piet van Oostrum wrote: > I am using Python 2.7.14 on MacOS Sierra. > > I have a small Python program that calls a shell script in a loop with a > time.sleep() in it. > The shell script is called with subprocess.Popen(), followed by a > subprocess.wait(). > No in

Re: Compression of random binary data

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 1:18 PM, Gregory Ewing wrote: > You're missing something fundamental about what > entropy is in information theory. > > It's meaningless to talk about the entropy of a single > message. Entropy is a function of the probability > distribution of *all* the messages you might

Re: Compression of random binary data

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 1:32 PM, Chris Angelico wrote: > On Sun, Oct 29, 2017 at 1:18 PM, Gregory Ewing > wrote: >> You're missing something fundamental about what >> entropy is in information theory. >> >> It's meaningless to talk about the entropy of a

Re: Compression of random binary data

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 2:08 PM, Gregory Ewing wrote: > Stefan Ram wrote: >> >> Well, then one can ask about the entropy of a data source >> that only is emitting this message. > > > You can, but it's still the *source* that has the entropy, > not the message. > > (And the answer in that case

Re: Compression of random binary data

2017-10-29 Thread Chris Angelico
On Sun, Oct 29, 2017 at 6:00 PM, Ian Kelly wrote: > On Oct 28, 2017 5:53 PM, "Chris Angelico" wrote: >> One bit. It might send the message, or it might NOT send the message. > > Not sending the message is equivalent to having a second possible message. Okay, no

Re: Repairing Python installation?

2017-10-29 Thread Chris Warrick
og/2017/06/18/unix-locales-vs-unicode/ (Nikola’s co-maintainer over here.) -- Chris Warrick <https://chriswarrick.com/> PGP: 5EAAEA16 -- https://mail.python.org/mailman/listinfo/python-list

Re: Repairing Python installation?

2017-10-29 Thread Chris Warrick
me? cd into your virtualenv directory and run `source bin/activate`. -- Chris Warrick <https://chriswarrick.com/> PGP: 5EAAEA16 -- https://mail.python.org/mailman/listinfo/python-list

Re: Coding style in CPython implementation

2017-10-29 Thread Chris Angelico
On Mon, Oct 30, 2017 at 12:47 AM, Stefan Ram wrote: > =?UTF-8?B?zqPPhM6tz4bOsc69zr/PgiDOo8+Jz4bPgc6/zr3Or86/z4U=?= > writes: >>I guess the following parts from "Zen of Python" apply to this case: > > If we would agree to apply Python rules to C, > then we could also use this excerpt from PEP

Re: Invoking return through a function?

2017-10-30 Thread Chris Angelico
On Tue, Oct 31, 2017 at 2:00 PM, Steve D'Aprano wrote: > Python has no GOTO, fortunately, but C has at least two, GOTO and LONGJMP. A C > macro could, if I understand correctly, jump into the middle of another > function. (Yay for spaghetti code!) No, I don't think you do understand them correctl

Re: Invoking return through a function?

2017-10-31 Thread Chris Angelico
On Tue, Oct 31, 2017 at 4:32 PM, Steve D'Aprano wrote: > On Tue, 31 Oct 2017 02:34 pm, Chris Angelico wrote: > >> On Tue, Oct 31, 2017 at 2:00 PM, Steve D'Aprano >> wrote: >>> Python has no GOTO, fortunately, but C has at least two, GOTO and LONGJMP.

Re: String changing size on failure?

2017-11-01 Thread Chris Angelico
On Thu, Nov 2, 2017 at 6:26 AM, Ned Batchelder wrote: > From David Beazley (https://twitter.com/dabeaz/status/925787482515533830): > > >>> a = 'n' > >>> b = 'ñ' > >>> sys.getsizeof(a) >50 > >>> sys.getsizeof(b) >74 > >>> float(b) >Traceback (most recent call last):

Re: Code Snippets

2017-11-01 Thread Chris Angelico
On Thu, Nov 2, 2017 at 7:17 AM, Stefan Ram wrote: > Wolfgang Maier writes: >>If you're worried bout having things on separate lines, you could write: >>import os; os.getcwd() >>,etc., which is actually saving a few characters :) > > Yes, but there still is the risk of the identifier »os« > al

Re: String changing size on failure?

2017-11-01 Thread Chris Angelico
On Thu, Nov 2, 2017 at 7:34 AM, Ned Batchelder wrote: > On 11/1/17 4:17 PM, MRAB wrote: >> >> On 2017-11-01 19:26, Ned Batchelder wrote: >>> >>> From David Beazley >>> (https://twitter.com/dabeaz/status/925787482515533830): >>> >>> >>> a = 'n' >>> >>> b = 'ñ' >>> >>> sys.getsiz

Re: Code Snippets

2017-11-01 Thread Chris Angelico
On Thu, Nov 2, 2017 at 8:02 AM, Ben Bacarisse wrote: > [email protected] (Stefan Ram) writes: > >> Wolfgang Maier writes: >>>If you're worried bout having things on separate lines, you could write: >>>import os; os.getcwd() >>>,etc., which is actually saving a few characters :) >> >> Yes,

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

2017-11-01 Thread Chris Angelico
On Thu, Nov 2, 2017 at 8:12 AM, Alexey Muranov wrote: > Hello, > > what do you think about the idea of replacing "`else`" with "`then`" in the > contexts of `for` and `try`? > > It seems clear that it should be rather "then" than "else." Compare also > "try ... then ... finally" with "try ... els

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

2017-11-01 Thread Chris Angelico
On Thu, Nov 2, 2017 at 8:23 AM, Ned Batchelder wrote: > On 11/1/17 5:12 PM, Alexey Muranov wrote: >> >> Hello, >> >> what do you think about the idea of replacing "`else`" with "`then`" in >> the contexts of `for` and `try`? >> >> It seems clear that it should be rather "then" than "else." Compare

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

2017-11-01 Thread Chris Angelico
On Thu, Nov 2, 2017 at 12:19 PM, Steve D'Aprano wrote: > On Thu, 2 Nov 2017 08:21 am, Chris Angelico wrote: > >> With the 'for' loop, >> it's a bit more arguable, but I've never seen anything more than a >> weak argument in favour of 'then&#x

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

2017-11-02 Thread Chris Angelico
On Thu, Nov 2, 2017 at 12:42 PM, bartc wrote: > But if people prefer a different keyword, then why not? I think 'then' can > be used, without impacting its use as an identifier, because it will always > be followed by ":". Of course you would need to allow both "else" and "then" > for backwards co

Re: install on host not connected to the internet and no local proxy

2017-11-02 Thread Chris Angelico
On Thu, Nov 2, 2017 at 5:50 PM, Noah wrote: > Hi, > > I am trying to install a python package with about 80 dependencies on a > server that is not connected to the internet and has no local proxy. I can > ssh to it via VPN. > > I was able to find python bundle and download the tarballs for all th

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

2017-11-02 Thread Chris Angelico
On Thu, Nov 2, 2017 at 7:05 PM, Alexey Muranov wrote: > On Wed, 2017-11-01 at 21:30 +, Stefan Ram wrote: >> >> > >> > In languages like Algol 68, »then« is used for a clause >> > that is to be executed when the main condition of an >> > if-statement /is/ true, so this might cause some co

Re: Thread safety issue (I think) with defaultdict

2017-11-02 Thread Chris Angelico
On Fri, Nov 3, 2017 at 3:27 AM, Israel Brewster wrote: > > Actually, that saying is about regular expressions, not threads :-) . In the > end, threads are as good a way as handling concurrency as any other, and > simpler than many. They have their drawbacks, of course, mainly in the area > of o

Re: Share unpickleable object across processes

2017-11-02 Thread Chris Angelico
On Fri, Nov 3, 2017 at 5:54 AM, Israel Brewster wrote: > I have a Flask/UWSGI web app that serves up web socket connections. When a > web socket connection is created, I want to store a reference to said web > socket so I can do things like write messages to every connected > socket/disconnect

Re: Share unpickleable object across processes

2017-11-02 Thread Chris Angelico
On Fri, Nov 3, 2017 at 7:35 AM, Israel Brewster wrote: > On Nov 2, 2017, at 12:30 PM, Chris Angelico wrote: >> >> On Fri, Nov 3, 2017 at 5:54 AM, Israel Brewster >> wrote: >>> I have a Flask/UWSGI web app that serves up web socket connections. When a >>&

Re: Share unpickleable object across processes

2017-11-02 Thread Chris Angelico
On Fri, Nov 3, 2017 at 8:10 AM, Israel Brewster wrote: > Gotcha, thanks. The hesitation I have there is that the UWSGI config is a > user setting. Sure, I can set up my install to only run one process, but > what if someone else tries to use my code, and they set up UWSGI to run > multiple? I hate

Re: Share unpickleable object across processes

2017-11-02 Thread Chris Angelico
On Fri, Nov 3, 2017 at 11:00 AM, Dennis Lee Bieber wrote: > On Thu, 2 Nov 2017 12:32:35 -0800, Israel Brewster > declaimed the following: > > >> >>I *must* be thinking about this wrong. Take even a basic chat app that uses >>websockets. Client a, which connected to process 1, sends a message to

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

2017-11-03 Thread Chris Angelico
On Fri, Nov 3, 2017 at 8:48 PM, Alexey Muranov wrote: > 'Then' describes what happens next indeed, unless some extraordinary > situation prevents it from happening, for example: > >try: >go_to_the_bakery() >then: >buy_croissants(2) >except BakeryClosed: >go_to_t

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

2017-11-03 Thread Chris Angelico
On Fri, Nov 3, 2017 at 10:49 PM, Jon Ribbens wrote: > On 2017-11-03, Steve D'Aprano wrote: >> On Fri, 3 Nov 2017 03:31 am, Jon Ribbens wrote: >>> No, it's an obvious bug. You have a 'for...else' with no 'break'. >>> Like I said, that should probably be a syntax error. >> >> It should absolutely n

Re: python3 byte decode

2017-11-03 Thread Chris Angelico
On Fri, Nov 3, 2017 at 8:24 PM, Ali Rıza KELEŞ wrote: > Hi, > > Yesterday, while working with redis, i encountered a strange case. > > I want to ask why is the following `True` > > ``` > "s" is b"s".decode() > ``` > > while the followings are `False`? > > ``` > "so" is b"so".decode() > "som" is b"

Re: Thread safety issue (I think) with defaultdict

2017-11-03 Thread Chris Angelico
On Fri, Nov 3, 2017 at 10:26 PM, Rhodri James wrote: > On 02/11/17 20:24, Chris Angelico wrote: >> >> Thank you. I've had this argument with many people, smart people (like >> Steven), people who haven't grokked that all concurrency has costs - >> that threads

Re: Thread safety issue (I think) with defaultdict

2017-11-03 Thread Chris Angelico
On Sat, Nov 4, 2017 at 2:45 AM, Steve D'Aprano wrote: > So, all else being equal, which is likely to have more bugs? > > > 1. Multiprocessing code with very little coupling between processes; or > > 2. Threaded code with shared data and hence higher coupling between threads? > Obviously, option 1

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

2017-11-03 Thread Chris Angelico
On Sat, Nov 4, 2017 at 3:15 AM, Alexey Muranov wrote: > On Fri, 2017-11-03 at 22:03 +1100, Chris Angelico wrote: >> On Fri, Nov 3, 2017 at 8:48 PM, Alexey Muranov > com> wrote: >> > 'Then' describes what happens next indeed, unless some >> > extraordinar

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

2017-11-03 Thread Chris Angelico
On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie wrote: > On 11/03/2017 07:09 PM, Steve D'Aprano wrote: >> On Sat, 4 Nov 2017 06:15 am, Michael Torrie wrote: >> >>> In fact if you have no break you may as well drop the >>> else entirely, because the block will always execute. >> >> That's incorrect.

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-04 Thread Chris Angelico
On Sat, Nov 4, 2017 at 11:25 PM, Jon Ribbens wrote: > On 2017-11-04, Ben Finney wrote: >> To respond to the criticism of an idea – criticism containing no mention >> of the person – as though it “clearly refers to the [person]”, is of >> significant concern on a software dicussion forum such as t

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

2017-11-04 Thread Chris Angelico
On Sat, Nov 4, 2017 at 11:22 PM, Jon Ribbens wrote: > On 2017-11-04, Michael Torrie wrote: >> On 11/03/2017 09:06 PM, Chris Angelico wrote: >>> On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie wrote: >>>> On 11/03/2017 07:09 PM, Steve D'Aprano wrote: >>

Re: Try: Except: evaluates to True every time

2017-11-04 Thread Chris Angelico
On Sun, Nov 5, 2017 at 2:31 AM, brandon wallace wrote: > > I have this code that tests a server to see if it is listening on port 123 > runs and evaluates to True every time. Even if the server does not exist but > it is not supposed to do that. I am getting no error message at all. What is > g

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

2017-11-05 Thread Chris Angelico
On Mon, Nov 6, 2017 at 11:06 AM, Steve D'Aprano wrote: > On Mon, 6 Nov 2017 10:06 am, Jon Ribbens wrote: > >> On 2017-11-05, Ben Finney wrote: >>> Jon Ribbens writes: I've provided you with a way of thinking about 'for...else' that makes its purpose and meaning intuitively obvious. >>>

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

2017-11-06 Thread Chris Angelico
On Mon, Nov 6, 2017 at 10:34 PM, Jon Ribbens wrote: > On 2017-11-06, Ben Finney wrote: >> Jon Ribbens writes: >>> On 2017-11-05, Ben Finney wrote: >>> > Jon Ribbens writes: >>> >> I've provided you with a way of thinking about 'for...else' that makes >>> >> its purpose and meaning intuitively

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

2017-11-06 Thread Chris Angelico
On Tue, Nov 7, 2017 at 12:05 AM, Jon Ribbens wrote: > On 2017-11-06, Chris Angelico wrote: >> If you start with the assumption that "intuitively obvious" doesn't >> actually mean "intuitively obvious" but actually means something >> completely d

Re: Easiest way to access C module in Python

2017-11-06 Thread Chris Angelico
On Tue, Nov 7, 2017 at 10:43 AM, John Pote wrote: > Hi all, > I have successfully used Python to perform unit and integration tests in the > past and I'd like to do the same for some C modules I'm working with at > work. There seem to be a number of ways of doing this but being busy at work > and

Re: Easiest way to access C module in Python

2017-11-06 Thread Chris Angelico
On Tue, Nov 7, 2017 at 12:52 PM, bartc wrote: > On 07/11/2017 00:58, Chris Angelico wrote: >> >> On Tue, Nov 7, 2017 at 10:43 AM, John Pote >> wrote: >>> >>> Hi all, >>> I have successfully used Python to perform unit and integration tests in >&

Re: Easiest way to access C module in Python

2017-11-07 Thread Chris Angelico
On Tue, Nov 7, 2017 at 10:06 PM, bartc wrote: > On 07/11/2017 02:23, Chris Angelico wrote: >> >> On Tue, Nov 7, 2017 at 12:52 PM, bartc wrote: > > >>> Cython seems very confusing to me. >> >> > >> >>> Otherwise what /I/ would look for

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Chris Angelico
On Wed, Nov 8, 2017 at 4:28 AM, Ian Kelly wrote: > On Sat, Nov 4, 2017 at 6:40 AM, Chris Angelico wrote: >> On Sat, Nov 4, 2017 at 11:25 PM, Jon Ribbens >> wrote: >>> On 2017-11-04, Ben Finney wrote: >>>> To respond to the criticism of an idea – critici

Re: Ideas about how software should behave

2017-11-07 Thread Chris Angelico
On Wed, Nov 8, 2017 at 6:44 AM, Stefan Ram wrote: > Chris Angelico writes: >>sure what your point is. None, False, and True are all keywords, not >>built-ins, so you can't assign to them (any more than you could assign >>to a literal integer). > > |Python 2.6.6 (r

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Chris Angelico
On Wed, Nov 8, 2017 at 8:16 AM, Ian Kelly wrote: > All of these are things that a linter should probably catch and warn > about. If you had said that the break syntax suggestion was a good > idea but probably better suited as a linter warning than as a > SyntaxError integrated into the parser, the

Re: python3 byte decode

2017-11-07 Thread Chris Angelico
On Wed, Nov 8, 2017 at 4:36 PM, Ali Rıza KELEŞ wrote: >> To be more clear here, usually when humans say "identical" they mean having >> exactly the same value or attributes. >> Here, Chris means that the two strings are actually the same object rather >> than

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-08 Thread Chris Angelico
On Thu, Nov 9, 2017 at 3:19 AM, Ian Kelly wrote: > I was not referring to the possible future use of yield from for async > generators; I was referring to the possibility *today* of using "yield > from" as a synonym for *await*. As far as I know the only major > obstacle to that is that the author

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-08 Thread Chris Angelico
On Thu, Nov 9, 2017 at 5:05 AM, Ian Kelly wrote: > On Wed, Nov 8, 2017 at 9:31 AM, Chris Angelico wrote: >> On Thu, Nov 9, 2017 at 3:19 AM, Ian Kelly wrote: >>> I was not referring to the possible future use of yield from for async >>> generators; I was referring to

Re: Ideas about how software should behave

2017-11-08 Thread Chris Angelico
On Thu, Nov 9, 2017 at 5:18 AM, Jon Ribbens wrote: > On 2017-11-08, Ben Finney wrote: >> I also think Jon had cause to bristle somewhat at the characterisation. >> I don't think Jon was attacked by Steve's remark, but I do sympathise >> with the instinct to feel a criticism as an attack. > > Stev

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-08 Thread Chris Angelico
On Thu, Nov 9, 2017 at 5:20 AM, Ian Kelly wrote: > On Wed, Nov 8, 2017 at 11:12 AM, Chris Angelico wrote: >> Except that "yield from" is used by generators to delegate to other >> generators, and "await" is used by coroutines to delegate to other >>

Re: Ideas about how software should behave

2017-11-08 Thread Chris Angelico
On Thu, Nov 9, 2017 at 6:44 AM, Michael Torrie wrote: > This reminds me of a classic video clip from a few years ago. The new > Microsoft "We Share Your Pain" program. > > https://www.youtube.com/watch?v=D28FkfJiauk I've never actually seen this before. That's awesome! Thanks for sharing :) Chr

Re: Ideas about how software should behave

2017-11-08 Thread Chris Angelico
On Thu, Nov 9, 2017 at 9:22 AM, Ben Finney wrote: >> If you call an idea arrogant you are necessarily stating that the >> person espousing the idea is guilty of arrogance - that's what the >> word means. > > Yes: it describes the behaviour. It does not imply characterisation of > the person. > > T

Re: Ideas about how software should behave

2017-11-09 Thread Chris Angelico
On Fri, Nov 10, 2017 at 2:14 AM, Rurpy via Python-list wrote: > On 11/08/2017 11:29 AM, Chris Angelico wrote: >> [...] >> Please, Jon, accept that we were not deliberately trying >> to put you down. Steve, if you can clearly state your position on this >> (possib

Re: Ideas about how software should behave

2017-11-09 Thread Chris Angelico
On Fri, Nov 10, 2017 at 4:00 AM, bartc wrote: > On 09/11/2017 16:33, Chris Angelico wrote: >> >> On Fri, Nov 10, 2017 at 2:14 AM, Rurpy via Python-list >> wrote: >>> >>> On 11/08/2017 11:29 AM, Chris Angelico wrote: >>>> >>>> [...

Re: from xx import yy

2017-11-12 Thread Chris Angelico
On Mon, Nov 13, 2017 at 1:17 PM, bvdp wrote: > I'm having a conceptual mind-fart today. I just modified a bunch of code to > use "from xx import variable" when variable is a global in xx.py. But, when I > change/read 'variable' it doesn't appear to change. I've written a bit of > code to show t

Re: matchpy

2017-11-12 Thread Chris Angelico
On Mon, Nov 13, 2017 at 4:42 PM, Edward Montague wrote: > After successfully installing python 3.6.3 and the appropriate version of > IDLE , > I attempted to run a matchpy example , to no avail . > > I'm using a debian distribution , 8.x or greater , is there something I > need to be aware of .

Re: from xx import yy

2017-11-13 Thread Chris Angelico
On Tue, Nov 14, 2017 at 3:58 AM, bvdp wrote: > Thanks all for confirming that I was wrong to use "from .. import". Hmmm, > perhaps for functions it might be okay. But, in most cases it's a lot more > obvious to use module.function() when calling. Maybe a bit slower, but I'm > sure it's negligib

Re: inspecting a callable for the arguments it accepts

2017-11-14 Thread Chris Angelico
On Wed, Nov 15, 2017 at 8:05 AM, Cameron Simpson wrote: > I know that this isn't generally solvable, but I'm wondering if it is > partially solvable. > > I have a task manager which accepts callables, usually functions or > generators, and calls them on data items as needed. For reasons which, > f

Re: inspecting a callable for the arguments it accepts

2017-11-14 Thread Chris Angelico
On Wed, Nov 15, 2017 at 9:03 AM, Stefan Ram wrote: > Cameron Simpson writes: >>I would like to inspect submitted functions' signatures for suitability at >>submission time, without calling the function. For example to see if this >>function accepts exactly one argument, or to see if it is a gener

Re: inspecting a callable for the arguments it accepts

2017-11-14 Thread Chris Angelico
On Wed, Nov 15, 2017 at 4:34 PM, Gregory Ewing wrote: > Chris Angelico wrote: > >>>>> wants_one_arg.__code__.co_argcount >> >> >> 1 >> >>>>> wants_one_arg.__code__.co_varnames >> >> >> ('x',) >

Re: Should constants be introduced to Python?

2017-11-16 Thread Chris Angelico
On Fri, Nov 17, 2017 at 9:27 AM, Terry Reedy wrote: > CPython, at least, already has anonymous constant objects. Number and > string literals are turned into objects when parsed. I presume that all > implementations do this. Some constant expressions are replaced by > (constant) objects during

Re: Artificial creating of [Lists], is it possible? the best way...

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 2:29 AM, eth0 wrote: > On Fri, 17 Nov 2017 00:04:16 + in comp.lang.python, MRAB said: >> On 2017-11-16 18:47, [email protected] wrote: >> > Hello, im working on school project, its deck game Sorry! >> > I need to create specific lists: >> > My idea is about to usi

Re: "help( pi )"

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 8:27 AM, Gregory Ewing wrote: > It *could* be made to work: > > import math > > class PI(float): > > __doc__ = "The circle constant (Note: tau is better :-)" > > math.pi = PI(math.pi) > > print(math.pi) > help(math.pi) How is THAT an improvemen

Re: "help( pi )"

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 9:38 AM, Cameron Simpson wrote: > I don't think he's arguing that help magicly recognises 3.1415926536 as "pi" > and produces a docstring for it and all "sufficiently close" values. I'm > not. But the math module has bound "pi" to a specific float. Why _can't_ we > annotat

Re: "help( pi )"

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 10:34 AM, Python wrote: > On Sat, Nov 18, 2017 at 09:50:29AM +1100, Chris Angelico wrote: >> Perhaps what we want is not so much "attach docstrings to floats" but >> "get documentation for a module attribute, not for the object referred >

Re: ctypes help

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 9:11 AM, Python wrote: > Hello Pythonistas, > > I'm starting to play with ctypes, as I'd like to provide Python > interfaces to a C/C++ library I have. For now I'm just messing with a > very simple piece of code to get things sorted out. I'm working with > this example C+

Re: "help( pi )"

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 10:35 AM, Stefan Ram wrote: > Dennis Lee Bieber writes: >>should >> help(3.1415926536) #or whatever precision is used in >> module math >>produce anything? > > That question made me try something else whose output > surprises me: > > |Python 3.7.0 .

Re: "help( pi )"

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 2:12 PM, Python wrote: > On Sat, Nov 18, 2017 at 10:47:55AM +1100, Chris Angelico wrote: >> On Sat, Nov 18, 2017 at 10:34 AM, Python wrote: >> > On Sat, Nov 18, 2017 at 09:50:29AM +1100, Chris Angelico wrote: >> >> Perhaps what we want is not

Re: "help( pi )"

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 2:38 PM, Python wrote: > On Sat, Nov 18, 2017 at 02:19:25PM +1100, Chris Angelico wrote: >> On Sat, Nov 18, 2017 at 2:12 PM, Python wrote: >> > On Sat, Nov 18, 2017 at 10:47:55AM +1100, Chris Angelico wrote: >> >> On Sat, Nov 18, 2

Re: Python dos2unix one liner

2017-11-18 Thread Chris Angelico
On Sat, Nov 18, 2017 at 9:42 PM, wrote: > Hello, > > I need to perform a tp on semaphores and shared segments of memory, but I > have a bit of trouble with the first notion. A tp? Sorry, not something I'm familiar with. > We are asked here to use only the IPC system 5 objects that are the shar

Re: __hash__ and ordered vs. unordered collections

2017-11-20 Thread Chris Angelico
On Tue, Nov 21, 2017 at 4:47 AM, Josh B. wrote: > Now for the question: Is this useful? I ask because this leads to the > following behavior: > unordered = MyColl([1, 2, 3]) ordered = MyOrderedColl([3, 2, 1]) s = {ordered, unordered} len(s) > 1 s = {ordered} unordere

Re: How to Generate dynamic HTML Report using Python

2017-11-20 Thread Chris Angelico
On Tue, Nov 21, 2017 at 5:47 AM, Michael Torrie wrote: > You also have this header set: >> X-Copyright: (C) Copyright 2017 Stefan Ram. All rights reserved. >> Distribution through any means other than regular usenet >> channels is forbidden. It is forbidden to publish this >> article in the world

Re: __hash__ and ordered vs. unordered collections

2017-11-20 Thread Chris Angelico
On Tue, Nov 21, 2017 at 6:50 AM, Josh B. wrote: > On Monday, November 20, 2017 at 1:55:26 PM UTC-5, Chris Angelico wrote: >> But what you have is the strangeness of non-transitive equality, which >> is likely to cause problems. > > But this is exactly how Python's bui

Re: "help( pi )"

2017-11-21 Thread Chris Angelico
On Wed, Nov 22, 2017 at 4:47 PM, Gregory Ewing wrote: > Cameron Simpson wrote: >> >> one could change implementations such that applying a docstring to an >> object _removed_ it from the magic-shared-singleton pool, > > > That's not sufficient, though. Consider: > >BUFFER_SIZE = 256 >BUF

Re: How to Generate dynamic HTML Report using Python

2017-11-21 Thread Chris Angelico
On Wed, Nov 22, 2017 at 4:10 PM, Gregory Ewing wrote: > Michael Torrie wrote: >> >> You also have this header set: >> >>> X-Copyright: (C) Copyright 2017 Stefan Ram. All rights reserved. >>> ... It is forbidden to change >>> URIs of this article into links... > > > What is "changing a URI into a l

Re: Python loop and web server (bottle) in the same script

2017-11-23 Thread Chris Angelico
On Fri, Nov 24, 2017 at 1:27 AM, wrote: > I would like to have a script that collects data every minute and at the same > time serve newly collected data as web pages. > > Timely collecting data is more important than serving web pages, so > collecting data should have priority and should never

Re: Allow additional separator character in variables

2017-11-23 Thread Chris Angelico
On Fri, Nov 24, 2017 at 1:39 AM, Mikhail V wrote: > Chris A wrote: > > On Fri, Nov 24, 2017 at 1:10 AM, Mikhail V wrote: >> >> > Well, then there is some bitter irony in this, so it allows pretty >> > much everything, >> > but does not allow me to be

Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-11-23 Thread Chris Angelico
On Fri, Nov 24, 2017 at 5:42 AM, Mikhail V wrote: > Chris A wrote: > >>> On Fri, Nov 24, 2017 at 1:10 AM, Mikhail V wrote: >>> >>>> Chris A wrote: >>>> >>>> Fortunately for the world, you're not the one who decided which >>

Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-11-23 Thread Chris Angelico
On Fri, Nov 24, 2017 at 7:38 AM, Mikhail V wrote: > I see you manually 'optimise' the look? > I personally would end with something like this: > > def zip_longest(*A, **K): > value = K.get ('fillvalue') > count = len(a) - 1 > def sentinel(): > nonlocal count > if not co

Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-11-23 Thread Chris Angelico
On Fri, Nov 24, 2017 at 8:02 AM, Mikhail V wrote: > On Thu, Nov 23, 2017 at 9:39 PM, Chris Angelico wrote: >> On Fri, Nov 24, 2017 at 7:38 AM, Mikhail V wrote: >>> I see you manually 'optimise' the look? >>> I personally would end with something like

Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-11-23 Thread Chris Angelico
On Fri, Nov 24, 2017 at 8:19 AM, Richard Damon wrote: > On 11/23/17 2:46 PM, Thomas Jollans wrote: >> >> On 23/11/17 19:42, Mikhail V wrote: >>> >>> I mean for a real practical situation - for example for an average >>> Python programmer or someone who seeks a programmer job. >>> And who does not

Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-11-23 Thread Chris Angelico
On Fri, Nov 24, 2017 at 1:44 PM, Mikhail V wrote: > From my above example, you could probably see that I prefer somewhat > middle-sized identifiers, one-two syllables. And naturally, they tend to > reflect some process/meaining, it is not always achievable, > but yes there is such a natural tenden

Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-11-23 Thread Chris Angelico
On Fri, Nov 24, 2017 at 2:52 PM, Mikhail V wrote: > On Fri, Nov 24, 2017 at 4:13 AM, Chris Angelico wrote: >> On Fri, Nov 24, 2017 at 1:44 PM, Mikhail V wrote: >>> From my above example, you could probably see that I prefer somewhat >>> middle-sized identifiers, one-t

Re: connect four (game)

2017-11-24 Thread Chris Angelico
On Sat, Nov 25, 2017 at 2:33 AM, wrote: > hi all > > i've just finished my first excursion into artificial intelligence with a > game less trivial than tictactoe, and here it is in case anybody can offer > criticism/suggestions/etc > Hi! You don't have a lot of comments or docstrings or anyth

Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-11-24 Thread Chris Angelico
On Sat, Nov 25, 2017 at 3:33 AM, Mikhail V wrote: > On Fri, Nov 24, 2017 at 8:03 AM, Chris Angelico wrote: > >>> and in Python in particular, because they will be not only forced to learn >>> some english, but also will have all 'pleasures' of multi-script e

Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-11-24 Thread Chris Angelico
On Sat, Nov 25, 2017 at 7:00 AM, Mikhail V wrote: > I agree that one should have more choices, but > people still can't really choose many things. > I can't choose hyphen, I can't choose minus sign, > and many tech people would probably want more operators. > It counts probably not so *big* amount

Re: connect four (game)

2017-11-24 Thread Chris Angelico
On Sat, Nov 25, 2017 at 1:05 PM, wrote: > On Friday, November 24, 2017 at 12:13:18 PM UTC-8, Terry Reedy wrote: > >> Since you did not start with tests or write tests as you wrote code, ... > > why on earth would you assume that? instantiate "window" and you'll see it > works exactly as i intend

Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-11-25 Thread Chris Angelico
On Sat, Nov 25, 2017 at 11:33 PM, Rustom Mody wrote: > Personally I feel that there should be a law against languages that disallow > the creation of magic tricks!¡! I agree. The programming language should also ensure that your program will terminate eventually, that it is bug-free (this can act

Re: connect four (game)

2017-11-25 Thread Chris Angelico
On Sun, Nov 26, 2017 at 3:36 AM, Ian Kelly wrote: > On Sat, Nov 25, 2017 at 6:00 AM, bartc wrote: >> Where are your unittests for these unittests? > > No, the point of having unit tests is to build confidence that the > code in question works correctly. It's *possible* that the code is > broken,

<    37   38   39   40   41   42   43   44   45   46   >