Re: Python 3.6.0a2 is now available

2016-06-16 Thread Steven D'Aprano
On Thursday 16 June 2016 14:36, Lawrence D’Oliveiro wrote: > On Thursday, June 16, 2016 at 2:19:33 AM UTC+12, MRAB wrote: > >> Coincidentally, there was recently a discussion on the python-dev list >> about whether to switch to C99. > > Only slightly less than a generation after it came out...

Re: Bulk Adding Methods Pythonically

2016-06-16 Thread Steven D'Aprano
cal and free variables used by the > interpreter." That only applies to locals() inside a function. The intent of locals() inside a class is to be writable, and if the docs don't explicitly make that guarantee, they should. http://bugs.python.org/issue27335 -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Contradictory error messages in Python 3.4 - standard library issue!

2016-06-16 Thread Steven D'Aprano
that change, or changes, are irrelevant. Then you need to show us how you are calling tokenize. Show us the ENTIRE traceback, starting with the line beginning "Traceback", not just the last line with the error message. Once we've seen that, we may be able to help you, or we may have more questions, but that's the bare minimum we need. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Method Chaining

2016-06-16 Thread Steven D'Aprano
might find this simple adaptor useful: http://code.activestate.com/recipes/578770-method-chaining/ -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Method Chaining

2016-06-17 Thread Steven D'Aprano
ine_to((p1 + p1a) / 2) .stroke() ) as the parens and indentation more clearly mark this chunk of code as a unit. On the other hand, I like the fact that methods which are conceptually procedures that operate by side-effect return None. So it's hard to decide precisely which behaviour is be

Re: (repost) Advisory: HTTP Header Injection in Python urllib

2016-06-17 Thread Steven D'Aprano
rhaps they mean a scenario where I'm running a service on localhost and offering it to other users on a local network. In which case it makes sense: trusted internal networks perhaps shouldn't be trusted. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: value of pi and 22/7

2016-06-17 Thread Steven D'Aprano
t figures" is inherently ambiguous. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: best text editor for programming Python on a Mac

2016-06-17 Thread Steven D'Aprano
switching to Western ASCII > encoding, but once I start typing, I get a message stating that the > document can no longer be saved using its original Western (ASCII) > encoding. > > Any suggestions for a good open source text editor for the Mac out there? > For now, I am going t

Re: best text editor for programming Python on a Mac

2016-06-17 Thread Steven D'Aprano
problem. It *may*, but since the details of what the precise problem are quite vague, it is difficult to be sure. We know its an encoding problem, because that's what the error message tells us, but beyond that, the symptoms reported are unclear. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: (repost) Advisory: HTTP Header Injection in Python urllib

2016-06-18 Thread Steven D'Aprano
On Sat, 18 Jun 2016 01:52 pm, Random832 wrote: > On Fri, Jun 17, 2016, at 21:00, Steven D'Aprano wrote: >> The author doesn't go into details of what sort of attacks against >> localhost they're talking about. An unauthenticated service running on >> localhost

Re: best text editor for programming Python on a Mac

2016-06-19 Thread Steven D'Aprano
y refers to "the ASCII value" of non-ASCII characters, God kills a puppy. No wonder people find it so hard to understand Unicode. They have to unlearn a bunch of misapprehensions first. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: value of pi and 22/7

2016-06-19 Thread Steven D'Aprano
e same everywhere. >> they might not have understood significant figures, but >> they probably wouldn't have been overly concerned about the difference >> between thirty and thirty-one. > > If you're building something the size of a pyramid, that could > add up to quite a lot of error. Indeed. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: ASCII or Unicode? (was best text editor for programming Python on a Mac)

2016-06-19 Thread Steven D'Aprano
ut showed what characters were available. If you held down the Option key, the on-screen keyboard would display the characters each key would insert. This increased discoverability and made it practical for Hypertalk to accept non-ASCII synonyms such as ≤ for <= ≥ for >= ≠ for <> Without better tooling and more discoverability, non-ASCII characters as syntax are an anti-feature. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: value of pi and 22/7

2016-06-19 Thread Steven D'Aprano
On Monday 20 June 2016 15:19, Ian Kelly wrote: > Sure, but I think you've missed my central point, which is not that > they wouldn't have made reasonably precise measurements in > construction, but only that the storytellers would have rounded things > off for their audience. > > We still do the

