Re: A question on modification of a list via a function invocation

2017-09-05 Thread Marko Rauhamaa
Chris Angelico : > That shows that the Java '==' operator is like the Python 'is' > operator, and checks for object identity. You haven't manipulated > pointers at all. In contrast, here's a C program that actually > MANIPULATES pointers: > > [...] > > You can't do this with Python, since pointer

Re: A question on modification of a list via a function invocation

2017-09-05 Thread Marko Rauhamaa
Rustom Mody : > On Wednesday, September 6, 2017 at 3:34:41 AM UTC+5:30, Marko Rauhamaa wrote: >> Pointer arithmetics is not an essential part of C. One could argue that >> it was a mistake to include it in the language. > > This is subjective of course… but still I wonder

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-06 Thread Marko Rauhamaa
Ben Finney : > r...@zedat.fu-berlin.de (Stefan Ram) writes: > >> In mathematics, every author is free to give his own definitions to >> concepts and create his own notation. > > [...] > > For established terms in the field, an author has freedom to redefine > those terms only to the extent tha

Re: A question on modification of a list via a function invocation

2017-09-07 Thread Marko Rauhamaa
Chris Angelico : > *facepalm* > > I got nothing to say to you. Then why say anything? Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-07 Thread Marko Rauhamaa
Dennis Lee Bieber : > On Wed, 06 Sep 2017 10:37:42 +0300, Marko Rauhamaa > declaimed the following: > >> >>Which reminds me of this puzzle I saw a couple of days ago: >> >> 1 + 4 = 5 >> 2 + 5 = 12 >> 3 + 6 = 21 >> 8 + 11 = ? >> >

Re: Design: method in class or general function?

2017-09-07 Thread Marko Rauhamaa
Ben Finney : > Another, more compelling, reason to follow that advice: Python 2 is in > maintenance-only mode and will receive no support at all in a few > years. It is a dead end. > > Python 3 is actively developed and will be supported indefinitely. This reminds me of the Biblical story of the m

Re: A question on modification of a list via a function invocation

2017-09-07 Thread Marko Rauhamaa
Gregory Ewing : > There is more leeway when it comes to immutable objects; > implementations are free to cache and re-use them, so well-written > code avoids depending on the result of "is" for immutable objects. I definitely trust that: a = b assert a is b even when b holds an immutable o

Re: A question on modification of a list via a function invocation

2017-09-08 Thread Marko Rauhamaa
Gregory Ewing : > Marko Rauhamaa wrote: >> I definitely trust that: >> >>a = b >>assert a is b >> >> even when b holds an immutable object. > > That's true, but there's rarely a good use case for that > fact that isn't be

Re: Using Python 2

2017-09-08 Thread Marko Rauhamaa
Leam Hall : > However, those millions of servers are running Python 2.6 and a > smaller number running 2.7. At least in the US market since Red Hat > Enterprise Linux and its derivatives run 2.6.6 (RHEL 6) or 2.7.5 (RHEL > 7). Not sure what Python SuSE uses but they seem to have a fairly > large Eu

Re: Using Python 2

2017-09-08 Thread Marko Rauhamaa
Chris Angelico : > But as others have said, upgrading to 3.4+ is not as hard as many > people fear, and your code generally improves as a result That's somewhat irrelevant. Point is, Python 2 will quickly become a pariah in many corporations during or after 2018, and we are going to see emergency

Re: A question on modification of a list via a function invocation

2017-09-08 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): > Marko Rauhamaa writes: >>I definitely trust that: >>a = b >>assert a is b >>even when b holds an immutable object. > > |Python 3.6.0 ... > |>>> x = 21568 > |>>> x is 21568 > |False I wasn'

Re: The Incredible Growth of Python (stackoverflow.blog)

2017-09-10 Thread Marko Rauhamaa
Terry Reedy : > On 9/9/2017 6:31 AM, Pavol Lisy wrote: >> Interesting reading: >> https://stackoverflow.blog/2017/09/06/incredible-growth-python/?cb=1 > > So much for Python 3 having killed python ;-) Hasn't yet, but it would have been interesting to see the 2/3 divide in the stats. One shouldn'

