Re: Asyncio -- delayed calculation

2016-11-28 Thread Gregory Ewing
Chris Angelico wrote: "await" means "don't continue this function until that's done". It blocks the function until a non-blocking operation is done. However, *not* using 'await' doesn't mean the operation will be done without blocking. Rather, it won't be done at all (and is usually an error, b

Re: Asyncio -- delayed calculation

2016-11-30 Thread Gregory Ewing
On Tuesday 29 November 2016 14:21, Chris Angelico wrote: "await" means "don't continue this function until that's done". It blocks the function until a non-blocking operation is done. That explanation gives the impression that it's some kind of "join" operation on parallel tasks, i.e. if you d

Re: Asyncio -- delayed calculation

2016-11-30 Thread Gregory Ewing
Chris Angelico wrote: From the point of view of the rest of Python, no. It's a sign saying "Okay, Python, you can alt-tab away from me now". The problem with that statement is it implies that if you omit the "await", then the thing you're calling will run uninterruptibly. Whereas what actually

Re: Asyncio -- delayed calculation

2016-11-30 Thread Gregory Ewing
Chris Angelico wrote: That's because you're not actually running anything concurrently. Yes, I know what happens and why. My point is that for someone who *doesn't* know, simplistic attempts to explain what "await" means can be very misleading. There doesn't seem to be any accurate way of sum

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-04 Thread Gregory Ewing
Steve D'Aprano wrote: On Mon, 5 Dec 2016 07:26 am, DFS wrote: no such column: R doesn't this mean that your column is called: single quote R single quote I think he intends it to be an SQL string literal (which uses single quotes), but since the quotes disappeared, SQL is trying to interpr

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Gregory Ewing
BartC wrote: On 05/12/2016 19:29, Michael Torrie wrote: On 12/05/2016 11:50 AM, BartC wrote: So how do I do: gcc *.c -lm The -lm needs to go at the end. Presumably it now needs to check each parameter seeing if it resembles a file more than it does an option? And are options automati

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Gregory Ewing
BartC wrote: But a similar example, suppose a syntax is: appl *.* [options] I would be disappointed by such a syntax. What if I want to operate on two or more files with unrelated names? With that syntax, I can't list them explicitly in the one command. To make that possible, the syntax wou

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Gregory Ewing
Dennis Lee Bieber wrote: -lm is not a valid file name on the OS's that use - as an option prefix. It's not invalid -- you can create a file called -lm on a unix system if you want, you just have to be a bit sneaky about how you refer to it: % echo foo > ./-lm % ls -lm % cat ./-lm foo Sane peo

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Gregory Ewing
BartC wrote: I've given a dozen examples where the shell's auto-expansion can screw things up. Only because you're taking Windows conventions and trying to apply them to Unix. That's like somebody from the USA visiting Britain and thinking "OMG! These people are all going to get themselves kil

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Gregory Ewing
BartC wrote: What, the convention of NOT assuming that any command parameter that uses * or ? MUST refer to whatever set of filenames happen to match in the current directory? Yes. That's a pretty good convention, yes?! That's a matter of opinion. It precludes the shell from performing var

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Gregory Ewing
BartC wrote: But those would be silly. Some special syntax is known about: | < and > for example. % less so What you need to understand is that, to a Unix user, * and ? are *just as well known* as |, < and >. Perhaps even more so, because they're likely to be used much sooner than piping and r

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Gregory Ewing
Steve D'Aprano wrote: I don't know any Unix programs that provide file spec processing. 'find' does, but only for its -name argument, and only because it does something different with it from what the shell would do. And you do need to quote it if it contains glob characters. -- Greg -- https:

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Gregory Ewing
Paul Moore wrote: On Tuesday, 6 December 2016 21:44:18 UTC, Gregory Ewing wrote: What you need to understand is that, to a Unix user, * and ? are *just as well known* as |, < and >. And to Windows users. Just because BartC is proposing a silly distinction between what "Unix

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Gregory Ewing
BartC wrote: And globbing doesn't take care of all of it: a Linux program still has to iterate over a loop of filenames. The same as on Windows, except the latter will need to call a function to deliver the next filename. Actually, most of them will require *two* loops, one to iterate over a s

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Gregory Ewing
BartC wrote: Only the tiny minority that can be meaningfully invoked on an arbitrary number of files at the same time. Um... you mean the "tiny minority" that includes just about *every* unix utility that operates on files? -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Gregory Ewing
BartC wrote: println dirlist(cmdparams[2])# Windows println tail(cmdparams) # Linux I'm not familiar with your language, so I'll reply in Python. If you write it like this: for arg in sys.argv[1:]: for name in glob(arg): print(name) then the user will

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Gregory Ewing
BartC wrote: Which means that input of A B* *C will all end up running together so that you have no idea what is what or which file corresponds to which expansion. So if you intend your program to be used on unix, you need to design it so that it doesn't depend on such distinctions. Now the p

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Gregory Ewing
BartC wrote: Run the code below and start pressing keys. On both of my Linuxes, I get escape sequences shown when I Insert, Delete, Home, End, Page Up, Page Down, Up, Down, Left, Right and most of the function keys; not just single ASCII codes. That's probably because your terminal window is

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Gregory Ewing
Random832 wrote: Just to point out, brace expansion isn't globbing. The most important difference is that brace expansion doesn't care what files exist. However, it's something that the shell expands into multiple arguments, giving it similar characteristics for the purposes of this discussion.

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Gregory Ewing
Grant Edwards wrote: But _paths_ can, and Windows command-line apps and shells choke on paths when written with "/" separators because way-back when the MS-DOS "designers" decided to use "/" as the default option character. To be fair to them, the use of "/" for options can be traced back to ea

Re: Linux terminals vs Windows consoles - was Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Gregory Ewing
Michael Torrie wrote: Interesting. I wouldn't have thought ENTER would return a line feed. Possibly you have the terminal in "cbreak" mode, which provides a character at a time but still does things like translate CR->LF. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Linux terminals vs Windows consoles - was Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Gregory Ewing
Michael Torrie wrote: For example, on Macs, control-key is not normally used, but rather the Command-key (the apple key) which happens to be where the Alt key is on our PC keyboards. Actually, Alt is usually mapped to Option on a Mac. The Mac Command key corresponds the "Windows" or "Meta" key

Re: The right way to 'call' a class attribute inside the same class

2016-12-11 Thread Gregory Ewing
Juan C. wrote: The instructor said that the right way to call a class attribute is to use 'Class.class_attr' notation, but on the web I found examples where people used 'self.class_attr' to call class attributes. I believe that using the first notation is better ('Class.class_attr'), this way the

Re: The right way to 'call' a class attribute inside the same class

2016-12-12 Thread Gregory Ewing
Ned Batchelder wrote: In C++, you don't have an object of type T until the constructor has finished. In Python, you have an object of type T before __init__ has been entered. That distinction seems a bit pedantic as well. Inside a C++ constructor you have access to something having all the fiel

Re: The right way to 'call' a class attribute inside the same class

2016-12-12 Thread Gregory Ewing
Ned Batchelder wrote: if a C++ constructor raises an exception, will the corresponding destructor be run, or not? (No, because it never finished making an object of type T.) So it just leaks any memory that's been allocated by the partially-run constructor? -- Greg -- https://mail.python.org/m

Re: Method to know if object support being weakreferenced ?

2016-12-12 Thread Gregory Ewing
Matthias Bussonnier wrote: I search for a method capable of telling me whether an object can be weakreferenced. Objects that can be weakly referenced have a __weakref__ attribute. So you could use hasattr(obj, '__weakref__'). -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: OT - "Soft" ESC key on the new MacBook Pro

2016-12-13 Thread Gregory Ewing
Paul Rubin wrote: First it was the hipster Mac users with the Beatnik black berets and turtlenecks, and now this. Once you're in the clutches of Apple, there is no Escape. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: OT - "Soft" ESC key on the new MacBook Pro

2016-12-18 Thread Gregory Ewing
mm0fmf wrote: +1 for knowing where CTRL should be. Bonus +1 for having used an ASR33. And it's quite remarkable that the designers of the ASR33 knew exactly where it would need to be for Emacs users years later! I think Richard Stallman must have a time machine as well. -- Greg -- https://mail

Re: python list index - an easy question

2016-12-19 Thread Gregory Ewing
BartC wrote: But if you needed a table of the frequencies of letters A to Z... An N-based array can simply have bounds of ord('A') to ord('Z') inclusive. That's fine if your language lets you have arrays with arbitrary lower bounds. But if the language only allows a fixed lower bound, and fur

Re: OT - "Soft" ESC key on the new MacBook Pro

2016-12-19 Thread Gregory Ewing
Random832 wrote: Except for the fact that the actual keyboard that Emacs was originally developed for [the Knight Keyboard, and the later Symbolics "Space Cadet" Keyboards] had the control key more or less where it is on modern PC keyboards [slightly further to the right, so easier to reach with

Re: learning and experimenting python.

2016-12-31 Thread Gregory Ewing
Joel Goldstick wrote: In the United States, ambulances often have their signage written backwards so that it appears normal in a rear view mirror. Do they do that in other countries? In NZ our fire engines have FIRE written both forwards and backwards on the front, so it's readable either way.

Re: OT: Re: learning and experimenting python.

2016-12-31 Thread Gregory Ewing
mm0fmf wrote: Username einstein, asking bizarre questions, short responses with no included context. if this isn't trolling I'm a Dutchman. I don't think he's trolling, I think he's using some kind of forum interface (Google Groups?) that displays whole threads together, making quoting less nec

Re: Cleaning up conditionals

2017-01-01 Thread Gregory Ewing
On Sat, 31 Dec 2016 14:35:46 -0800, "Deborah Swanson" declaimed the following: if len(l1[v]) == 0 and len(l2[v]) != 0: l1[v] = l2[v] elif len(l2[v]) == 0 and len(l1[v]) != 0: l2[v] = l1[v] elif l1[v] != l2[v]: ret += ", " + labels[v] + " diff" if

Re: Cleaning up conditionals

2017-01-02 Thread Gregory Ewing
Deborah Swanson wrote: flds = len(ls[0]) cl, ur, d1, de, lo, st, mi, ki, re, da, br, no, yn, ma, ar = range(0,flds) You might like to consider converting the row into a namedtuple, then you could refer to the fields using attribute names instead of indexes. You could even use the header row to

Re: Cleaning up conditionals

2017-01-02 Thread Gregory Ewing
Deborah Swanson wrote: Unless you know of, and are suggesting, a way to index a sequence with strings instead of integers, so the code could remain untouched with string indices when changes to the columns are made. I'm talking about this: https://docs.python.org/3/library/collections.html#col

Re: Simulating int arithmetic with wrap-around

2017-01-03 Thread Gregory Ewing
Paul Rubin wrote: My first thought is towards the struct module, especially if you want to handle a bunch of such integers at the same time. Or maybe the array module or some combination. Or possibly numpy. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Simulating int arithmetic with wrap-around

2017-01-06 Thread Gregory Ewing
Paul Rubin wrote: > My first thought is towards the struct module, especially if you want to > handle a bunch of such integers at the same time. Or maybe the array > module or some combination. Or possibly numpy. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Namedtuples: TypeError: 'str' object is not callable

2017-01-07 Thread Gregory Ewing
Deborah Swanson wrote: File "E:/Coding projects/Pycharm/Moving/moving_numberedtuples.py", line 139, in moving() for lst in map(listings._make, csv.reader(open('E:\\Coding projects\\Pycharm\\Moving\\Moving 2017 in.csv',"r"))): TypeError: 'str' object is not callable I know you've found the

Re: Error handling in context managers

2017-01-16 Thread Gregory Ewing
Israel Brewster wrote: The problem is that, from time to time, I can't get a connection, the result being that cursor is None, That's your problem right there -- you want a better-behaved version of psql_cursor(). def get_psql_cursor(): c = psql_cursor() if c is None: raise CantGet

Re: Error handling in context managers

2017-01-16 Thread Gregory Ewing
Terry Reedy wrote: Traceback (most recent call last): File "", line 1, in with None: pass AttributeError: __enter__ Like he said, you get an AttributeError! -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: How coding in Python is bad for you

2017-01-23 Thread Gregory Ewing
Chris Angelico wrote: On Tue, Jan 24, 2017 at 11:55 AM, Dennis Lee Bieber wrote: On Mon, 23 Jan 2017 22:55:19 +, mm0fmf declaimed the following: 50lbs of coffee beans made into espresso and 22lbs of chocolate to eat with all those tiny cups. How about just 75lbs of chocolate co

Re: How coding in Python is bad for you

2017-01-24 Thread Gregory Ewing
Dennis Lee Bieber wrote: While I'm trying to figure out what significance Centrum vitamins have with being "non-GMO"... Possibly they're just complying with some legal requirement or other to declare whether the product has any GMO components. If so, bit of a silly regulation, I'll agre

Re: PhotoImage.paste

2017-01-24 Thread Gregory Ewing
Dennis Lee Bieber wrote: But practically everything these days uses true/high color, in which each pixel encodes the exact color to be displayed. This means that changing all matching pixels from one given color to another given color requires rewriting those pixels color data. Yes, and

Re: How coding in Python is bad for you

2017-01-29 Thread Gregory Ewing
Steve D'Aprano wrote: 5. The statistics module is too slow (and if I ever meet the author, I'll give him a kick in the head); Wow... ad-hominem take to a physical level! -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: What are your opinions on .NET Core vs Python?

2017-01-29 Thread Gregory Ewing
Joseph L. Casale wrote: .NET is a library that can be used from many languages, including Python. No. Yes: http://pythonnet.sourceforge.net/ "Python for .NET is a package that gives Python programmers nearly seamless integration with the .NET Common Language Runtime (CLR) and provides a po

Re: What are your opinions on .NET Core vs Python?

2017-01-30 Thread Gregory Ewing
Nathan Ernst wrote: There is no reason you cannot introduce a static class with pure static members (i.e. the Math class in System). A static class effectively becomes another namespace in C++ parlance. I'll admit the syntax is a bit odd, and enforces you, at a minimum to use the outer name a as

Re: What are your opinions on .NET Core vs Python?

2017-01-30 Thread Gregory Ewing
Michael Torrie wrote: He was saying that you can use the explicit self paradigm in C#. Simply prefix each member variable with "this." One can do that in one's own code, but it doesn't help you to read the code of someone else who hasn't done that. Since it's not part of the C# culture, the vas

Re: What are your opinions on .NET Core vs Python?

2017-01-31 Thread Gregory Ewing
Ian Kelly wrote: Java also has "static import" which lets you individually import specific static methods or fields from a class. Yes, but it's nowhere near as convenient as Python's import. To import individual names you have to qualify all of them with the whole package name, and there is no

Re: urllib.request.urlopen fails with https

2018-03-14 Thread Gregory Ewing
Chris Angelico wrote: (Basically, what you're doing is downgrading the protection of HTTPS to something nearer plain HTTP. That's fine for what you're doing, but any code you give to students is likely to be copied and pasted into their production code.) See if you can tie in with your OS's cert

Re: urllib.request.urlopen fails with https

2018-03-14 Thread Gregory Ewing
Chris Angelico wrote: That means going back to the original problem: "how do we get a usable stock price API?". Does it have to be stock prices in particular? Or just some simple piece of data that demonstrates the principles of fetching a url and parsing the result? -- Greg -- https://mail.py

Re: Thank you Python community!

2018-03-20 Thread Gregory Ewing
John Ladasky wrote: Yeah, it's either Python or that horrifying street drug PHP. I know which one I'm choosing. Python is definitely the best language for getting high on: https://xkcd.com/353/ -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Best practice for managing secrets (passwords, private keys) used by Python scripts running as daemons

2018-03-25 Thread Gregory Ewing
Peter J. Holzer wrote: (Historically, many unixes allowed all users to read the environment variables of all processes. I don't know if this is still the case for e.g. Solaris or AIX - or macOS) A quick test suggests it's still true in MacOSX 10.6: % ps aeuww USER PID %CPU %MEM VSZ

To super or not to super (Re: Accessing parent objects)

2018-03-26 Thread Gregory Ewing
The idea that super() is *always* the right way to call inherited methods in a multiple inheritance environment seems to have been raised by some people to the level of religous dogma. I don't buy it. In order for it to work, the following two conditions must hold: 1) All the methods involved ha

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Gregory Ewing
Ned Batchelder wrote: "Ranting Rick" isn't trying to enlighten, educate, or learn. He's trying to rile people up, and he is good at it. I don't think he's even trying, it just come naturally to him. Rick rants the way wind blows and water wets. -- Greg -- https://mail.python.org/mailman/listi

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Gregory Ewing
Chris Angelico wrote: Question: How do you get a reference to a Ruby function? Or are they not first-class objects? They're not first-class. So, you can't. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Gregory Ewing
Chris Angelico wrote: Ahh, that explains it. Great. So how do you build higher-order functions? Or don't you? You don't, exactly. You have to pass around objects with a method to invoke when you want to "call" them. Ruby has a code-block syntax that helps with this somewhat, but I don't think

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Gregory Ewing
Rick Johnson wrote: rb> Object.method("print_name").call("Meathead") Yes, but the point is that you have to have to use a different syntax to call it. This is like having to say f.__call__(arg) in Python instead of just f(arg) -- Greg -- https://mail.python.org/mailman/listinfo/py

Re: please test the new PyPI (now in beta)

2018-03-27 Thread Gregory Ewing
Paul Moore wrote: maybe a less technical term[1] like "filters" would help here? Categories? -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-28 Thread Gregory Ewing
Rick Johnson wrote: The only difference is when you want to make a call from a _reference_, which, as you and i well know, is not the most common way func/meths are called (these are rare). No, but it's the case we're talking about here. If functions don't behave the same way in all circumstanc

Re: ***URGENT CONTRACT OPPORTUNITY***

2018-03-28 Thread Gregory Ewing
Ian Kelly wrote: The ad said ASAP, so I guess that now it's already too late. Also they apparently want someone who can start with three exclamation marks. That rules me out, I only have two left over from my last job. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: try-except syntax

2018-04-05 Thread Gregory Ewing
Ben Bacarisse wrote: Anyway, to coalesce two or more exception handlers, you are probably looking for except (ImportError, RuntimeError): To the OP: Are you sure you really want to mask RuntimeError here? Usually it means something has gone seriously wrong, and is a symptom that shouldn't be

Re: How to write partial of a buffer which was returned from a C function to a file?

2018-04-12 Thread Gregory Ewing
On Thu, Apr 12, 2018 at 2:16 PM, wrote: This C function returns a buffer which I declared it as a ctypes.c_char_p. The buffer has size 0x1 bytes long and the valid data may vary from a few bytes to the whole size. I think we need to see the code you're using to call this C function. The

Re: How to write partial of a buffer which was returned from a C function to a file?

2018-04-14 Thread Gregory Ewing
Jach Fong wrote: >>> pvoid = ctypes.c_void_p(ctypes.addressof(buf0)) >>> pvoid.contents Traceback (most recent call last): File "", line 1, in AttributeError: 'c_void_p' object has no attribute 'contents' I think the 'contents' attribute only applies to pointers that are pointing at part o

Re: Making matrix solver/ solver for X

2018-04-14 Thread Gregory Ewing
steffie.bo...@gmail.com wrote: Q = np.array(['Q1', 'Q2', 'Q3', 'Q4']) P = (X*Q)-X I'm assuming that 'Q1', etc. are placeholders for numbers here? Otherwise, you're doing arithmetic with strings, which doesn't make sense. So solve condition: P[0]+P[1] ,P[0]+P[2] ,P[0]+P[3] ,P[1]+P[2] ,P[1]+P[

Re: Problem/bug with class definition inside function definition

2018-05-07 Thread Gregory Ewing
Python 3.5.1 (default, Jun 1 2016, 13:15:26) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> def f(a): ... class D: ... pass ... D.a = a ... return D ... >>> c = f(42) >>> c .D'> >>> c.a 42 -- Greg -- https://mail.pyth

Re: Problem/bug with class definition inside function definition

2018-05-08 Thread Gregory Ewing
Alexey Muranov wrote: x = 42 class C: x = x # Works I'd say it kind of works by accident, and is not really an intended feature. if Python does not allow to refer "simultaneously" to variables from different scopes if they have the same name. It seems perfectly reasonable to

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-11 Thread Gregory Ewing
Marko Rauhamaa wrote: I was mildly amused when Python happily executed such code. "..." is a valid expression and thus, a valid statement. Fortunately, "?" still works for this! -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-11 Thread Gregory Ewing
I suggest adding a new builtin constant: YouFeelLikeIt = True Then all pseudo-infinite loops can be written while YouFeelLikeIt: ... -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-11 Thread Gregory Ewing
On 10/05/2018 19:51, Chris Angelico wrote: YAGNI much? How often do you need a base-9 literal in your code?? You've obviously never programmed a Setun ternary computer: https://en.wikipedia.org/wiki/Setun -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-11 Thread Gregory Ewing
Chris Angelico wrote: Octal makes a lot of sense in the right contexts. Allowing octal literals is a Good Thing. And sticking letters into the middle of a number doesn't make that much sense, so the leading-zero notation is a decent choice. Also it's easy to forget that octal was a big part of

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-11 Thread Gregory Ewing
Marko Rauhamaa wrote: I think octal is a historical relic from a time when people weren't yet comfortable with hexadecimal. Octal made perfect sense for all PDP models up to the PDP-10, which had word sizes that were a multiple of 3 bits. It still partly made sense for the PDP-11, because its

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-11 Thread Gregory Ewing
Chris Angelico wrote: What do you mean, "another bit"? Currently, the chmod command on my system can manage nine primary bits (rwx for each of ugo), plus setuid, setgid, and sticky. I think the idea is that you could regroup those 4 groups of 3 into 3 groups of 4, and get a nice mapping to hex.

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-11 Thread Gregory Ewing
Steven D'Aprano wrote: n for binary t for octal i for trinary o for duodecimal and of course, x for hexadecimal. And in format strings: "c" for decimal "a" for char "r" for string "w" for raw string Looks fine to me. Who wants to write the PEP? -- Greg -- https://mail.python.org/mai

Re: Meaning of abbreviated terms

2018-05-11 Thread Gregory Ewing
Steven D'Aprano wrote: But that's not where plists came from, was it? As I understand it, the plist data format was invented by Apple, and they called it a property list. The term "property list" can also refer to a data structure in Lisp: https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node10

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-12 Thread Gregory Ewing
Steven D'Aprano wrote: You had computers with 6, 9, or even 60 bits per byte, And some early machines were even weirder, e.g. the EDSAC with effectively 17-bit words and 35-bit longwords. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-12 Thread Gregory Ewing
Chris Angelico wrote: Tack setuid onto "owner", setgid onto "group", and sticky onto "others"? Pretty arbitrary, and disrupts the fundamental meaning of each set. Yes, it would be totally silly if e.g. the "ls" command were to regroup them that way when displaying the permission bits... oh, wai

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-12 Thread Gregory Ewing
Marko Rauhamaa wrote: I'm guessing using letters as digits felt awkward among computer people for a long time. I think you may be underestimating how much weirdness early computer programmers were willing to accept. If you think using letters as hex digits is awkward, you should check out what

Re: object types, mutable or not?

2018-05-17 Thread Gregory Ewing
I don't think it's very helpful to anyone to say that "everything is an object", because "everything" is far too vague a term. (It's not even close to being true -- there are plenty of concepts in Python that are not objects.) I think I would say something like "All data that a Python program can

Re: syntax oddities

2018-05-17 Thread Gregory Ewing
On Tue, 15 May 2018, 23:15 Tobiah, wrote: Why is it getattr(object, item) rather then object.getattr(item)? It's part of the design philosophy of Python that the namespace of a new user-defined class should as far as possible start off as a "blank slate", not cluttered up with a bunch of pred

Re: Usenet Gateway

2018-05-24 Thread Gregory Ewing
Ned Batchelder wrote: On 5/23/18 12:03 PM, Gene Heskett wrote: Brain damaged by facebook, AOL, M$, Google, yahoo yadda yadda into thinking that webmail and forums are the only game in town? Please avoid accusing others of being brain damaged, even if it was meant in a humorous context. :( I

Re: List replication operator

2018-05-25 Thread Gregory Ewing
Dennis Lee Bieber wrote: @ requires use of the weaker/shorter "ring finger" on (for me) the weaker left hand. But... choosing an operator on that basis would be discriminating against left-handed people! -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: List replication operator

2018-05-25 Thread Gregory Ewing
bartc wrote: /The/ matrix multiplication operator? In which language? And what was wrong with "*"? It seems you're unaware that Python *already* has an '@' operator. It was added specifically so that numpy could use it for matrix multiplication. A new operator was needed because numpy already

Re: Why cannot I use __slots__ and weakrefs together?

2018-05-26 Thread Gregory Ewing
Steven D'Aprano wrote: TypeError: cannot create weak reference to 'Eggs' object Why does weakref hate my Eggs class? Classes with __slots__ aren't automatically given a __weakref__ slot, to save memory I suppose. But you can give it one explicitly: >>> class Eggs: ... __slots__ = ['spanish

Re: Why exception from os.path.exists()?

2018-05-31 Thread Gregory Ewing
Chris Angelico wrote: A Unix path name cannot contain a null byte, so what you have is a fundamentally invalid name. ValueError is perfectly acceptable. It would also make sense for it could simply return False, since a file with such a name can't exist. This is analogous to the way comparing

Re: Problem with OrderedDict - progress report

2018-06-01 Thread Gregory Ewing
Chris Angelico wrote: It is an error to mutate the dictionary *and then continue to iterate over it*. But if you're processing the last key, and you add one so that it's no longer the last key, what should happen? My feeling is that this should be an error, because it's not clear whether itera

Re: Indented multi-line strings

2018-06-01 Thread Gregory Ewing
Here's my take on what an indented multi-line string syntax should look like. string foo: | This is a multi-line indented string declaration. | Note that it's a statement, not an expression. In | this example, each line of the final string starts | with two

Re: Why exception from os.path.exists()?

2018-06-01 Thread Gregory Ewing
Marko Rauhamaa wrote: Interestingly, you get a False even for existing files if you don't have permissions to access the file. Obviously in that case, instead of True or False it should return FileNotFound. :-) https://thedailywtf.com/articles/What_Is_Truth_0x3f_ -- Greg -- https://mail.pytho

Re: Problem with OrderedDict - progress report

2018-06-01 Thread Gregory Ewing
Chris Angelico wrote: if you 'break' immediately after a mutation, that isn't continuing to iterate. Even though you're inside the loop, there's no further action taken to process the loop, and no problem. Yes, but you're also not calling next() again, so no exception would be triggered. My po

Re: Why exception from os.path.exists()?

2018-06-01 Thread Gregory Ewing
Grant Edwards wrote: Python allows floating point numbers, so it is possible to express this question in python: os.path.exists(3.14159). Is the fact that the underlying OS/filesystem can't identify files via a floating point number relevent? Should it return False or raise ValueError? I don'

Re: Sorting NaNs

2018-06-02 Thread Gregory Ewing
Peter J. Holzer wrote: If it was a deliberate decicion I would say it was intentional. It was a deliberate decision not to define an ordering for NaNs, but the particular behaviour of sorting them is accidental. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Why exception from os.path.exists()?

2018-06-02 Thread Gregory Ewing
Paul Moore wrote: Windows (the kernel) has the capability to implement fork(), but this isn't exposed via the Win32 API. To implement fork() you need to go to the raw kernel layer. Which is basically what the Windows Linux subsystem (bash on Windows 10) does What people usually mean by "POSIX c

Re: Why exception from os.path.exists()?

2018-06-02 Thread Gregory Ewing
Steven D'Aprano wrote: Do you really mean to say that a computer that won't boot is POSIX compliant? No, I was pointing out the absurdity of saying that the Windows kernel layer is POSIX compliant, which is what the post I was replying to seemed to be saying. -- Greg -- https://mail.python.org

Re: Sorting NaNs

2018-06-07 Thread Gregory Ewing
Steven D'Aprano wrote: But if it were (let's say) 1 ULP greater or less than one half, would we even know? In practice it's probably somewhat bigger than 1 ULP. A typical PRNG will first generate a 32-bit integer and then map it to a float, giving a resolution coarser than the 52 bits of an IEE

Re: Python web server weirdness SOLVED

2018-06-07 Thread Gregory Ewing
Steven D'Aprano wrote: Never mind -- it turned out I had an "index.html" file in the directory which had been wget'ed from LiveJournal. That's okay, then. The other possibility was that your computer had been recruited into an evil botnet set up by LiveJournal to create backup servers for their

Re: Sorting NaNs

2018-06-07 Thread Gregory Ewing
Michael Lamparski wrote: In any case, it's verifiably not true for CPython. Yes, CPython uses a particularly good PRNG. You may not be as lucky using libraries that come with other languages. A great many PRNG algorithms have been proposed, and a good proportion of them produce 32-bit ints as

Re: Sorting NaNs

2018-06-08 Thread Gregory Ewing
Peter Pearson wrote: What applications would have to worry about colliding floats? I don't know. I'm coming from cryptology, where worrying about such things becomes a reflex. If collisions are something to be feared, then you're into hash territory, where you're probably going to want *much*

Re: Stefan's headers [was:Names and identifiers]

2018-06-08 Thread Gregory Ewing
Gene Heskett wrote: The courts weren't amused. I don't know as any of us ever cut those patent troll turkey's a check, Patent troll turkeys: Don't cut them checks, cut their necks! (Insert suitable stock photo of a turkey about to have its head removed.) -- Greg -- https://mail.python.org/mai

Re: Stefan's headers [was:Names and identifiers]

2018-06-08 Thread Gregory Ewing
MRAB wrote: So those with the most money can buy the most protection? That's the way it works with patents... -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Stefan's headers [was:Names and identifiers]

2018-06-08 Thread Gregory Ewing
Chris Angelico wrote: Open source would not exist without copyright,because it is copyright law that gives license terms their meaning. That statement doesn't make any sense. If there were no copyright laws, there would be no need for licences to distribute software. You seem to be saying that

Re: Problem finding my folder via terminal

2018-06-09 Thread Gregory Ewing
Gene Heskett wrote: Finder, if thats what you are using, I am not familiar with it, is probably showing you that which it has cached, before that folder was created. The Finder is usually pretty good at noticing things like that. I just tried creating a directory using a shell command while t

<    1   2   3   4   5   6   7   8   9   10   >