Re: ASCII or Unicode? (was best text editor for programming Python on a Mac)

2016-06-20 Thread Steven D'Aprano
On Monday 20 June 2016 17:57, Lawrence D’Oliveiro wrote: > On Monday, June 20, 2016 at 4:31:00 PM UTC+12, Phil Boutros wrote: >> >> Steven D'Aprano wrote: >>> >>> This is how I write x≠y from scratch: >> >> >> To wrap this back

Re: the global keyword:

2016-06-20 Thread Steven D'Aprano
ses and imports are also globals. But not global *variables*. They are generally used as per-module global *constants*, or at least near-constants. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: the global keyword:

2016-06-20 Thread Steven D'Aprano
but I'm not accusing you or anyone else of taking the contrary position (namely "nobody ever makes observations and shares them with the group"). > And it is disingenuous to inaccurately mention others people's position Bart did not mention anyone's position, accurately or inaccurately. > and then to try to screen yourself off from reactions by ending with: > "Best not to rake it up again." -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: the global keyword:

2016-06-20 Thread Steven D'Aprano
On Mon, 20 Jun 2016 11:29 pm, Random832 wrote: > On Mon, Jun 20, 2016, at 08:15, Steven D'Aprano wrote: >> Bart didn't say anyone had defended it. He made an observation: >> >> "that's a good illustration of why 'y' isn't a name reference

Re: ASCII or Unicode? (was best text editor for programming Python on a Mac)

2016-06-20 Thread Steven D'Aprano
n" X11 system. Oh, I did learn one thing, thanks to Lawrence's earlier link: the compose key behaves as a dead-key, not a modifier. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Re - bug in tokenize module

2016-06-20 Thread Steven D'Aprano
On Tue, 21 Jun 2016 09:01 am, Harrison Chudleigh wrote: > Sorry. Only works with text files. But my point is still valid. What point? Without context, how are we supposed to know what you're talking about? We're not mind-readers you know. -- Steven -- https://mail.pytho

Marking a subtest as an expected failure

2016-06-21 Thread Steven D'Aprano
I'm using unittest and the subtest context manager to run some tests: def test_spam(self): for i in range(100): for j in range(100): with self.subtest(i=i, j=j): self.assertEqual(spam(i, j), 999) Now, it turns out that spam(i, j) == 999 for all i, j *exce

Re: value of pi and 22/7

2016-06-21 Thread Steven D'Aprano
On Tuesday 21 June 2016 02:01, Ian Kelly wrote: > On Mon, Jun 20, 2016 at 12:22 AM, Steven D'Aprano > wrote: >> There's a difference though. Nobody has tried to legislate the value of pi >> to match your casual reference to "about 1900 square feet", bu

Re: (repost) Advisory: HTTP Header Injection in Python urllib

2016-06-21 Thread Steven D'Aprano
On Sun, 19 Jun 2016 03:28 am, Random832 wrote: > On Sat, Jun 18, 2016, at 12:02, Steven D'Aprano wrote: >> Er, you may have missed that I'm talking about a single user setup. >> Are you suggesting that I can't trust myself not to forge a request >> that goes to

Re: base64.b64encode(data)

2016-06-21 Thread Steven D'Aprano
On Mon, 13 Jun 2016 11:36 pm, Random832 wrote: > On Mon, Jun 13, 2016, at 06:35, Steven D'Aprano wrote: >> But this is a Python forum, and Python 3 is a language that tries >> very, very hard to keep a clean separation between bytes and text, > > Yes, but that doesn

Re: Request for opinions: A cross language development tool

2016-06-21 Thread Steven D'Aprano
do we see that demo? > Soon Bridge will be released as an open source project. We’d love to > hear your opinions about this project. We’re really excited and we can’t > wait to see Python being used in more and more places! > > > ** > > Thanks, Tal** > > * -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Can math.atan2 return INF?

2016-06-21 Thread Steven D'Aprano
Are there any circumstances where math.atan2(a, b) can return an infinity? I know it will return a NAN under some circumstances. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Proposal: named return values through dict initialization and unpacking