Re: People choosing Python 3

2017-09-10 Thread Marko Rauhamaa
INADA Naoki : > I can't wait Python 3 is the default Python of Red Hat, and "python" > command means Python 3 on Debian and Ubuntu. I can't wait till Python 3 is available on Red Hat. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: People choosing Python 3

2017-09-10 Thread Marko Rauhamaa
Chris Warrick : > On 10 September 2017 at 09:30, Marko Rauhamaa wrote: >> I can't wait till Python 3 is available on Red Hat. > > Python 3.4 is available in EPEL. As an application developer, I can't make the customers depend on EPEL. It's Python2 until the distro

Re: The Incredible Growth of Python (stackoverflow.blog)

2017-09-10 Thread Marko Rauhamaa
Skip Montanaro : >> * asyncio with its a-dialect > > What is a/the "a-dialect"? await async def async for __aiter__ __anext__ async with __aenter__ __aexit__ What's more, when you turn a function into an async, you need to refactor a large part of your program. Marko -- https://mail.python.o

Re: People choosing Python 3

2017-09-10 Thread Marko Rauhamaa
Stephan Houben : > Op 2017-09-10, Marko Rauhamaa schreef : >> As an application developer, I can't make the customers depend on EPEL. >> It's Python2 until the distro comes with Python3. > > Why not bundle the Python interpreter with your application? > It se

Re: The Incredible Growth of Python (stackoverflow.blog)

2017-09-10 Thread Marko Rauhamaa
Stephan Houben : > Op 2017-09-10, Chris Angelico schreef : >> Want to make something iterable? Define __iter__. Want to make it >> async-iterable (with "async for")? Define __aiter__. It's a bit clunky >> if you want the same object to be iterable both ways, but I don't know >> of any real-world s

Re: Using Python 2

2017-09-10 Thread Marko Rauhamaa
Ian Kelly : > 2. Type hints are completely optional, so this does not support the > claim that Python 3 added complexity that is counter-productive to > "simple" users. If you want to keep your program simple, you can: just > don't use them. We'll see about that. I'm afraid type hints will become

Re: The Incredible Growth of Python (stackoverflow.blog)

2017-09-10 Thread Marko Rauhamaa
Chris Angelico : > On Sun, Sep 10, 2017 at 8:08 PM, Marko Rauhamaa wrote: >> What's more, when you turn a function into an async, you need to >> refactor a large part of your program. > > That's not Python-specific. If you're going to change your program &

Re: The Incredible Growth of Python (stackoverflow.blog)

2017-09-10 Thread Marko Rauhamaa
Dennis Lee Bieber : > In contrast, every sample I've seen of the async library comes > across as "magic happens here -- at some point in time". That magic can be learned, in principle. I'm afraid few programmers will be willing/able to get over the hump, and there are a number of tricky asp

Re: The Incredible Growth of Python (stackoverflow.blog)

2017-09-11 Thread Marko Rauhamaa
Gregory Ewing : > Chris Angelico wrote: >> Async functions in >> JS are an alternative to callback hell; most people consider async >> functions in Python to be an alternative to synchronous functions. > > What do you base that on? Seems to me async is an alternative > to callback-based frameworks

Re: People choosing Python 3

2017-09-11 Thread Marko Rauhamaa
Stephan Houben : > Op 2017-09-10, Marko Rauhamaa schreef : >> I've seen that done for Python and other technologies. It is an >> expensive route to take. Also, it can be insecure. When >> vulnerabilities are found, they are communicated to the maintainers >> of, s

Re: "tkinter"

2017-09-13 Thread Marko Rauhamaa
Thomas Jollans : > On 2017-09-13 16:47, Rick Johnson wrote: >> leam hall wrote: >> {TEE-KAY-ENTER} > > enter? not inter? Maybe a third of Americans make no distinction between -e- and -i- in front of a nasal sound: https://en.wikipedia.org/wiki/Phonological_history_of_English_h igh_front_vow

Re: [Tutor] beginning to code

