Re: [Python-ideas] π = math.pi

2017-06-02 Thread Masayuki YAMAMOTO
Yes, it's correct. I'd show you a link to vim help for ambiguous width setting. http://vimdoc.sourceforge.net/htmldoc/options.html#'ambiwidth' Masayuki 2017-06-02 5:05 GMT+09:00 Ryan Gonzalez : > I'm slightly confused as to what you mean, but here goes: > > So you're saying that: > > - Glyphs l

Re: [Python-ideas] Security: remove "." from sys.path?

2017-06-02 Thread Greg Ewing
Victor Stinner wrote: You are right, it's the script directory that it added to sys.path and I would like to know if it would be possible to change that? Why do you want to change it? -- Greg ___ Python-ideas mailing list Python-ideas@python.org http

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Erik Bray
On Fri, Jun 2, 2017 at 7:52 AM, Greg Ewing wrote: > Victor Stinner wrote: >> >> How do you write π (pi) with a keyboard on Windows, Linux or macOS? > > > On a Mac, π is Option-p and ∑ is Option-w. I don't have a strong opinion about it being in the stdlib, but I'd also point out that a strong adv

Re: [Python-ideas] Security: remove "." from sys.path?

2017-06-02 Thread Niki Spahiev
On 1.06.2017 19:46, Chris Angelico wrote: On Fri, Jun 2, 2017 at 2:30 AM, Victor Stinner wrote: Perl 5.26 succeeded to remove the current working directory from the default include path (our Python sys.path): https://metacpan.org/pod/release/XSAWYERX/perl-5.26.0/pod/perldelta.pod#Removal-of-t

Re: [Python-ideas] Security: remove "." from sys.path?

2017-06-02 Thread Victor Stinner
2017-06-02 9:12 GMT+02:00 Greg Ewing : > Why do you want to change it? To make Python more secure. To prevent untrusted modules hijacking stdlib modules on purpose to inject code for example. Victor ___ Python-ideas mailing list Python-ideas@python.org

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Giampaolo Rodola'
On Thu, Jun 1, 2017 at 8:47 AM, Serhiy Storchaka wrote: > What you are think about adding Unicode aliases for some mathematic names > in the math module? ;-) > > math.π = math.pi > math.τ = math.tau > math.Γ = math.gamma > math.ℯ = math.e > > Unfortunately we can't use ∞, ∑ and √ as identifiers.

Re: [Python-ideas] Security: remove "." from sys.path?