2016-06-21 Thread Steven D'Aprano
ar1, var2=var2, var3=var3, var4=33) How is dict supposed to know what var1 etc. are? The dict constructor has no more magical insight into the caller's locals as any other function. Also, this is legal syntax now: d = {'a': 1} mydict = dict(d, spam=999) giving {'spam': 999, 'a': 1}. Your proposal would return: {'spam': 999, 'd': {'a': 1}} or would have an ambiguous case where the caller would never be sure which behaviour takes precedence. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Can math.atan2 return INF?

2016-06-21 Thread Steven D'Aprano
On Wed, 22 Jun 2016 04:01 am, Pierre-Alain Dorange wrote: > Steven D'Aprano wrote: > >> Are there any circumstances where math.atan2(a, b) can return an >> infinity? >> >> I know it will return a NAN under some circumstances. > > atan or atan2 can

Re: Can math.atan2 return INF?

2016-06-21 Thread Steven D'Aprano
On Wed, 22 Jun 2016 04:32 am, Jussi Piitulainen wrote: > [email protected] (Pierre-Alain Dorange) writes: > >> Steven D'Aprano wrote: >> >>> Are there any circumstances where math.atan2(a, b) can return an >>> infinity? [...] > I didn

Unexpected NANs in complex arithmetic

2016-06-21 Thread Steven D'Aprano
en more strange: py> 1*z (inf+nanj) Is this the right behaviour? If so, what's the justification for it? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Operator Precedence/Boolean Logic

2016-06-21 Thread Steven D'Aprano
On Wednesday 22 June 2016 13:40, Elizabeth Weiss wrote: > Hi There, > > I am a little confused as to how this is False: > > False==(False or True) > > I would think it is True because False==False is true. Remember that parentheses are always evaluated first. So Python evaluates: False or Tru

Re: Unexpected NANs in complex arithmetic

2016-06-21 Thread Steven D'Aprano
On Wednesday 22 June 2016 13:54, Dan Sommers wrote: > By the time Python returns a result for inf+3j, you're already in > trouble (or perhaps Python is already in trouble). I don't see why. It is possible to do perfectly sensible arithmetic on INFs. > A complex number has > a real part and an i

Re: Unexpected NANs in complex arithmetic

2016-06-22 Thread Steven D'Aprano
On Wednesday 22 June 2016 12:57, Chris Angelico wrote: > On Wed, Jun 22, 2016 at 12:48 PM, Steven D'Aprano > wrote: >> I'm doing some arithmetic on complex numbers involving INFs, and getting >> unexpected NANs. >> >> py> INF = float('inf'

Re: Unexpected NANs in complex arithmetic

2016-06-22 Thread Steven D'Aprano
On Wednesday 22 June 2016 16:58, Steven D'Aprano wrote: > But it makes no sense to me to introduce a NAN into a calculation > just because you multiply by 1, even if it includes an INF. And multiplying > by -1 should be identical to negating. Ah, not one second after I hit send

Re: EuroPython 2016 Conference App - Ready for installation

2016-06-22 Thread Steven D'Aprano
On Wed, 22 Jun 2016 10:31 pm, M.-A. Lemburg wrote: > You can create a profile within the app (or link this to your existing > social accounts), share messages and photos, and easily reach out to > other fellow attendees. o_O I have no words. -- Steven -- https://mail.python.or

Is signed zero always available?

2016-06-22 Thread Steven D'Aprano
available that don't support signed zeroes? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Is signed zero always available?

2016-06-22 Thread Steven D'Aprano
igurable: you can specify whether to get ±INF or to signal divide by zero. Unfortunately although most CPUs and FPUs support this behaviour, support for it in compilers is mostly poor.) But where signed zeroes really become useful is when dealing with branch cuts for complex elementary functio

Re: Operator Precedence/Boolean Logic

2016-06-22 Thread Steven D'Aprano
s - non-empty sequences This is an improvement over other languages like Javascript, Ruby, etc where the division between truthy and falsey appears to be fairly arbitrary. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Can math.atan2 return INF?

2016-06-22 Thread Steven D'Aprano
x == y, the answer should be the same as for any other pair of x == y. It might not be a *great* reason, but it's a reason. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Can math.atan2 return INF?

