Re: Saying bye bye to Python 2

2020-01-11 Thread Marko Rauhamaa
tommy yama : > As many know, python 2 was retired.  > This means imminent migration to 3 will be a must ? Python 2 will have a lively retirement. It won't be dead before RHEL 7 is dead. According to https://access.redhat.com/support/policy/updates/errata the support dates for RHEL 7 are:

Re: Coding technique: distinguish using type or abc?

2020-01-09 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): > if type( object ) is list: I would recommend isinstance() because: >>> isinstance(True, int) True >>> type(True) is int False Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Python, Be Bold!

2020-01-04 Thread Marko Rauhamaa
Greg Ewing : > You can pass a zip file with a .pyz extension to the python > interpreter and it will look for a __main__.py file and run > it. This discussion has been interesting, and I've now learned about zipapp. This is really nice and will likely be a favorite distribution format for Python

Re: Use epoll but still lose packet

2019-11-20 Thread Marko Rauhamaa
Dennis Lee Bieber : > (though as I don't really understand the use of this function, that > may just mean that all the events will be in the one return structure, > and not that there is only one event). I use epoll almost every day. You've done a good job explaining it. > Given that your

Re: Using Makefiles in Python projects

2019-11-12 Thread Marko Rauhamaa
Rhodri James : > On 11/11/2019 19:05, Bill Deegan wrote: >> You could use SCons (native python... ) > > I could. But I'd have to learn how to first, and particularly for > complex cross-platform working that involves learning a lot of stuff I > already know how to do in Make. The time investment

Re: Using Makefiles in Python projects

2019-11-08 Thread Marko Rauhamaa
Skip Montanaro : > On Thu, Nov 7, 2019 at 1:24 PM Vitaly Potyarkin wrote: >> >> What do you think of using Makefiles for automating common chores in >> Python projects? Like linting, type checking and testing? > > Kinda unsure why this needs to be asked (says the guy who's used Make > longer

Re: Artifact repository?

2019-10-31 Thread Marko Rauhamaa
Dan Stromberg : > Can anyone please recommend an opensource "Artifact Repository" suitable > for use with CPython, including dozens of wheels, tar.gz's and .py's? > > By an Artifact Repository, I mean something that can version largish > binaries that are mostly produced by a build process. > > It

Re: Boolean comparison & PEP8

2019-07-28 Thread Marko Rauhamaa
Jonathan Moules : > Lets say I want to know if the value of `x` is bool(True). > My preferred way to do it is: > > if x is True: > [...] > > But this appears to be explicitly called out as being "Worse" in PEP8: > > [...] > > Why? It has primarily to do with the naturalness of expression. In

Re: Definite or indefinite article for non-singletons?

2019-07-28 Thread Marko Rauhamaa
Ethan Furman : > On 07/27/2019 02:10 PM, Chris Angelico wrote: >> When talking about indistinguishable objects, is it correct to talk >> about "the " or "an "? > > Multiple indistinguishable objects are still multiple, so "an". > > Implementation details should only enter the conversation when >

Re: PEP 594 cgi & cgitb removal

2019-05-25 Thread Marko Rauhamaa
Jon Ribbens : > On 2019-05-25, Michael Torrie wrote: >> Not really. Serverless just means stateless web-based remote >> procedure calls. This is by definition what CGI is. > > No, it isn't. CGI is a specific API and method of calling a program in > order to serve a web request. It isn't a

Re: PEP 594 cgi & cgitb removal

2019-05-24 Thread Marko Rauhamaa
Paul Rubin : > Stéphane Wirtel writes: >> Not a massive effort, but we are limited with the resources. > > I keep hearing that but it makes it sound like Python itself is in > decline. That is despite the reports that it is now the most popular > language in the world. It also makes me ask why

Re: Class Issue`

2019-03-06 Thread Marko Rauhamaa
Rhodri James : > On 06/03/2019 14:15, Calvin Spealman wrote: >>> C++ (a language I have no respect for) >> This was uncalled for and inappropriate. Please keep discord civil. > > That was the civil version :-) C++ is a programming language without feelings. It's nobody's ethnicity, sexual

Re: Lifetime of a local reference

2019-02-28 Thread Marko Rauhamaa
Roel Schroeven : > In the absence of any other mention of bindings being removed, to me > it seems clear that bindings are not automatically removed. Otherwise > many things become ambiguous. Example: the documentation for dicts > defines "d[key] = value" as "Set d[key] to value". Does that mean

Re: Lifetime of a local reference

2019-02-28 Thread Marko Rauhamaa
Chris Angelico : > What if an exception gets raised at some point before the function has > returned? The exception object will give full access to the function's > locals. It wouldn't hurt for the Python gods to make an explicit ruling on the matter. Marko --

Re: Lifetime of a local reference

2019-02-28 Thread Marko Rauhamaa
Alan Bawden : > Gregory Ewing writes: > >> Alan Bawden wrote: >> > the Java Language >> > Specification contains the following language: >> >Optimizing transformations of a program can be designed that reduce >> >the number of objects that are reachable to be less than those which >> >

Re: Lifetime of a local reference

2019-02-27 Thread Marko Rauhamaa
Rhodri James : > On 27/02/2019 06:56, Marko Rauhamaa wrote: >> Then there's the question of a sufficient way to prevent premature >> garbage collection: >> >> def fun(): >> f = open("lock") >> flock.flock(f, fcntl.LOCK

Re: Lifetime of a local reference

2019-02-26 Thread Marko Rauhamaa
Alan Bawden : > Marko Rauhamaa writes: >> def fun(): >> f = open("lock") >> flock.flock(f, fcntl.LOCK_EX) >> do_stuff() >> sys.exit(0) >> >> Question: can a compliant Python implementation close f (an

Lifetime of a local reference

2019-02-26 Thread Marko Rauhamaa
Consider this function: def fun(): f = open("lock") flock.flock(f, fcntl.LOCK_EX) do_stuff() sys.exit(0) Question: can a compliant Python implementation close f (and, consequently, release the file lock) before/while do_stuff() is executed? I couldn't find

Re: Why float('Nan') == float('Nan') is False

2019-02-13 Thread Marko Rauhamaa
"Avi Gross" : > A NaN is a bit like a black hole. Anything thrown in disappears and > that is about all we know about it. No two black holes are the same > even if they seem to have the same mass, spin and charge. All they > share is that we don't know what is in them. Then, how do you explain:

Re: with exceptions?

2018-12-19 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): > try: > with open( 'file', 'r' ) as f: > use( f ) > except Exception as inst: > print( inst ) > > Is target code the correct way to use »with« with together > with »except«? > > Or is it recommended to continue to use »finally« in such

Re: multiple JSON documents in one file, change proposal

2018-12-01 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Dec 1, 2018 at 10:16 PM Marko Rauhamaa wrote: >> and the framing format is HTTP. I will need to type something like this: >> >>POST / HTTP/1.1^M >>Host: localhost^M >>Content-type: application/json^M &g

Re: multiple JSON documents in one file, change proposal

2018-12-01 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Dec 1, 2018 at 9:16 PM Marko Rauhamaa wrote: >> The need for the format to be "typable" (and editable) is essential >> for ad-hoc manual testing of components. That precludes all framing >> formats that would necessitate a length pr

Re: multiple JSON documents in one file, change proposal

2018-12-01 Thread Marko Rauhamaa
Paul Rubin : > Marko Rauhamaa writes: >> Having rejected different options (> https://en.wikipedia.org/wiki/JSON_streaming>), I settled with >> terminating each JSON value with an ASCII NUL character, which is >> illegal in JSON proper. > > Thanks, that Wikipedi

Re: multiple JSON documents in one file, change proposal

2018-11-30 Thread Marko Rauhamaa
Paul Rubin : > Maybe someone can convince me I'm misusing JSON but I often want to > write out a file containing multiple records, and it's convenient to > use JSON to represent the record data. > > The obvious way to read a JSON doc from a file is with "json.load(f)" > where f is a file handle.

Re: Enums: making a single enum

2018-11-17 Thread Marko Rauhamaa
Ian Kelly : > On Fri, May 25, 2018 at 11:00 PM, Chris Angelico wrote: >> On Sat, May 26, 2018 at 2:46 PM, Steven D'Aprano >>> class State(Enum): >>> Maybe = 2 >> >> # Tri-state logic >> Maybe = object() > > The enum has a nice __str__ though. That's why I usually use string sentinels:

Re: @staticmethod or def function()?

2018-10-31 Thread Marko Rauhamaa
Peter Otten <__pete...@web.de>: > Do not make changes to your code only to apeace a linter. Precisely. Don't let a tool drive a show. > Regarding more the general question, should I use an instance method, > a class method, a static method, or a function? -- that is hard to > answer without an

Re: Accessing clipboard through software built on Python

2018-10-27 Thread Marko Rauhamaa
Musatov : > I work from a web database of users and I continually have to copy email > address and user ID to two separate fields on a Salesforce.com page. > > I go to the webpage, highlight email address then copy. > Then go to Salesforce page, and paste. > Then go back to the webpage, then copy

Re: Accessing clipboard through software built on Python

2018-10-27 Thread Marko Rauhamaa
Michael Torrie : > As far as I know it's not possible for an application to directly yank > highlighted text from another application. That's an age-old pattern in X11. I don't know if Wayland supports it. Application 1 holds a selection (usually highlighted) and Application 2 wants to copy the

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

2018-10-21 Thread Marko Rauhamaa
pjmcle...@gmail.com: > not sure why utf-8 gives an error when thats the most wide all caracters > inclusive right?/ Not all sequences of bytes are legal in UTF-8. For example, >>> b'\x80'.decode("utf-8") Traceback (most recent call last): File "", line 1, in UnicodeDecodeError:

Re: PEP 394

2018-10-19 Thread Marko Rauhamaa
Thomas Jollans : > On 2018-10-19 12:06, Marko Rauhamaa wrote: >> Anders Wegge Keller : >>> * python3 will refer to some version of Python 3.x. >> >> Untrue for macOS, ArchLinux, RHEL and CentOS. > > Sure it's true for *EL (it's just that python3 might not b

Re: PEP 394

2018-10-19 Thread Marko Rauhamaa
Anders Wegge Keller : > * python2 will refer to some version of Python 2.x. Untrue for macOS. > * python3 will refer to some version of Python 3.x. Untrue for macOS, ArchLinux, RHEL and CentOS. > * for the time being, all distributions should ensure that python, if > installed, refers to the

Re: ESR "Waning of Python" post

2018-10-17 Thread Marko Rauhamaa
Paul Rubin : > Marko Rauhamaa writes: >> Emacs occasionally hangs for about a minute to perform garbage >> collection. > > I've never experienced that, especially with more recent versions that I > think do a little bit of heap tidying in the background. Even in

Re: ESR "Waning of Python" post

2018-10-16 Thread Marko Rauhamaa
Paul Rubin : > But it's possible to do parallel GC with bounded latency. Perry > Cheng's 2001 PhD thesis says how to do it and is fairly readable: > > http://reports-archive.adm.cs.cmu.edu/anon/2001/CMU-CS-01-174.pdf Thanks. On a quick glance, it is difficult to judge what the worst-case time

Re: ESR "Waning of Python" post

2018-10-16 Thread Marko Rauhamaa
Paul Rubin : > Marko Rauhamaa writes: >>> Right, if I need near realtime behaviour and must live >>> with [C]Python's garbage collector. >> Or any other GC ever invented. > > There are realtime ones, like the Azul GC for Java, that have bounded > delay in

Re: Python indentation (3 spaces)

2018-10-15 Thread Marko Rauhamaa
Rhodri James : > On 15/10/18 12:28, Marko Rauhamaa wrote: >> Try running >> >> emacs -q abc.c >> >> and observe the indentation depth. > > """User Option: c-basic-offset > > This style variable holds the basic offset betw

Re: Python indentation (3 spaces)

2018-10-15 Thread Marko Rauhamaa
Rhodri James : > On 15/10/18 05:45, Marko Rauhamaa wrote: >> The two-space indentation is the out-of-the-box default for emacs. > > Ahem. It's the default for certain C styles. It's not even the default > for C-mode itself, which is 4. You must be running a different version

Re: ESR "Waning of Python" post

2018-10-15 Thread Marko Rauhamaa
dieter : > Marko Rauhamaa writes: >> Keeping the number of long-term objects low is key. > > Right, if I need near realtime behaviour and must live > with [C]Python's garbage collector. Or any other GC ever invented. > But, a web application does usually not need ne

Re: Python indentation (3 spaces)

2018-10-15 Thread Marko Rauhamaa
Chris Angelico : > On Mon, Oct 15, 2018 at 3:51 PM Marko Rauhamaa wrote: > I don't understand your point here. It prints a letter, then some > spaces, then a tab, then another letter. On my terminal, that displays > the tab by advancing to the next tab position. If I highlight to &g

Re: Python indentation (3 spaces)

2018-10-14 Thread Marko Rauhamaa
Chris Angelico : > I'm saying I have never seen is this: > > On Mon, Oct 15, 2018 at 8:56 AM Marko Rauhamaa wrote: >> However, it is trumped by an older >> convention whereby the indentation levels go as follows: >> >>0: >>1: SPC SPC >>2:

Re: Python indentation (3 spaces)

2018-10-14 Thread Marko Rauhamaa
Chris Angelico : > Tabs for indentation have semantic meaning. Top-level has zero tabs. > One indentation level is represented by one tab. Two indentation > levels? Two tabs. It's about as perfect a representation as you could > hope for. If you like your indentation levels to be as wide as four

Re: ESR "Waning of Python" post

2018-10-13 Thread Marko Rauhamaa
Paul Rubin : > Note that Java has a lot of [GC] options to choose from: > https://docs.oracle.com/javase/9/gctuning/available-collectors.htm I'm all for GC, but Java's GC tuning options are the strongest counter-argument against it. The options just shift the blame from the programming language

Re: ESR "Waning of Python" post

2018-10-13 Thread Marko Rauhamaa
dieter : > Marko Rauhamaa writes: >> However, I challenge the notion that creating hundreds of thousands of >> temporary objects is stupid. I suspect that the root cause of the >> lengthy pauses is that the program maintains millions of *nongarbage* >> obj

Re: ESR "Waning of Python" post

2018-10-12 Thread Marko Rauhamaa
dieter : > Every system you use has its advantages and its drawbacks. > Depending on the specific context (problem, resources, knowledge, ...), > you must choose an appropriate one. Yep. I use Python for numerous tasks professionally and at home. Just this past week I used it to plan a junior

Re: Python indentation (3 spaces)

2018-10-08 Thread Marko Rauhamaa
Thomas Jollans : > On 08/10/2018 08:31, Marko Rauhamaa wrote: >> Where I work (and at home), the only control character that is allowed >> in source code is LF. > > No tolerance for form feeds? None whatsoever. CR is ok but only if immediately followed by BEL. That way typ

Re: Python indentation (3 spaces)

2018-10-08 Thread Marko Rauhamaa
Chris Angelico : > How wide my indents are on my screen shouldn't influence your screen > or your choices. Where I work (and at home), the only control character that is allowed in source code is LF. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: How to await multiple replies in arbitrary order (one coroutine per reply)?

2018-10-06 Thread Marko Rauhamaa
Russell Owen : > I think what I'm looking for is a task-like thing I can create that I > can end when *I* say it's time to end, and if I'm not quick enough > then it will time out gracefully. But maybe there's a simpler way to > do this. It doesn't seem like it should be difficult, but I'm

Re: [OT] master/slave debate in Python

2018-09-26 Thread Marko Rauhamaa
Ian Kelly : > The terminology should be changed because it's offensive, full stop. > It may be normalized to many who are accustomed to it, but that > doesn't make it any less offensive. > > Imagine if the terminology were instead "dominant / submissive". > Without meaning to assume too much,

Re: Object-oriented philosophy

2018-09-11 Thread Marko Rauhamaa
Rick Johnson : > Michael F. Stemper wrote: >> Object-oriented philosophy > [...] [...] [...] > > So, to make a long story short, you may want to do some > googling... Long story short, Michael, Rick is a masterful troll extraordinaire. Highly amusing when you're in the mood. Marko --

Re: Any SML coders able to translate this to Python?

2018-09-07 Thread Marko Rauhamaa
Marko Rauhamaa : > def f(n): > def auxf1(sum, m, i): > if i == n: > return sum > else: > def auxf2(sum, m, i): > if sum % m == 0: > re

Re: Any SML coders able to translate this to Python?

2018-09-07 Thread Marko Rauhamaa
Paul Moore : > On Fri, 7 Sep 2018 at 15:10, Paul Moore wrote: >> >> On Fri, 7 Sep 2018 at 14:06, Steven D'Aprano >> wrote: >> > However I have a follow up question. Why the "let" construct in the >> > first place? Is this just a matter of principle, "put everything in >> > its own scope as a

Re: don't quite understand mailing list

2018-09-06 Thread Marko Rauhamaa
mm0fmf : > On 06/09/2018 21:06, Ethan Furman wrote: >> On 09/06/2018 12:42 PM, Reto Brunner wrote: >>> What do you think the link, which is attached to every email you >>> receive from the list, is for? Listinfo sounds very promising, >>> doesn't it? >>> >>> And if you actually go to it you'll

Re: Object-oriented philosophy

2018-09-06 Thread Marko Rauhamaa
"Michael F. Stemper" : > Since the three classes all had common methods (by design), I > thought that maybe refactoring these three classes to inherit from > a parent class would be beneficial. I went ahead and did so. > (Outlines of before and after are at the end of the post.) > > Net net is

Re: Any SML coders able to translate this to Python?

2018-09-06 Thread Marko Rauhamaa
Chris Angelico : > The request was to translate this into Python, not to slavishly > imitate every possible semantic difference even if it won't actually > affect behaviour. I trust Steven to be able to refactor the code into something more likable. His only tripping point was the meaning of the

Re: Any SML coders able to translate this to Python?

2018-09-06 Thread Marko Rauhamaa
Chris Angelico : > On Thu, Sep 6, 2018 at 6:44 PM, Marko Rauhamaa wrote: > And even more idiomatically, Python doesn't require a new scope just > for a new variable. So a much more idiomatic translation would be to > simply ensure that the inner variable can't collide, and

Re: Any SML coders able to translate this to Python?

2018-09-06 Thread Marko Rauhamaa
Chris Angelico : > On Thu, Sep 6, 2018 at 2:29 PM, Marko Rauhamaa wrote: >> Marko Rauhamaa (Marko Rauhamaa): >>> Steven D'Aprano : >>>> I have this snippet of SML code which I'm trying to translate to Python: >>>> >>>> fun isqrt n = if n=

Re: Any SML coders able to translate this to Python?

2018-09-05 Thread Marko Rauhamaa
Marko Rauhamaa (Marko Rauhamaa): > Steven D'Aprano : >> I have this snippet of SML code which I'm trying to translate to Python: >> >> fun isqrt n = if n=0 then 0 >> else let val r = isqrt (n/4) >> in >>

Re: Any SML coders able to translate this to Python?

2018-09-05 Thread Marko Rauhamaa
Steven D'Aprano : > I have this snippet of SML code which I'm trying to translate to Python: > > fun isqrt n = if n=0 then 0 > else let val r = isqrt (n/4) > in > if n < (2*r+1)^2 then 2*r > else 2*r+1 > end

Re: Any SML coders able to translate this to Python?

2018-09-04 Thread Marko Rauhamaa
Steven D'Aprano : > I have this snippet of SML code which I'm trying to translate to Python: > > fun isqrt n = if n=0 then 0 > else let val r = isqrt (n/4) > in > if n < (2*r+1)^2 then 2*r > else 2*r+1 > end

Re: bytes() or .encode() for encoding str's as bytes?

2018-08-31 Thread Marko Rauhamaa
Malcolm Greene : > Is there a benefit to using one of these techniques over the other? > Is one approach more Pythonic and preferred over the other for > style reasons? > message = message.encode('UTF-8') > message = bytes(message, 'UTF-8') I always use the former. I wonder why that is. I guess

Re: Pylint false positives

2018-08-21 Thread Marko Rauhamaa
Gregory Ewing : > Marko Rauhamaa wrote: >> Lexically, there is special access: >> >>class C: >>def __init__(self, some, arg): >>c = self >>class D: >>def method(self): >>

Re: Pylint false positives

2018-08-20 Thread Marko Rauhamaa
Dan Sommers : > On Mon, 20 Aug 2018 14:39:38 +, Steven D'Aprano wrote: >> I have often wished Python had proper namespaces, so I didn't have to >> abuse classes as containers in this way :-( >> >> (Not that I do this using "inner classes", but I do often want to use >> a class as a container

Re: Pylint false positives

2018-08-20 Thread Marko Rauhamaa
Steven D'Aprano : > On Mon, 20 Aug 2018 11:40:16 +0300, Marko Rauhamaa wrote: > >>class C: >>def __init__(self, some, arg): >>c = self >>class D: >>def method(self): >>a

Re: Writing bytes to stdout reverses the bytes

2018-08-20 Thread Marko Rauhamaa
Thomas Jollans : > On 2018-08-20 04:22, Chris Angelico wrote: >> On Mon, Aug 20, 2018 at 12:01 PM, Grant Edwards >> wrote: >>> On 2018-08-20, Ben Bacarisse wrote: It is if you run it as hd. >>> What do you mean "run it as hd"? >>> I don't have an "hd" in my path. >> Your system is

Re: Pylint false positives

2018-08-20 Thread Marko Rauhamaa
Gregory Ewing : > Marko Rauhamaa wrote: >> Some of these chores are heavier, some of them are lighter. But where >> I have used Python, performance hasn't been a bottleneck. It it were, >> I'd choose different approaches of implementation. > > The point is that creatin

Re: Pylint false positives

2018-08-20 Thread Marko Rauhamaa
Gregory Ewing : > Marko Rauhamaa wrote: >> At least some of the methods of inner classes are closures (or there >> would be no point to an inner class). > > In Python there is no such thing as an "inner class" in the Java > sense. You can nest class statements,

Re: Pylint false positives

2018-08-19 Thread Marko Rauhamaa
Chris Angelico : > On Sun, Aug 19, 2018 at 11:54 PM, Marko Rauhamaa wrote: >>> 3) Every invocation of method() has to execute the class body, which >>> takes time. >> >> That's what happens with every method invocation in Python regardless. > > No. You

Re: Pylint false positives

2018-08-19 Thread Marko Rauhamaa
Chris Angelico : > On Sun, Aug 19, 2018 at 10:28 PM, Marko Rauhamaa wrote: >> The most useful use of inner classes is something like this: >> >> class Outer: >> def method(self): >> outer = self >> >> class

Re: Pylint false positives

2018-08-19 Thread Marko Rauhamaa
Steven D'Aprano : > On Sun, 19 Aug 2018 11:43:44 +0300, Marko Rauhamaa wrote: >> At least some of the methods of inner classes are closures (or there >> would be no point to an inner class). > > [...] > > (2) Whether or not the methods of an inner class are closure

Re: printing to stdout

2018-08-19 Thread Marko Rauhamaa
richard lucassen : > As I'm new to Python, just this question: are there any unPythony > things in this code? Your code looks neat. > except IOError: > print ("[ALERT] I/O problem device 0x%x" % list_pcf[i]) Just double check that simply printing the alert is the correct recovery

Re: Pylint false positives

2018-08-19 Thread Marko Rauhamaa
Chris Angelico : > On Sun, Aug 19, 2018 at 9:03 AM, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> *headscratch* >>> >>> So this is okay: >>> >>> def f(): >>> for i in range(5): >>> def g(): ... >>

Re: Pylint false positives

2018-08-19 Thread Marko Rauhamaa
Steven D'Aprano : > On Sun, 19 Aug 2018 00:11:30 +0300, Marko Rauhamaa wrote: > >> In Python programming, I mostly run into closures through inner classes >> (as in Java). > > Inner classes aren't closures. At least some of the methods of inner classes are closures (or

Re: Pylint false positives

2018-08-18 Thread Marko Rauhamaa
Chris Angelico : > *headscratch* > > So this is okay: > > def f(): > for i in range(5): > def g(): ... > > But this isn't: > > class C: > for i in range(5): > def m(self): ... > > I've missed something here. No, you got it right. Marko --

Re: Pylint false positives

2018-08-18 Thread Marko Rauhamaa
Chris Angelico : > Your acceptance of closures is a perfect proof of how magic stops > looking like magic once you get accustomed to it. Actually, that's a very good observation. You should stick with a smallish kernel of primitives and derive the universe from them. Anyway, functions as

Re: Pylint false positives

2018-08-18 Thread Marko Rauhamaa
Steven D'Aprano : >> In a word, steer clear of metaprogramming. > > [...] > (2) if you mean what you say, that means no decorators, Correct. I don't find decorators all that useful or tasteful. > no closures, Closures I consider ordinary programming. Nothing meta there. > no introspection

Re: Pylint false positives

2018-08-17 Thread Marko Rauhamaa
Chris Angelico : > Programming is heavily about avoiding duplicated work. That is one aspect, but overcondensing and overabstracting programming logic usually makes code less obvious to its maintainer. It is essential to find coding idioms that communicate ideas as clearly as possible. In some

Re: >< swap operator

2018-08-14 Thread Marko Rauhamaa
skybuck2...@hotmail.com: > On Monday, August 13, 2018 at 10:01:37 PM UTC+2, Léo El Amri wrote: >> On 13/08/2018 21:54, skybuck2...@hotmail.com wrote: >> > I just had a funny idea how to implement a swap operator for types: >> > >> > A >< B >> > >> > would mean swap A and B. >> >> I think that:

Re: Non-unicode file names

2018-08-09 Thread Marko Rauhamaa
INADA Naoki : > For Python 3.6, I think best way to allow arbitrary bytes on stdout is > using `PYTHONIOENCODING=utf-8:surrogateescape` environment variable. Good info! Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: RFC -- custom operators

2018-08-07 Thread Marko Rauhamaa
Steven D'Aprano : > (1) This proposal requires operators to be legal identifiers, > such as "XOR" or "spam", not punctuation like % and > absolutely not Unicode symbols like ∉ Oh, that's a let-down. Operator symbols get their expressive value from visual conciseness: life←{↑1 ⍵∨.∧3

Re: Checking whether type is None

2018-07-26 Thread Marko Rauhamaa
Steven D'Aprano : > On Wed, 25 Jul 2018 16:14:18 +, Schachner, Joseph wrote: >> thing is None looks just as odd to me. Why not thing == None ? That >> works. > > It is wrong (in other words, it doesn't work) because it allows > non-None objects to masquerade as None and pretend to be what they

Re: coding style - where to declare variables

2018-07-23 Thread Marko Rauhamaa
Steven D'Aprano : > Lambda calculus has the concept of a binding operator, which is > effectively an assignment operator: it takes a variable and a value > and binds the value to the variable, changing a free variable to a > bound variable. In other words, it assigns the value to the variable, >

Re: coding style - where to declare variables

2018-07-23 Thread Marko Rauhamaa
Ben Finney : > Gregory Ewing writes: > >> Marko is asking us to stop using the word "binding" to refer to >> assignment because of the potential confusion with this other meaning. > > That's about as reasonable as my request that we stop using the term > “variable” for what is, in Python, an

Re: coding style - where to declare variables

2018-07-23 Thread Marko Rauhamaa
Dennis Lee Bieber : > On Mon, 23 Jul 2018 00:08:00 +0300, Marko Rauhamaa > declaimed the following: > >>I Java terms, all Python values are boxed. That's a very usual pattern >>in virtually all programming languages (apart from FORTRAN). > > FORTRAN, C, COBOL,

Re: coding style - where to declare variables

2018-07-22 Thread Marko Rauhamaa
Richard Damon : >> On Jul 22, 2018, at 3:50 PM, Marko Rauhamaa wrote: >> I wish people stopped talking about "name binding" and "rebinding," >> which are simply posh synonyms for variable assignment. Properly, the >> term "binding" comes fro

Re: coding style - where to declare variables

2018-07-22 Thread Marko Rauhamaa
Bart : > If you did need one of those others to be variable, then you just assign > it to a variable the rare times you need to do that. For example: > > def fn1(): pass > def fn2(): pass > > fn = fn1 if cond else fn2 > > fn1, fn2 will always be functions. fn will always be a variable, but

Re: coding style - where to declare variables

2018-07-22 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): >>Rebinding names is near-universal in programming, but usually names >>that are intended to be rebound, such as variables. > > To someone like me who has grown up with a LISP 1 > this is completely natural. > > |>( SETQ A ( LAMBDA () 'ALPHA )) > |(LAMBDA

Re: [OT] Bit twiddling homework

2018-07-20 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Jul 21, 2018 at 1:14 AM, Grant Edwards > wrote: >> I refuse to believe there's an extant processor in common use where >> an ADD is faster than an OR unless somebody shows me the processor >> spec sheet. > > "Faster than"? I'd agree with you. But "as fast as"? I

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

2018-07-18 Thread Marko Rauhamaa
Antoon Pardon : > On 17-07-18 14:22, Marko Rauhamaa wrote: >> If you assume that NFC normalizes every letter to a single codepoint >> (and carefully use NFC everywhere), you are right. But equally likely >> you may inadvertently be setting yourself up for a surprise. > &

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

2018-07-17 Thread Marko Rauhamaa
MRAB : > "ch" usually represents 2 phonemes, basically the sounds of "t" > followed by "sh"; Traditionally, that sound is considered a single phoneme: https://en.wikipedia.org/wiki/Affricate_consonant> Can you hear the difference in these expressions: high chairs height shares

Re: What "cult-like behavior" meant (was: Re: Glyphs and graphemes

2018-07-17 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Jul 17, 2018 at 6:41 PM, Marko Rauhamaa wrote: >> I can see that the bullying behavior comes from exasperation instead of >> an outright meanness. They sincerely believe they understand the issues >> better than their opponents and are at a lo

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

2018-07-17 Thread Marko Rauhamaa
Rhodri James : > On 17/07/18 02:17, Steven D'Aprano wrote: >> Ah yes, the unfortunate design error that iterating over byte-strings >> returns ints rather than single-byte strings. >> >> That decision seemed to make sense at the time it was made, but turned >> out to be an annoyance. It's a wart

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

2018-07-17 Thread Marko Rauhamaa
Antoon Pardon : > On 17-07-18 10:27, Marko Rauhamaa wrote: >> Also, Python2's strings do as good a job at delivering codepoints as >> Python3. > > No they don't. The programs that I work on, need to be able to treat > at least german, french, dutch and eng

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

2018-07-17 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Jul 17, 2018 at 6:27 PM, Marko Rauhamaa wrote: >> Of course, UTF-8 doesn't relieve you from Unicode problems. But it has >> one big advantage: it can usually deal with non-Unicode data without any >> extra considerations while Python3's strings

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

2018-07-17 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Jul 17, 2018 at 7:03 PM, Marko Rauhamaa wrote: >> What I'd need is for the tty to tell me what column the cursor is >> visually. Or better yet, the tty would have to tell me where the column >> would be *after* I emit the next grapheme cluster.

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

2018-07-17 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Jul 17, 2018 at 6:27 PM, Marko Rauhamaa wrote: >> For me, the issue is where do I produce a line break in my text output? >> Currently, I'm just counting codepoints to estimate the width of the >> output. > > Well, that's just flat out wron

Re: What "cult-like behavior" meant (was: Re: Glyphs and graphemes

2018-07-17 Thread Marko Rauhamaa
INADA Naoki : > On Tue, Jul 17, 2018 at 4:57 PM Marko Rauhamaa wrote: >> >> Python3 is not a cult. It's a programming language. What is cult-like is >> the manner in which Python3's honor is defended in a good many of the >> discussions in this newsgroup: anger, conde

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

2018-07-17 Thread Marko Rauhamaa
Steven D'Aprano : > On Tue, 17 Jul 2018 09:52:13 +0300, Marko Rauhamaa wrote: > >> Both Python2 and Python3 provide two forms of string, one containing >> 8-bit integers and another one containing 21-bit integers. > > Why do you insist on making counter-factual statement

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

2018-07-17 Thread Marko Rauhamaa
Steven D'Aprano : > On Mon, 16 Jul 2018 21:48:42 -0400, Richard Damon wrote: >> Who says there needs to be one. A good engineer will use the >> definition that is most appropriate to the task at hand. Some things >> need very solid definitions, and some things don’t. > > The the problem is solved:

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

2018-07-17 Thread Marko Rauhamaa
INADA Naoki : >> I won't comment on Rust and Swift because I don't know them. > ... >> I won't comment on Go, either. > > Hmm, do you say Python 3 is "cult-like" without survey other popular, > programming languages? You can talk about Python3 independently of other programming languages.

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

2018-07-17 Thread Marko Rauhamaa
INADA Naoki : > On Tue, Jul 17, 2018 at 2:31 PM Marko Rauhamaa wrote: >> So I hope that by now you have understood my point and been able to >> decide if you agree with it or not. > > I still don't understand what's your original point. > I think UTF-8 vs UTF-32 is total

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

2018-07-16 Thread Marko Rauhamaa
Tim Chase : > On 2018-07-16 23:59, Marko Rauhamaa wrote: >> Tim Chase : >> > While the python world has moved its efforts into improving >> > Python3, Python2 hasn't suddenly stopped working. >> >> The sword of Damocles is hanging on its head. Unles

  1   2   3   4   5   6   7   8   9   10   >