2017-09-22 Thread Marko Rauhamaa
Bill : > I figure that, internally, an address, a pointer, is being passed by > value to implement pass by reference. Why do you say "they are right" > above? Are you saying it's not pass by reference? "Pass by reference" could be "pass by reference to object" (Python, Java, JavaScript, Lisp) or

Re: [Tutor] beginning to code

2017-09-22 Thread Marko Rauhamaa
bartc : > On 22/09/2017 10:23, Marko Rauhamaa wrote: >> However, Python doesn't need any language changes to implement memory >> slots. A memory slot could be defined as any object that implements >> "get()" and "set(value)" methods: > > I did

Re: [Tutor] beginning to code

2017-09-22 Thread Marko Rauhamaa
Chris Angelico : > Sure, let me just put that into a function. CPython 3.7, although I'm > pretty sure most CPython versions will do the same, as will several of > the other Pythons. > [demonstration that it didn't work] Ok. The reason is this: Note: The contents of this dictionary should not

Re: [Tutor] beginning to code

2017-09-22 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): > Marko Rauhamaa writes: >>swap(slot_ref(locals(), "x"), slot_ref(locals(), "y")) > > You need to be able to write the call as > > swap( x, y ) Why? Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] beginning to code

2017-09-22 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): > Marko Rauhamaa writes: >>r...@zedat.fu-berlin.de (Stefan Ram): >>>Marko Rauhamaa writes: >>>>swap(slot_ref(locals(), "x"), slot_ref(locals(), "y")) >>>You need to be able to write the

Re: [Tutor] beginning to code