2016-06-22 Thread Steven D'Aprano
On Thursday 23 June 2016 14:40, Dan Sommers wrote: >> Since x == y, the answer should be the same as for any other pair of x == y. > > When x == y == 0, then atan2(y, x) is 0. /s/any other pair of x == y/any other pair of x y except for zero/ :-P Zero is exceptional in many ways. -- Steve

Re: Operator Precedence/Boolean Logic

2016-06-23 Thread Steven D'Aprano
On Thursday 23 June 2016 16:34, Andreas Röhler wrote: > Indeed, why should the result of 4 - 4 have a different truth-value than > 4 - 3 ? Because 4-4 is zero, which is "nothing", while 4-3 is one, which is "something". You might as well ask why False and True have different truth values. Iron

Re: Operator Precedence/Boolean Logic

2016-06-23 Thread Steven D'Aprano
On Thursday 23 June 2016 14:47, Lawrence D’Oliveiro wrote: > On Thursday, June 23, 2016 at 3:12:52 PM UTC+12, Larry Hudson wrote: >> On 06/22/2016 12:42 AM, Lawrence D’Oliveiro wrote: >>> * boolean operators don’t have to operate on boolean values. The >>> language spec >>>

Re: Break and Continue: While Loops

2016-06-23 Thread Steven D'Aprano
On Thursday 23 June 2016 14:17, Elizabeth Weiss wrote: > CODE #2: > > i=0 > while True: >i=i+1 > if i==2: > print("Skipping 2") > continue > if i==5: > print("Breaking") > break >print(i) > > -- > > Questions: > 1. what does the word True have to do with anyt

Re: Operator Precedence/Boolean Logic

2016-06-23 Thread Steven D'Aprano
On Thursday 23 June 2016 18:17, Antoon Pardon wrote: > No zero is not nothing. I think you have just disagreed with about four thousand years of mathematicians and accountants. In fact, mathematicians were so hung up about zero being nothing, that it took about three thousand years before they

Re: Operator Precedence/Boolean Logic

2016-06-23 Thread Steven D'Aprano
On Thursday 23 June 2016 18:32, Andreas Röhler wrote: > There is a fundamental diff between zero and emptiness. In English, "emptiness" implies a container (real or figurative). The container is not "something or nothing", it is the *contents* being referred to. "This shopping bag is empty" doe

Re: Operator Precedence/Boolean Logic

2016-06-23 Thread Steven D'Aprano
On Thursday 23 June 2016 17:58, Antoon Pardon wrote: > Op 23-06-16 om 05:59 schreef Steven D'Aprano: >> On Thu, 23 Jun 2016 01:12 pm, Larry Hudson wrote: >> >>> On 06/22/2016 12:42 AM, Lawrence D’Oliveiro wrote: >>> [snip] >>>> I feel that’s

Re: Operator Precedence/Boolean Logic

2016-06-23 Thread Steven D'Aprano
On Thu, 23 Jun 2016 08:21 pm, Antoon Pardon wrote: > Op 23-06-16 om 11:39 schreef Steven D'Aprano: [...] >> To decide on a branch, you don't need an actual bool, anything capable of >> acting like a bool will do. As a language design, ALL objects are capable >> of a

Re: Operator Precedence/Boolean Logic

2016-06-23 Thread Steven D'Aprano
On Thu, 23 Jun 2016 11:26 pm, Random832 wrote: > On Thu, Jun 23, 2016, at 08:37, Steven D'Aprano wrote: >> You keep saying that, but I've never seen it happen. I've seen cases >> where people have been surprised by the unexpected truthiness of an >> object (&qu

Re: Can math.atan2 return INF?

2016-06-23 Thread Steven D'Aprano
On Fri, 24 Jun 2016 01:04 am, alister wrote: > which infinity. There are many - some larger than others China has just announced a new supercomputer that is so fast it can run an infinite loop in 3.7 seconds. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: the global keyword:

2016-06-23 Thread Steven D'Aprano
use the fully-qualified name builtins.x.) If Rick wishes to argue for a different definition of "global variable", Rick should explain what his definition is, and why we should prefer it to mine. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Question on compiling on linux