2017-06-02 Thread Nick Coghlan
On 2 June 2017 at 20:02, Victor Stinner wrote: > 2017-06-02 9:12 GMT+02:00 Greg Ewing : >> Why do you want to change it? > > To make Python more secure. To prevent untrusted modules hijacking > stdlib modules on purpose to inject code for example. As long as user site packages are enabled, folks

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Ivan Levkivskyi
On 2 June 2017 at 12:17, Giampaolo Rodola' wrote: > On Thu, Jun 1, 2017 at 8:47 AM, Serhiy Storchaka > wrote: > >> What you are think about adding Unicode aliases for some mathematic names >> in the math module? ;-) >> >> math.π = math.pi >> math.τ = math.tau >> math.Γ = math.gamma >> math.ℯ = m

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Guido van Rossum
I would love to show how easy it is to write from math import pi as π, gamma as Γ but I had to cheat by copying from the OP since I don't know how to type these (and even if you were to tell me how I'd forget tomorrow). So, I am still in favor of the rule "only ASCII in the stdlib". On Fri, Jun

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Ivan Levkivskyi
On 3 June 2017 at 00:55, Guido van Rossum wrote: > [...] > So, I am still in favor of the rule "only ASCII in the stdlib". > But what about the other question? Currently, integral, sum, infinity, square root etc. Unicode symbols are all prohibited in identifiers. Is it possible to allow them? (

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Guido van Rossum
Are those characters not considered Unicode letters? Maybe we could add their category to the allowed set? On Jun 2, 2017 4:02 PM, "Ivan Levkivskyi" wrote: > On 3 June 2017 at 00:55, Guido van Rossum wrote: > >> [...] >> So, I am still in favor of the rule "only ASCII in the stdlib". >> > > But

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Matthias Bussonnier
> (Btw IPython just supports normal TeX notations like \pi, \lambda etc, so it > is very easy to remember) IPython dev here. I am the one who implemented (most of) that. We do support it, but it's not easy to remember unless you know how to write latex, and know said character. Question, how wou

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Steven D'Aprano
On Sat, Jun 03, 2017 at 01:02:12AM +0200, Ivan Levkivskyi wrote: > On 3 June 2017 at 00:55, Guido van Rossum wrote: > > > [...] > > So, I am still in favor of the rule "only ASCII in the stdlib". > > > > But what about the other question? Currently, integral, sum, infinity, > square root etc. Un

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Ivan Levkivskyi
On 3 June 2017 at 01:29, Guido van Rossum wrote: > Are those characters not considered Unicode letters? Maybe we could add > their category to the allowed set? > > Yes, they are not considered letters, they are in category Sm. Unfortunately, +, -, |, and other symbol that clearly should not be in

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Steven D'Aprano
On Fri, Jun 02, 2017 at 04:29:16PM -0700, Guido van Rossum wrote: > Are those characters not considered Unicode letters? Maybe we could add > their category to the allowed set? They're not letters: py> {unicodedata.category(c) for c in '∑√∫∞'} {'Sm'} That's Symbol, Math. One problem is that t

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Guido van Rossum
OK, I think this discussion is pretty much dead then. We definitely shouldn't allow math operators in identifiers, otherwise in Python 4 or 5 we couldn't introduce them as operators. On Fri, Jun 2, 2017 at 5:10 PM, Steven D'Aprano wrote: > On Fri, Jun 02, 2017 at 04:29:16PM -0700, Guido van Ross

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Juancarlo Añez
On Fri, Jun 2, 2017 at 7:29 PM, Guido van Rossum wrote: Are those characters not considered Unicode letters? Maybe we could add > their category to the allowed set? Speaking of which, it would be convenient to be able to build strings with non-ascii characters using their Unicode codepoint name:

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Chris Angelico
On Sat, Jun 3, 2017 at 10:38 AM, Juancarlo Añez wrote: > Speaking of which, it would be convenient to be able to build strings with > non-ascii characters using their Unicode codepoint name: > > greek_pi = "\u:greek_small_letter_pi" > > Or something like that. You mean: >>> greek_pi = "\N{GREEK

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Terry Reedy
On 6/2/2017 7:56 PM, Ivan Levkivskyi wrote: On 3 June 2017 at 01:29, Guido van Rossum > wrote: Are those characters not considered Unicode letters? Maybe we could add their category to the allowed set? Yes, they are not considered letters, they are in category

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Greg Ewing
Steven D'Aprano wrote: There's not much, if any, benefit to writing: ∫(expression, lower_limit, upper_limit, name) More generally, there's a kind of culture clash between mathematical notation and programming notation. Mathematical notation tends to almost exclusively use single-character

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Pavol Lisy
Sorry for probably stupid question! Is something like -> class A: def __oper__(self, '⊞', other): return something(self.value, other) a = A() a ⊞ 3 thinkable? On 6/3/17, Guido van Rossum wrote: > OK, I think this discussion is pretty much dead then. We definitel

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Chris Angelico
On Sat, Jun 3, 2017 at 3:42 PM, Pavol Lisy wrote: > Sorry for probably stupid question! Is something like -> > > class A: > def __oper__(self, '⊞', other): > return something(self.value, other) > > a = A() > a ⊞ 3 > > thinkable? No, because operators need to be def

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Joshua Morton
For reference, haskell is perhaps the closest language to providing arbitrary infix operators, and it requires that they be surrounded by backticks. That is A `op` B is equivalent to op(A, B) That doesn't work for python (backtick is taken) and I don't think anything similar is a good i

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Pavol Lisy
On 6/1/17, Serhiy Storchaka wrote: > What you are think about adding Unicode aliases for some mathematic > names in the math module? ;-) > > math.π = math.pi > math.τ = math.tau > math.Γ = math.gamma > math.ℯ = math.e > > Unfortunately we can't use ∞, ∑ and √ as identifiers. :-( My humble opinion

Re: [Python-ideas] π = math.pi

2017-06-02 Thread Stephan Houben
Hi Joshua, > A `op` B > > is equivalent to > > op(A, B This can of course be faked in Python. https://gist.github.com/stephanh42/a4d6d66b10cfecf935c9531150afb247 Now you can do: @BinopCallable def add(x, y): return x + y print(3 @add@ 5) === Stephan 2017-06-03