2017-09-22 Thread Marko Rauhamaa
Chris Angelico : > On Fri, Sep 22, 2017 at 10:26 PM, Marko Rauhamaa wrote: >> Chris Angelico : >>> (Side point: Your slot_ref function is rather bizarre. It's a closure >>> AND a class, just in case one of them isn't sufficient. >> >> I don'

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Marko Rauhamaa
Antoon Pardon : > the semantics of an assignment depends on the language I've only seen one kind of assignment in the general-purpose programming languages I know, maybe with the exception of Prolog and Rust. So the assignment is the same everywhere, only the evaluation model varies. In classic

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Marko Rauhamaa
Antoon Pardon : > Op 25-09-17 om 11:41 schreef Marko Rauhamaa: >> Antoon Pardon : >> >>> the semantics of an assignment depends on the language >> I've only seen one kind of assignment in the general-purpose >> programming languages I know, maybe with t

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Marko Rauhamaa
Antoon Pardon : > Op 25-09-17 om 13:32 schreef Marko Rauhamaa: >> In Python, assignment "mutates the target" as well. It's only that in >> Python, the target is always a pointer. > > Fine if you want to word it like that, the assignments in Pascal and >

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Marko Rauhamaa
Antoon Pardon : > Op 25-09-17 om 14:16 schreef Marko Rauhamaa: >> Python only operates with pointers. You can operate with pointers in >> Pascal as well. > > You are talking about implementation details. No, I'm not. I'm talking about pointers in the abstract se

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Marko Rauhamaa
Chris Angelico : > On Mon, Sep 25, 2017 at 7:41 PM, Marko Rauhamaa wrote: >> In Python, all expressions evaluate pointers. > > And that's an assertion that isn't backed by anything in the Python > specification. Where do you get that all Python expressions are > po

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Marko Rauhamaa
Antoon Pardon : > Op 25-09-17 om 15:16 schreef Marko Rauhamaa: >> No, I'm not. I'm talking about pointers in the abstract sense, both in >> case of Python and Pascal. Neither language gives any hint as to the >> physical nature of the pointer. > > Yes you are

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Sep 26, 2017 at 12:26 AM, Marko Rauhamaa wrote: > Sorry, that was my bad in the terminology. But where do you get that > all Python expressions evaluate to pointers? What do they evaluate to if not pointers? Anton's "identities" would work, too

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Marko Rauhamaa
Chris Angelico : > You need *some* support for your assertion that there are pointers, What would convince you? Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Marko Rauhamaa
Rhodri James : > On 25/09/17 15:26, Marko Rauhamaa wrote: >> That's not what I said. I said all expressions *evaluate to* pointers. > > This may well be true in particular implementations, but it is an > implementation detail so Chris' point still stands. Another >

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Sep 26, 2017 at 5:36 AM, Marko Rauhamaa wrote: >> Chris Angelico : >>> You need *some* support for your assertion that there are pointers, >> >> What would convince you? > > Evidence, or a statement from the documentation. I m

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-26 Thread Marko Rauhamaa
Chris Angelico : > I've explained Python's (or JavaScript's, since they're the same) > object model to a number of novice programmers without any > difficulties, without talking about pointers or invisible values or > any of that junk. There are just two things to explain: the concept of > names r

Re: Grumpy-pants spoil-sport

2017-09-26 Thread Marko Rauhamaa
Ben Finney : > No, we cannot just agree that we all know how it works. The well is > poisoned for a long time, and we must diligently undo the conceptual > damage for generations to come; and I know of no better way than > continuing to publicly discuss how both misapprehensions are wrong. For st

Re: Grumpy-pants spoil-sport

2017-09-26 Thread Marko Rauhamaa
Antoon Pardon : > That wont happen as long as people continue to do damage with e.g. > claiming that the python assignment is not an alias operation. > > There is IMO no conceptual damage by regarding the call semantics > as call by reference. I don't think the clear description of Python's seman

Re: Grumpy-pants spoil-sport

2017-09-26 Thread Marko Rauhamaa
Antoon Pardon : > Op 26-09-17 om 12:09 schreef Marko Rauhamaa: >> I don't think the clear description of Python's semantics requires the >> use of such terms ("alias", "call by XXX"). It would be enough to >> specify what actually happens. &

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-26 Thread Marko Rauhamaa
Rhodri James : > On 25/09/17 20:40, Marko Rauhamaa wrote: >> A pointer is something that points to a data object. > > In that case you are using "pointer" in such an informal sense that > making deductions from it is unlikely to be successful. Propose a name for th

Re: merits of Lisp vs Python

2017-09-30 Thread Marko Rauhamaa
Stephan Houben : > Op 2017-09-27, Robert L. schreef : >> (sequence-fold + 0 #(2 3 4)) >> ===> >> 9 >> >> In Python? > sum([2, 3, 4]) > 9 Robert L. is only trolling. He uses fake technical comments to spread white supremacy in his signatures. Marko -- https://mail.python.org/mailman/listin

Re: newb question about @property

2017-10-01 Thread Marko Rauhamaa
Chris Angelico : > Yes, that's correct. The *descriptor* protocol is what allows > "foo.bar" to cause a function to be executed That mechanism allows you to expose data fields in the API. If the implementation later changes, you can emulate the data fields. I must say, though, I have yet to run

Re: newb question about @property

2017-10-02 Thread Marko Rauhamaa
Chris Angelico : > On Mon, Oct 2, 2017 at 5:34 PM, Marko Rauhamaa wrote: >> I have *seen* a semi-useful decorator in code once >> (@contextlib.contextmanager) but still would prefer explicit dunder >> methods. > > [...] I'm not sure where dunder methods come

Re: style: single and multiple lines

2017-10-02 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): > def f(x): return 2*x > > . So this single-line style should not be that bad. I very rarely allow myself to write single-line complex statements. It is usually when defining exceptions: class SyntaxError(Exception): pass if even then. > def f(x): >

Re: Lies in education [was Re: The "loop and a half"]

2017-10-05 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): > Some of you are experts in Python, but are only > half-educated when it comes to physics, C++ or other topics. > I wish those persons would not broadcast their > half-knowledge in the form of confident statements, I don't wish that. That would only

Re: The "loop and a half"

2017-10-05 Thread Marko Rauhamaa
Gregory Ewing : > bartc wrote: >> Yes, I tried typing 'sort' in Linux, where it apparently hangs (same >> on Windows actually). The reason: because it might have killed >> someone to have added a message saying what you are expected to type >> and how to end it. (Namely, press Ctrl-D start at the

Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]