2016-06-24 Thread Steven Truppe
and 64bit) ? I'm new to Makefiles and ./configure, i used MSVC2010 on windows and try to understand how this things do work under linux - can someone please help me out here ?? Thanks in advance, Steven Truppe -- https://mail.python.org/mailman/listinfo/python-list

Re: Question on compiling on linux

2016-06-24 Thread Steven Truppe
So back to my first question now that you saw everything worked fine, but there is no python.so file, did i miss something when using ./configure ? Am 2016-06-24 um 20:23 schrieb Chris Angelico: On Sat, Jun 25, 2016 at 4:19 AM, Steven Truppe wrote: But that's not a library file, it&

Re: Question on compiling on linux

2016-06-24 Thread Steven Truppe
That gives me many .so files but no python*.so* file :( Am 2016-06-24 um 20:35 schrieb Steven Truppe: So back to my first question now that you saw everything worked fine, but there is no python.so file, did i miss something when using ./configure ? Am 2016-06-24 um 20:23 schrieb Chris

Re: Question on compiling on linux

2016-06-25 Thread Steven Truppe
2016 at 2:28 PM, Steven Truppe wrote: That gives me many .so files but no python*.so* file :( Where are you finding these many .so files? There should be libpython3.5m.so in the root of the source tree (alongside `python`). By the way, I'm not sure how you're accessing the list/news

Re: How to reset IPython notebook file association

2016-06-25 Thread Steven D'Aprano
se it again? Have you tried setting it to Open With iPython? -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Break and Continue: While Loops

2016-06-26 Thread Steven D'Aprano
to "boxed" booleans, i.e. native bools in an object wrapper? -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Assignment Versus Equality

2016-06-26 Thread Steven D'Aprano
e about the commercial success. Fortran certainly has been extremely popular, albeit almost entirely in numerical computing. But PL/I has virtually disappeared from the face of the earth, while Pascal still has a small but dedicated community based on FreePascal, GNU Pascal, and Delphi. (Of the three

Re: Can math.atan2 return INF?

2016-06-26 Thread Steven D'Aprano
ose who just have to take their word for it. "God wants you to give me your money, honest. Oh, and he also doesn't want you to eat carrots. Don't question the Lord!" [1] Apart from black swans, which came as an awful shock for philosophers when they learned of their existence. -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Empty List

2016-06-26 Thread Steven D'Aprano
tart or the middle; - sort the list; - reverse the list; - pull items out of the list; - count how many items are in the list; - search for matching items and many more. The sky is the limit, and that's what programming is about. Just because the list *starts* as empty doesn't mean it mu

Re: Operator Precedence: One Thing Python Got Right

2016-06-26 Thread Steven D'Aprano
On Mon, 27 Jun 2016 02:20 pm, Lawrence D’Oliveiro wrote: > There is one thing Python did not slavishly copy from C. Only one? -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/pyt

Re: argparse and subparsers

2016-06-27 Thread Steven D'Aprano
On Monday 27 June 2016 15:34, Lawrence D’Oliveiro wrote: > On Monday, June 27, 2016 at 4:56:10 PM UTC+12, Sachin Garg wrote: > >> # Set verbose flag >> verbose = False >> if arguments['--verbose']: >> verbose = True >> elif arguments['-q']: >> verbose = False > > Don’t you just love code

Re: Operator Precedence: One Thing Python Got Right

2016-06-27 Thread Steven D'Aprano
tting in the > parentheses anyway means the fragment of code stays interchangeable with > C. Do you write much Python code that you expect to also be valid C code? -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://

Re: Assignment Versus Equality

2016-06-27 Thread Steven D'Aprano
il client) defaulting to legacy encodings like Latin-1 and especially not Windows 1252. Certainly the user should be permitted to explicitly set the encoding, but otherwise the program should default to UTF-8. -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and su

Where do i find the 32 bit libraries on my 64 bit ubuntu system

2016-06-27 Thread Steven Truppe
Hi all, i want to write an application that works for both 32 bit and 64bit on my 64bit ubuntu system, my problem i only find 64bit libraries under /usr/lib, there is also a path callled /x86_64-linux-gnu/ <- are these the libraries i should use for 32 bit and 64 bit programming ?? -- https:/

Re: Assignment Versus Equality

2016-06-27 Thread Steven D'Aprano
On Tue, 28 Jun 2016 12:23 am, Rustom Mody wrote: > On Monday, June 27, 2016 at 6:58:26 PM UTC+5:30, Steven D'Aprano wrote: >> On Mon, 27 Jun 2016 10:48 pm, Rustom Mody wrote: >> >> > PS Google Groups is wise enough to jump through hoops trying to encode >> >

Re: Assignment Versus Equality

2016-06-27 Thread Steven D'Aprano
everything I've seen suggests that Algol treats spaces like modern languages. http://www.masswerk.at/algol60/algol60-syntaxversions.htm Space is listed as a separator, and *not* in indentifiers. -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Assignment Versus Equality

2016-06-27 Thread Steven D'Aprano
the need for spaces. [1] Almost. He has previously created a high-level assembly language, Speedcoding, for IBM, which can be considered the predecessor of Fortran. -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: __all__ attribute: bug and proposal

2016-06-27 Thread Steven D'Aprano
= "filename" (2) For backwards-compatibility, we still need to support the old way of writing __all__, using names given as strings: __all__ = ('prefs_file', 'A', 'B', 'C') But now you have an ambiguity. If __all__ looks like this: __all__ = (prefs_file, A, B, C) does the first entry mean "import the value 'filename'" (new behaviour), or does it mean "import the value with the name 'filename'" (old behaviour)? -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Question on compiling on linux

2016-06-27 Thread Steven D'Aprano
bother: ~ Subject: Re: Project X ~ From: George ~ ~ I'll discuss it with Bob. ~ ~ He's a tit and I'm pretty sure he's overcharging us. Tell him ~ nothing. -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Question on compiling on linux

2016-06-27 Thread Steven D'Aprano
n**2). Now imagine that each email contains at least one paragraph of text, plus (oh joy) an email disclaimer, plus (say) a ten line signature, *all* of which is typically commented because gods forbid that people use a signature marker "-- "[1] or that email clients trim anything belo

Re: __all__ attribute: bug and proposal

2016-06-27 Thread Steven D'Aprano
l__, and if present, tests > that it works. It probably executes 'from module import *'. A side > effect is testing that everything imports. I am pretty sure that > test___all__ has caught bugs. I write my own unit tests for __all__, which has certainly caught bugs. -- Steven

Re: Assignment Versus Equality

2016-06-27 Thread Steven D'Aprano
On Tuesday 28 June 2016 14:31, Rustom Mody wrote: > On Tuesday, June 28, 2016 at 6:36:06 AM UTC+5:30, Steven D'Aprano wrote: >> On Tue, 28 Jun 2016 12:23 am, Rustom Mody wrote: >> > Also how is GG deliberately downgrading clear unicode content to be kind >> > to o

Re: Can math.atan2 return INF?

2016-06-27 Thread Steven D'Aprano
On Tuesday 28 June 2016 16:12, Gregory Ewing wrote: > Rustom Mody wrote: >> I said that for the Haskell list [0..] >> >> [0..] ++ [-1] == [0..] >> >> He said (in effect) yes that -1 would not be detectable but its still there! > > The code to generate it is there, but it will never > be execute

Re: Meta decorator with parameters, defined in explicit functions

2016-06-28 Thread Steven D'Aprano
On Tuesday 28 June 2016 15:02, Ben Finney wrote: > Howdy all, > > I want an explicit replacement for a common decorator idiom. > > There is a clever one-line decorator that has been copy-pasted without > explanation in many code bases for many years:: > > decorator_with_args = lambda decora

Re: Processing text data with different encodings

2016-06-28 Thread Steven D'Aprano
together without thinking about the encoding. Is this spam? In my experience, the only email that is that badly constructed is spam. I can't imagine how it could be email from a person, coming from a mail client like Thunderbird or Outlook. -- Steven “Cheer up,” they said, “things could be w

What the deal with python3.5m.so and python3.5.so ??

2016-06-28 Thread Steven Truppe
Hi all, can someone tell me the difference between python3.5m.so and python3.5.so ?? Tanks in advance, Steven Truppe -- https://mail.python.org/mailman/listinfo/python-list

Re: Processing text data with different encodings

2016-06-28 Thread Steven D'Aprano
to OS X, then it probably means a per-mill sign ‰. > Now, I can't to this, because 0xe4 isn't valid utf-8: >>>> e.decode('utf-8') > Traceback (most recent call last): > File "", line 1, in > UnicodeDecodeError: 'utf-8' codec can&#

Re: Processing text data with different encodings

2016-06-28 Thread Steven D'Aprano
the same with >>> .decode('utf-8'), the result is a working u umlaut with 0xfc in the log. But that is, I think, impossible. You must be misinterpreting what you are seeing, or confusing output in the log when it used a different encoding. py> 'ü'.encode('utf-8') b'\xc3\xbc' not 0xFC. More to follow... -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Processing text data with different encodings

2016-06-28 Thread Steven D'Aprano
he docs for further details. Alternatively, you could try: for l in sys.stdin.buffer: try: l = l.decode('utf-8', errors='strict') except UnicodeDecodeError: l = l.decode('latin1') # May generate mojibake. print(repr(l)) # or log it, whiche

Re: Iteration, while loop, and for loop

2016-06-28 Thread Steven D'Aprano
"Ok, the Space Shuttle is really complicated, but you can ride a bicycle instead" and then teach them to ride a pushbike. -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Can math.atan2 return INF?

2016-06-28 Thread Steven D'Aprano
On Tue, 28 Jun 2016 11:39 pm, Random832 wrote: > On Sun, Jun 26, 2016, at 22:59, Steven D'Aprano wrote: >> We have no way of seeing what goes on past the black hole's event >> horizon, since light cannot escape. But we can still see *some* >> properties of black

Re: Sharing package data across files

2016-06-28 Thread Steven D'Aprano
s: In foo, you have bar pointing to some object: bar ---> OBJ "from foo import bar" creates a new local variable which likewise points to the same OBJ (no copy is made): foo.bar ---> OBJ ^ | a.bar + Assignment changes the po

Re: Sharing package data across files

2016-06-28 Thread Steven D'Aprano
alent to spam.foo += 1 obviously spam's foo will change, but vars' foo doesn't. It's in a different namespace, and assignment doesn't reach into different namespaces unless you give the fully-qualified name. (That would be bad.) Inside spam, you don't need to say &

Re: Assignment Versus Equality

2016-06-28 Thread Steven D'Aprano
; and only if such an encoding can be found. For most messages, it can use > US-ASCII. For most of the remainder it can use some ISO-8859 or > Windows-125x encoding. There's never any need to downgrade to a non-Unicode encoding, at least not by default. Well, maybe in Asia, I don't know how well Asian software supports Unicode. -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Assignment Versus Equality

2016-06-28 Thread Steven D'Aprano
wrong, it's a matter of what you value. Whereas some decisions are just dumb: https://www.jwz.org/blog/2010/10/every-day-i-learn-something-new-and-stupid/ -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.o

Re: "for/while ... break(by any means) ... else" make sense?

2016-06-28 Thread Steven D'Aprano
ith the next item break else: default() The "else" in for...else has nothing to do with any "if" inside the for block. -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Assignment Versus Equality

2016-06-28 Thread Steven D'Aprano
On Wednesday 29 June 2016 14:51, Lawrence D’Oliveiro wrote: > On Wednesday, June 29, 2016 at 4:20:24 PM UTC+12, Chris Angelico wrote: >>> https://www.jwz.org/blog/2010/10/every-day-i-learn-something-new-and- stupid/ >> >> """It would also be reasonable to assume that any sane language >> runtime

Re: Assignment Versus Equality

2016-06-28 Thread Steven D'Aprano
On Wednesday 29 June 2016 15:51, Lawrence D’Oliveiro wrote: > On Wednesday, June 29, 2016 at 5:26:46 PM UTC+12, Steven D'Aprano wrote: >> BUT in Python 3, the distinction between int and long is gone by dropping >> int and renaming long as "int". So all Python

Re: Can math.atan2 return INF?

2016-06-29 Thread Steven D'Aprano
On Sunday 26 June 2016 09:40, Gregory Ewing wrote: > Marko Rauhamaa wrote: >> [email protected] (Pierre-Alain Dorange): >> >>>Near a black hole 3.7 seconds can last an infinite time... >> >> Which phenomenon prevents a black hole from ever forming. Yet >> astronomers keep telling

Re: Assignment Versus Equality

2016-06-29 Thread Steven D'Aprano
On Wed, 29 Jun 2016 06:09 pm, Chris Angelico wrote: > On Wed, Jun 29, 2016 at 4:45 PM, Steven D'Aprano > wrote: >> On Wednesday 29 June 2016 15:51, Lawrence D’Oliveiro wrote: >> >>> On Wednesday, June 29, 2016 at 5:26:46 PM UTC+12, Steven D'Aprano wrote:

Re: Operator Precedence/Boolean Logic

2016-06-29 Thread Steven D'Aprano
thon, due to historical accident, ended up working the way I prefer. When you design your own language, you can make it work the way you prefer. [...] > More significant... > > Steven D'Aprano wrote: > >> So we have falsey values: Note that the question of truthy/falsey duck-typed

Re: Operator Precedence/Boolean Logic

2016-06-29 Thread Steven D'Aprano
On Wed, 29 Jun 2016 11:30 pm, Rustom Mody wrote: > The other answers -- graphs and automata -- are questionable and/or wrong > > You may wish to think about them again? You may wish to justify your assertion. -- Steven “Cheer up,” they said, “things could be worse.” So I cheere

Re: Operator Precedence/Boolean Logic

2016-06-29 Thread Steven D'Aprano
On Thu, 30 Jun 2016 01:00 am, Grant Edwards wrote: > On 2016-06-29, Steven D'Aprano wrote: > >> To Nick, having 1+True return 2 is an accident of implementation, > > My recollection is that it was not an accident of impliementation. It > was an intentional descisio

Re: Iteration, while loop, and for loop

2016-06-29 Thread Steven D'Aprano
7;bananas') py> for char in mi: ... if char == 'a': ... mi.extend(' yum') ... print(char, end='') ... else: # oh no, the feared for...else! ... # needed to prevent the prompt overwriting the output ... print() ... bananas yum yum yu

Re: "for/while ... break(by any means) ... else" make sense?

2016-06-29 Thread Steven D'Aprano
r better or worse, 'else' was > chosen, which can be thought of as having no relation to the other use of > the same keyword in the 'if' statement. The only rationale behind this was > to save one keyword. Agreed. -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Assignment Versus Equality

2016-06-29 Thread Steven D'Aprano
is a much better approach. Because it is a monopole, it is detectable from a distant more easily than a magnetic bipole, and while magnets are going to be vaporised into plasma (hence losing their magnetic field), electrons are electrons (at least until you get into the quantum gravity regime, at which

Re: Meta decorator with parameters, defined in explicit functions

2016-06-29 Thread Steven D'Aprano
who just write: @memoise(1000) def myfunc(arg): ... etc. as needed. But with your version, you have to make decorator_with_args a public part of the API, and require the user to write: @decorator_with_args(memoise, 1000) def myfunc(arg): ... which I maintain is a much inferior API for the users o

Re: "for/while ... break(by any means) ... else" make sense?

2016-06-29 Thread Steven D'Aprano
On Thu, 30 Jun 2016 11:28 am, Chris Angelico wrote: > On Thu, Jun 30, 2016 at 10:27 AM, Steven D'Aprano > wrote: >> Following os.abort(), the interpreter exits in the hardest, quickest >> manner possible. > > os.kill(os.getpid(), 9) > > Now THAT is the ha

Re: Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions

2016-06-30 Thread Steven D'Aprano
On Thursday 30 June 2016 17:43, Lawrence D’Oliveiro wrote: > On Thursday, June 30, 2016 at 7:26:01 PM UTC+12, Peter Otten wrote: >> foo = lambda : >> >> there is syntactic sugar in Python that allows you to write it as >> >> def foo(): >> return >> >> with the nice side effects that it im

Re: Can math.atan2 return INF?

2016-06-30 Thread Steven D'Aprano
On Thursday 30 June 2016 12:13, Rustom Mody wrote: > OTOH Computer Science HAPPENED because mathematicians kept hotly disputing > for more than ½ a century as to what is legitimate math and what is > theology/mysticism/etc: I really don't think so. Computer science happened because people invente

<    31   32   33   34   35   36   37   38   39   40   >