2017-10-06 Thread Marko Rauhamaa
Chris Angelico : > On Fri, Oct 6, 2017 at 7:09 PM, Steve D'Aprano > wrote: >> What are the right ways for a Python script to detect these sorts of >> situations? >> >> (1) Standard input is coming from a pipe; >> (2) Stdin is being read from a file; >> (3) Stdin is coming from a human at a termin

Re: The "loop and a half"

2017-10-06 Thread Marko Rauhamaa
bartc : > The internal utilities used within an operating system, primarily > intended for file or redirected i/o with no live interaction, should be > distinct from those designed to be used directly with a live user. > > Or is it against the rules of Unix to have two different versions of a > pr

Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]

2017-10-06 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Oct 7, 2017 at 4:05 AM, Grant Edwards > wrote: >> On 2017-10-06, Thomas Jollans wrote: >>> Seriously? sys.stdin can be None? That's terrifying. >> >> Why? >> >> Unix daemons usually run with no stdin, stderr, or stdout. >> >> And yes, people do write Unix daemons in P

Re: The "loop and a half"

2017-10-06 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Oct 7, 2017 at 4:55 AM, Marko Rauhamaa wrote: >> Personally, I think stdin is a bit lame as a stimulus source for an >> interactive program. That's not even what stdin is primarily meant >> for; stdin is meant to be the input data for a jo

Re: The "loop and a half"

2017-10-06 Thread Marko Rauhamaa
bartc : >> Personally, I think stdin is a bit lame as a stimulus source for an >> interactive program. That's not even what stdin is primarily meant for; >> stdin is meant to be the input data for a job. Similarly, stdout is >> meant to be the result of the computation. Stderr, then, is used to >>

Re: The "loop and a half"

2017-10-06 Thread Marko Rauhamaa
Grant Edwards : > I'm always amazed how long it takes people to accomplish simple tasks > when they refuse to use anything other than eclipse and a web browser. Now I can bring this back to Python. I have had a huge task of arranging 1000+ soccer games in a tournament. I could have used a web ser

Re: The "loop and a half"

2017-10-08 Thread Marko Rauhamaa
bartc : > It seems to me that it's pretty much everyone here who has an > overbearing sense of superiority in that everything that Unix or Linux > does is a million times better than anything else. People's opinions don't matter here. Point is, if you are writing software for Linux, you need to d

Re: OT again sorry [Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]]

2017-10-08 Thread Marko Rauhamaa
leam hall : > Colorized ls is something the distrobution people like and they put it > in. Others of us don't care for it. But it's not "Linux", is the > profile. Easy to customize. Easy and easy... "Linux" means so many things to people. For example, the recent "Linux Subsystem on Windows 10" i

Re: The "loop and a half"

2017-10-08 Thread Marko Rauhamaa
Chris Angelico : > On Mon, Oct 9, 2017 at 3:50 AM, bartc wrote: >> Yeah, well, some people like to be sheep, others like to be >> individuals**. > > Yeah, well, some people like to be standards-compliant, others like to > be irrelevant morons. Even being called a sheep doesn't justify that kind

Re: The "loop and a half"

2017-10-09 Thread Marko Rauhamaa
alister : > or if you want the luxury of a GUI editor simply ssh to the remote > machine & run the editor there (using X forwarding to route the > display to you local PC) I could be doing it at this very moment. However X11 networking is so clunky that I choose to do it in an SSH text terminal.

Re: The "loop and a half"

2017-10-09 Thread Marko Rauhamaa
Grant Edwards : > On 2017-10-09, alister via Python-list wrote: > >> or if you want the luxury of a GUI editor simply ssh to the remote >> machine & run the editor there (using X forwarding to route the >> display to you local PC) > > AFAICT, most modern GUI toolkits are no longer usable via X fo

Re: The "loop and a half"

2017-10-09 Thread Marko Rauhamaa
alister : > I cant see any reason why I would want to run a web browser remotely I have had that need occasionally. More recently, I wanted to print a PDF document using evince. It took forever for evince to respond over the WAN. I had to resort to other means. > I can see that even this would be

Re: The "loop and a half"

2017-10-09 Thread Marko Rauhamaa
Grant Edwards : > On 2017-10-09, Marko Rauhamaa wrote: >> The problem is it's too low-level ("mechanism, not a policy"). What >> we'd need is this setup: >> >>+-+ >>| client | >>+-+ >>| toolkit |

Re: Lies in education [was Re: The "loop and a half"]

2017-10-10 Thread Marko Rauhamaa
Bill : > Steve D'Aprano wrote: >> Bjarne Stroustrup is famous for designing one of the most >> heavyweight, baraque, hard-to-understand, difficult-to-use >> programming languages in common use. While C++ has many excellent >> features, and is constrained by the need to be compatible with C, I >> d

Re: Lies in education [was Re: The "loop and a half"]

2017-10-11 Thread Marko Rauhamaa
Rhodri James : > C++ is designed, true, but well designed? It has a fundamental flaw; > it wants to be both a high-level language and compatible with C, under > the mistaken impression that C is a high level language. Since C is > actually an excellent macro-assembler, this dooms the exercise from

Re: Lies in education [was Re: The "loop and a half"]

2017-10-11 Thread Marko Rauhamaa
Chris Angelico : > The places where C++ is not a superset of C are mostly things you > wouldn't want to be doing anyway. You can generally take C code and > compile it with a C++ compiler, and it'll have the same semantics. Here's a C/C++ program:

Re: Lies in education [was Re: The "loop and a half"]

2017-10-11 Thread Marko Rauhamaa
Chris Angelico : > On Thu, Oct 12, 2017 at 2:43 AM, Marko Rauhamaa wrote: >> That is not immediately all that significant but points to subtle >> incompatibilities between the data models of C and C++. > > Indeed - their handling of empty structs is different. But that &g

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Marko Rauhamaa
Grant Edwards : > I like [const qualifiers] in C because it allows the linker to place > them in ROM with the code. It also _sometimes_ provides useful > diagnostics when you pass a pointer to something which shouldn't be > modified to something that is going to try to modify it. Unfortunately, "

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Marko Rauhamaa
Bill : > Marko Rauhamaa wrote: >> One example is the surprising fact that string literals in C are >> "char *" and not "const char *". > > If not, you couldn't pass a string literal to a function having > prototype void f(char *s); That *ought*

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Marko Rauhamaa
Chris Angelico : > On Thu, Oct 12, 2017 at 6:22 PM, Marko Rauhamaa wrote: >> Additionally, you can launder any constant string into a nonconstant >> string with strstr(3): >> >> const char *cs = "hello"; >> char *s = strstr(cs, ""); &

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Marko Rauhamaa
Chris Angelico : > On Thu, Oct 12, 2017 at 8:20 PM, Marko Rauhamaa wrote: >> BTW, C++ tries to be a bit stricter about "const". It declares two >> separate prototypes: >> >>const char *strstr(const char *, const char *); >>cha

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Marko Rauhamaa
Grant Edwards : > Using const with strings in C with amateurish libraries is a headache > because _some_people_ will write their declarations so as to require > pointers to mutable strings even when they have no intention of > mutating them. Those people should be hunted down and slapped with a >

Re: Lies in education [was Re: The "loop and a half"]

2017-10-13 Thread Marko Rauhamaa
bartc : > 'const' tries to do too many things, most of them poorly, although it > does a very good job at adding clutter. +1 Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Lies in education [was Re: The "loop and a half"]

2017-10-13 Thread Marko Rauhamaa
"Peter J. Holzer" : > On 2017-10-13 05:28, Gregory Ewing wrote: >> Not only does "byte" not always mean "8 bits", but >> "char" isn't always short for "character"... > > True. Well, it does, in my universe. That was cast in stone 10**-32 seconds after the Big Bang. Marko -- https://mail.pyt

Re: Lies in education [was Re: The "loop and a half"]

2017-10-13 Thread Marko Rauhamaa
Marko Rauhamaa : > bartc : >> 'const' tries to do too many things, most of them poorly, although it >> does a very good job at adding clutter. > > +1 However, I do my best to honor "const" since it's there. I'm even more Catholic than the

Re: Lies in education [was Re: The "loop and a half"]

2017-10-13 Thread Marko Rauhamaa
Gregory Ewing : > Neil Cerutti wrote: >> I can tell at a glance if a parameter is expected to be modifiable >> just by looking at the function signature. > > The question is why doesn't anyone feel the need to be able to do that > for Python functions? Whether a function modifies things passed to

Re: Lies in education [was Re: The "loop and a half"]

2017-10-13 Thread Marko Rauhamaa
Paul Moore : > To put it another way, in C const is a property of the variable being > declared, not the value assigned to it. In Python, variables aren't > declared, and constness is an inherent property of the value (or its > type). One interesting question which this does raise is whether > the

Re: Lies in education [was Re: The "loop and a half"]

2017-10-13 Thread Marko Rauhamaa
bartc : > But what about the poor user reading the code? Or can that now only be > done with the aid or a browser that analyses 100,000 lines and applies > that same algorithm? > > We mustn't forget the person writing the code, who may have a certain > type in mind for X, but their (I nearly said

Re: Lies in education [was Re: The "loop and a half"]

2017-10-13 Thread Marko Rauhamaa
alister : > On Sat, 14 Oct 2017 01:48:44 +1300, Gregory Ewing wrote: >> I thought it would be fairly obvious that by "put it in read-only >> memory" I meant "arrange for it to be in a location that is read-only >> at run time". Obviously it can't be read-only at *compile* time, just >> as a physic

Re: Best practise for passing time as arguments

2017-10-14 Thread Marko Rauhamaa
Andrew Z : > I wonder what are the "best practises" for passing "time" parameters to > functions? > I noticed that sometimes i pass "time" as a str and then start "massaging" > it into delta or i need this time format or that format. Thats quite > annoying and inconsistent. I do the same thing.

Re: Best practise for passing time as arguments

2017-10-14 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): > Of course, you (the OP), should check out > > datetime.datetime > > and > > datetime.timedelta > > from the Python Library. which he mentioned in his post. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Best practise for passing time as arguments

2017-10-14 Thread Marko Rauhamaa
Thomas Jollans : > When working with time zones, the standard library needs a little help. > Luckily, there's a module for that. https://pypi.python.org/pypi/pytz Even better: sudo dnf install python3-pytz Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Best practise for passing time as arguments

2017-10-14 Thread Marko Rauhamaa
Chris Angelico : > On Sun, Oct 15, 2017 at 5:20 AM, Marko Rauhamaa wrote: >> Even better: >> >>sudo dnf install python3-pytz > > How is that better? It's the same thing, packaged differently, and > thus only available on Red Hat-family systems, and depen

Re: Best practise for passing time as arguments

2017-10-14 Thread Marko Rauhamaa
Chris Angelico : > * You get into the habit of posting distro-specific (not just > OS-specific) commands to global mailing lists. And? I don't mind you posting the instructions for any other Linux distro. Chances are the translation into my distro is somewhat obvious. At least it would encourage

Re: how to read in the newsreader

2017-10-16 Thread Marko Rauhamaa
Chris Green : > I read newsgroups using tin, a text-mode/command line newsreader. I > always run tin on my home desktop machine, even if I'm away from home > by using ssh. So I maintain my settings that way. By the way tin *is* > mouse away even though it's a text mode program. > > For reading mai

Re: why del is not a function or method?

2017-10-17 Thread Marko Rauhamaa
Terry Reedy : > On 10/17/2017 1:07 AM, Steve D'Aprano wrote: >> -- unless the interpreter > made del a special case, not a regular function. > > This is what Lisp does. Most functions are 'normal': unquoted argument > expressions are evaluated. Some are 'special': at least one of the > argument

Re: Compression of random binary data

2017-10-23 Thread Marko Rauhamaa
Thomas Jollans : > On 2017-10-23 11:32, danceswithnumb...@gmail.com wrote: >> According to this website. This is an uncompressable stream. >> >> https://en.m.wikipedia.org/wiki/Incompressible_string >> >> 12344321 > > No, it's not. According to that article, that string is incompressible

Re: Compression of random binary data

2017-10-23 Thread Marko Rauhamaa
Gregory Ewing : > What you *can't* do is compress 16 random decimal digits to less than > 6.64 bytes. More precisely: Regardless of the compression scheme, the probability of shortening the next bit sequence is less than 0.5 if the bits are distributed evenly, randomly and independently

Re: Compression of random binary data

2017-10-26 Thread Marko Rauhamaa
Ben Bacarisse : >> In this context, "random data" really means "uniformly distributed >> data", i.e. any bit sequence is equally likely to be presented as >> input. *That's* what information theory says can't be compressed. > > But that has to be about the process that gives rise to the data, not

Re: Ideas about how software should behave

2017-11-08 Thread Marko Rauhamaa
Jon Ribbens : > It is my experience of this group/list that if one disagrees with any > of you, Steve and Chris, you all rally round and gang up on that > person to insult and belittle them. This makes the atmosphere quite > hostile, and it would be quite remarkable if it isn't hurting the > commun

Re: Ideas about how software should behave

2017-11-09 Thread Marko Rauhamaa
Gregory Ewing : > There are plenty of good ways of criticising an idea that are clearly > about the idea itself, so there is no need to resort to adjectives > that could be misunderstood as veiled ad-hominem attacks. I disagree. Ad hominems are needed when you run out of reasoned arguments but fee

Re: Ideas about how software should behave

2017-11-10 Thread Marko Rauhamaa
Ned Batchelder : > On 11/8/17 3:05 PM, Marko Rauhamaa wrote: >> If someone's postings constantly frustrate you, simply place them in >> your killfile. I've done that to people. People have done that to me. > > Tolerating bad behavior and advising people to cope by k

Re: "help( pi )"

2017-11-17 Thread Marko Rauhamaa
Paul Moore : > numbers don't have docstrings. There's no reason they couldn't: >>> help(2) Help on built-in number 2 in module builtins: 2 2 -> int The natural number immediately succeeding 1 (qv). The number of hemispheres in a healthy mammal's brain. It might also

Re: Should constants be introduced to Python?

2017-11-17 Thread Marko Rauhamaa
Marcin Tustin : > I'm against this because Python's strength is its simplicity. This > doesn't actually simplify anything, but it does add a new language > feature to understand. And there will be eternal debates on the correct use of the feature. One of the ugliest features of C is the "const"

Re: General Purpose Pipeline library?

2017-11-20 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): > Jason writes: >>I feel like I'm reinventing a wheel here. I was wondering if >>there's already something that exists? > > Why do you want this? Some time back Stephen D'Aprano demonstrated how the | operator can be defined to create pipelines in Python.

Re: Benefits of unicode identifiers

2017-11-24 Thread Marko Rauhamaa
bartc : > On 24/11/2017 11:56, Stefan Ram wrote: >>Java allowed Unicode in identifiers right from the get-go >>(1995). I.e., one can write an assignment statement such as >> >> π = 3.141; > > That's great. But how do I type it on my keyboard? How do I view someone > else's code on my crapp

Re: Pros and cons of Python sources?

2017-11-27 Thread Marko Rauhamaa
Cameron Simpson : > And this is exactly what I'm warning about. Many Linux users see some > kind of failure and just stick sudo on the front of the command. It is > almost always the wrong things to do, leading to effects in the OS > install area instead of being safely contained within one's home

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-27 Thread Marko Rauhamaa
Ian Kelly : > On Sat, Nov 25, 2017 at 7:10 AM, John Pote wrote: >> The issue is that if I press a key on the keyboard the key is >> immediately shown on the screen but then the shutdown() call blocks >> until another TCP connection is made, text is echoed back and only >> then does serve_forever(

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-28 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Nov 28, 2017 at 5:04 PM, Marko Rauhamaa wrote: >> Seems to be one of the fundamental multithreading issues: each thread >> is blocked on precisely one event. Asyncio is more flexible: you can >> multiplex on a number of events. > > No

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-28 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Nov 28, 2017 at 11:52 PM, Marko Rauhamaa wrote: >> The original poster's problem seems to be caused by blocking APIs that >> cannot be multiplexed using select(). A good many Python facilities are >> the same way. >> >> Such bl

  1   2   3   4   5   6   7   8   9   10   >