Here is an example of how it could be done.
https://gist.github.com/stephanh42/97b47506e5e416f97f5790c070be7878
Stephan
Op di 31 jul. 2018 01:29 schreef Steven D'Aprano :
> On Tue, Jul 31, 2018 at 10:10:32AM +1200, Greg Ewing wrote:
> > Jamesie Pic wrote:
> > >def o.bar(self): ...
> >
> > You
Op di 31 jul. 2018 20:49 schreef Jonathan Fine :
> David Mertz wrote:
>
> > `spam?.eggs?.cheese?.aardvark` is NOT redundant for
> > `spam?.eggs.cheese.aardvark`. The two expressions simply do different
> > things [...]
>
> I agree, assuming ?. is a binary operator.
It isn't.
Given this, in Py
Op wo 1 aug. 2018 10:50 schreef Chris Angelico :
> On Wed, Aug 1, 2018 at 6:45 PM, Jonathan Fine wrote:
> > Hi Chris
> >
> > Thank you for your reply. I think we're making good progress.
> >
> > You wrote
> >
> >>> 10) a ?. b ?. c
> >>> 11) (a ?. b) ?. c
> >>
> >> I would parse those differently,
Op wo 1 aug. 2018 11:10 schreef Jonathan Fine :
>
>
> You're right to be cautious. My understanding of PEP 505 is that
> #13. a ?. b ?. __str__
> #14. (a ?. b) ?. __str__
> are not equivalent. The first is None, and the other is None.__str__.
> That looks like a gotcha.
>
No.
None.?__str__
prod
I use these Vim abbreviations,
which are derived from LaTeX
https://gist.github.com/stephanh42/fc466e62bfb022a890ff2c4643eaf3a5
Stephan
Op za 4 aug. 2018 20:03 schreef David Mertz :
> On Sat, Aug 4, 2018, 1:24 PM Steven D'Aprano wrote:
>
>> If you think the uproar over PEP 572 was vicious, ima
Let me stand up and say that I personally like lambda. It's the standard
terminology and not easily confused.
I doubt that "many Python users" have a problem with it. Evidence?
I dislike the def proposal strongly.
It is too similar to a normal def.
At least get a new keyword then
Some other lang
Op wo 22 aug. 2018 18:40 schreef Steven D'Aprano :
> Chris' conclusion is that anonymous functions are inherently hard for
> many beginners to learn, regardless of whether the syntax is called
> "lambda" or "function".
>
Civilization itself had trouble with the concept. Functions as mathematical
Fwiw, I usually don't do
def foo():
if False: yield None
But simply:
def foo():
return ()
That the returned iterable is not a generator seldom matters.
Stephan
Op wo 22 aug. 2018 21:17 schreef Chris Angelico :
> On Thu, Aug 23, 2018 at 3:56 AM, Rhodri James
> wrote:
> > On 22/08/18 1
Op do 23 aug. 2018 09:06 schreef Jacco van Dorp :
> I think it would have been better to use def from the start instead of
> lambda. The only thing JS does right is using the same "function" keyword
> for both of these.
>
Seriously?
Consider how the following code
function f() { return 42; }
Op za 25 aug. 2018 02:28 schreef Chris Barker - NOAA Federal via
Python-ideas :
>
>
> Too bad all the cool kids are doing web dev these days — hard to get
> help with a desktop GUI project :-(
>
Pywebview seems interesting, uses a platform webview to put up the UI;
https://github.com/r0x0r/pywe
I
Op wo 29 aug. 2018 07:53 schreef Greg Ewing :
> Wes Turner wrote:
> > I'm going to re-write that in a pseudo-Eiffel like syntax:
>
> Maybe some magic could be done to make this work:
>
> def __init__(self, img: np.ndarray, x: int, y: int, width: int,
> height: int) -> Non
I would also like to point out that the current behavior of Fraction
is consistent with other parts of the numeric system, e.g.
1/1 produces 1.0 (rather than 1)
math.sqrt(4) produces 2.0 (rather than 2)
1j-1j produces 0j (rather than 0.0 or 0)
So in general the type of the output is determined by
I am pretty sure that on systems which support it, Python's stack and data
are already NX.
NX is basically the default on modern systems.
Stephan
Op ma 3 sep. 2018 09:00 schreef Wes Turner :
> Rationale
> =
> - Separation of executable code and non-executable data is a good thing.
> - A
Op za 8 sep. 2018 13:33 schreef Paddy3118 :
>
> I would like to propose that Python add a Unicode-aware *str.reverse *method.
> The problem is, I'm a Brit, who only speaks English and only very rarely
> dips into Unicode.* I don't know how useful this would be!*
>
To be honest, quite apart from
My 3 cents:
1. My most objective objection against the f(*, foo, bar, baz) syntax is
that it looks like positional arguments, and the syntactic marker *
which
dissuades you of that can be arbitrarily far apart from the keyword.
2. The syntax f(=foo, =bar, =baz) at least solves that problem
Op di 11 sep. 2018 om 10:42 schreef Brice Parent :
> Le 11/09/2018 à 02:15, Abe Dillon a écrit :
>
> [Steven D'Aprano]
>
>> It would be great for non-C coders to be able to prototype proposed
>> syntax changes to get a feel for what works and what doesn't.
>
>
> I think it would be great in genera
Op do 13 sep. 2018 12:03 schreef Antoine Pitrou :
> On Thu, 13 Sep 2018 11:55:40 +0200
> "Giampaolo Rodola'"
> wrote:
> >
> > This is simply ridiculous. I'm not sure if this is political
> > correctness pushed to its limits or just trolling.
>
> Indeed she might be trolling. Though the fact we'r
Hi all,
I would like to add that I don't believe that discoverability is
always better in the `builtins' module.
I personally had the experience of going over itertools, where
I found 'zip_longest', but I couldn't find a 'zip_shortest'.
Only after some googling I found out it was called `zip' an
I must admit I am a bit partial to partial, you can do fun things like this:
>>> from functools import partial
>>> @partial(partial, partial)
... def add(x, y):
... return x+y
...
>>> add(3)(4)
7
I suppose that isn't exactly going to convince Guide to put it in builtins,
though.
Stephan
2
Hi all,
I just tried with this official Python binary:
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32
bit (Intel)] on win32
and CTRL-L for sure does clear the window. It just doesn't then move the
prompt to the top, so you end up with a bunch of empty lines, followed by
console or PS?
>
>
> Best regards,
>
> JM
>
> quinta-feira, 29 de Setembro de 2016 às 08:09:13 UTC+1, Stephan Houben
> escreveu:
>
>> Hi all,
>>
>> I just tried with this official Python binary:
>> Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:
ault
> CPython distribution).
>
>
> Best regards,
>
> JM
>
>
>
> On 29-09-2016 08:56, Stephan Houben wrote:
>
> Hi JM,
>
> Windows 7 Enterprise
> "Microsoft Windows [Version 6.1.7601]"
>
> I am running Python directly from the shortcut
+∞
Another long-time user here who occasionally still makes this mistake.
Stephan
2016-10-05 19:29 GMT+02:00 Paul Moore :
> On 5 October 2016 at 18:17, Lisa Roach wrote:
> > +1
> >
> > I've definitely seen a lot of new users make this error, an improved
> message
> > could go a long way.
>
> I
Hi all,
One meta-question I have which may already have been discussed much earlier
in this whole proposal series, is:
How common is this problem?
Because I have the impression that nowadays all Linux distributions are
UTF-8 by default and you have to show some
bloody-mindedness to end up with a
Hi Victor,
2017-01-06 13:01 GMT+01:00 Victor Stinner :
>
> What do you mean by "eating mojibake"?
OK, I erroneously understood that the failure mode was that mojibake was
produced.
> Users complain because their
> application is stopped by a Python exception.
Got it.
> Currently, most Python 3
Hi Stephen,
2017-01-09 19:42 GMT+01:00 Stephen J. Turnbull <
turnbull.stephen...@u.tsukuba.ac.jp>:
>
> Private sector may be up to date, but academic sector
> (and from the state of e-stat.go.jp, government in general, I suspect)
> is stuck in the Jomon era.
>
I went to that page, checked the HTM
Hi INADA Naoki,
(Sorry, I am unsure if INADA or Naoki is your first name...)
While I am very much in favour of everything working "out of the box",
an issue is that we don't have control over external code
(be it Python extensions or external processes invoked from Python).
And that code will on
Something like:
from __syntax__ import decimal_literal
which would feed the rest of the file through the "decimal_literal"
transpiler.
(and not influence anything in other files).
Not sure if you would want to support multiple transpilers per file.
Note that Racket has something similar with th
Hi Petr,
2017-01-11 12:22 GMT+01:00 Petr Viktorin :
>
> For example, this may mean that a built-in Python string sort will give you
>> a different ordering than invoking the external "sort" command.
>> I have been bitten by this kind of issues, leading to spurious "diffs" if
>> you try to use sort
Hi Chris,
2017-01-12 13:17 GMT+01:00 Chris Angelico :
>
> Most of the time one of my students talks to me about decimal vs
> binary, they're thinking that a decimal literal (or converting the
> default non-integer literal to be decimal) is a panacea to the "0.1 +
> 0.2 != 0.3" problem.
Indeed. D
Hi Juraj,
I think this would be a very useful addition to the `math' module.
The gating issue is probably C compiler support.
The most important non-C99 C compiler for Python is probably MS Visual
Studio.
And that one appears to support it:
https://msdn.microsoft.com/en-us/library/mt720715.aspx
Hi Victor,
The fallback implementations in the various libc take care
to preserve the correct rounding behaviour.
Let me stress that *fused* multiply-add means the specific rounding
behaviour as defined in the standard IEEE-754 2008
(i.e. with guaranteed *no* intermediate rounding).
So the follo
n Mon, Jan 16, 2017 at 11:01:23AM +0100, Stephan Houben wrote:
>
> [...]
> > So the following would not be a valid FMA fallback
> >
> > double bad_fma(double x, double y, double z) {
> > return x*y + z;
> > }
> [...]
> > Upshot: if we want to provide
AS DO take advantage of
>> FMA within the underlying libraries.
>>
>> On Mon, Jan 16, 2017 at 10:06 AM, Guido van Rossum
>> wrote:
>>
>> Does numpy support this?
>>
>> --Guido (mobile)
>>
>> On Jan 16, 2017 7:27 AM, "Stephan Houben&quo
Hi Xavier,
In this bright age of IEEE-754 compatible CPUs,
it is certainly possible to achieve reproducible FP.
I worked for a company whose software produced bit-identical
results on various CPUs (x86, Sparc, Itanium) and OSes (Linux, Solaris,
Windows).
The trick is to closely RTFM for your CPU
For what it's worth, I normally just do:
global a
global b
But I've never needed more than two.
I think if you need more, then there is a serious style issue. That it
looks syntactically ugly is a feature.
Perhaps we should deprecate the comma in global ;-) .
Stephan
Op 23 jan. 2017 8:38 p.m.
Hi all,
It seems to me that the correct algorithm to get the "full suffix" is not
to take everything after the FIRST dot,
but rather to:
1. Recognize that the last suffix is one of the UNIX-style compression
tools .Z, .gz, ,bz2, .xz, .lzma (at least)
2. Then add the next-to-last suffix.
So we can
Hi all,
FWIW, I got the following statement from here:
https://github.com/numpy/numpy/wiki/Numerical-software-on-Windows
"Standard numpy and scipy binary releases on Windows use pre-compiled ATLAS
libraries and are 32-bit only because of the difficulty of compiling ATLAS
on 64-bit Windows. "
Mi
Hi all,
Visual C++ 2015 supports this one:
https://msdn.microsoft.com/en-us/library/h0dff77w.aspx
In any case, this is easy to implement an efficient fallback in C, unlike
the fma() function we discussed some time ago.
To put this in a bit wider perspective: would it be useful to investigate
ho
What about using a simple decorator instead?
def monkey_patch(cls):
return lambda func: setattr(cls, func.__name__, func)
class Foo:
pass
@monkey_patch(Foo)
def bar(self):
return 42
Foo().bar()
# gives 42
2017-02-10 11:15 GMT+01:00 Matthias welp :
> Hi Markus,
>
> Thanks for writin
Hi all,
I would like to add one more generic remark about syntax extensions,
regarding something
Markus said and which has bothered me before, also related to other syntax
proposals.
"Decorator approach is no different from doing `Foo.bar = bar` under the
function definition I think, except it re
Hi all,
For what it's worth, I believe that the "class extension" scenario from
Nick can be supported
using plain ol' metaclasses.
Not sure if this covers all desired capabilities, but at least the super()
mechanism works correctly.
Syntax is like this:
class Foo(metaclass=class_extend(Foo)):
Well to be pedantic, the code is obviously wrong since it assumes EOF is
generated by ctrl-D, but the user could have changed that with stty. It
should query the terminal settings instead...
Yeah I know, people who do that don't need the message.
Op 12 feb. 2017 4:26 p.m. schreef "Steve Dower" :
Seems slightly simpler to just make debugLog accept a callable as an
alternative to a string.
debugLog(lambda:( ‘info is %s’ % expensiveFunction()) )
Op 14 feb. 2017 18:42 schreef "Kyle Lahnakoski" :
Can you wrap the expensive functions in lambdas? And have your logger
evaluate it, only if req
Hi all,
If we want this it might be interesting to investigate what the Scheme
community
has been doing, since they have had this (under the name "promises") for
many years.
Basically:
Scheme: (delay expr)
<=>
proposed Python: delayed: expr
The Scheme community has experimented with what th
Proposal: Light-weight call-by-name syntax in Python
The following syntax
a : b
is to be interpreted as:
a(lambda: b)
Effectively, this gives a "light-weight macro system" to Python,
since it allows with little syntax to indicate that the argument to
a function is not to be immediat
Hi Nathaniel,
2017-02-17 11:28 GMT+01:00 Nathaniel Smith :
>
> Note that this is definitely a different proposal from the original,
> since the original proposer's goal was to be able to use this with
> existing, unmodified functions that expect a regular value, not a
> lambda.
>
> I don't really
proposal would be to make it non-associative,
you would have to write explicitly
a:: (b:: c)
or
(a:: b):: c
Stephan
Op 17 feb. 2017 22:35 schreef "Erik" :
On 17/02/17 10:22, Stephan Houben wrote:
> Proposal: Light-weight call-by-name syntax in Python
>
> The following
2017-02-18 11:55 GMT+01:00 Nathaniel Smith :
>
> This is also potentially a downside, though... the macro-call proposal
> not only handles the cases you're worrying about, but also handles a
> bunch of cases that are basically impossible to handle in Python right
> now. OTOH all the cases where yo
It's even in the Programming FAQ:
"In general in Python (and in all cases in the standard library) a method
that mutates an object will return None to help avoid getting the two types
of operations confused. So if you mistakenly write y.sort() thinking it
will give you a sorted copy of y, you’ll i
Of course, in Python 8 this naming convention will indeed be enforced.
https://mail.python.org/pipermail/python-dev/2016-March/143603.html
Op 1 mrt. 2017 15:16 schreef "Alexandre Brault" :
> Long story short, it's because there can be good reasons to ignore PEP8
> naming conventions. Linting to
Hi all,
I have a slight variant of the decorator proposal.
Rather than specify a count, let the decorator implement the typeshed
dunder convention:
@positional_only
def replace(self, __old, __new, count=-1):
(I imagine this decorator would also treat "self" as position_only,
so no need for _
A crucial difference between a set and a type is that you cannot
explicitly iterate over the elements of a type, so while we could implement
x in int
to do something useful, we cannot make
for x in int:
print(x)
Because if we could, we could implement Russell's paradox in Python:
R = set(x
In cases like this I would recommend creating the sentinel yourself:
NoDefault = object()
def get(store, key, default=NoDefault):
if default is NoDefault:
# do something
You can arrange to not export NoDefault so that the client code cannot even
access
the sentinel value.
This is str
On 02.03.2017 11:22, Stephan Houben wrote:
> > In cases like this I would recommend creating the sentinel yourself:
> >
> > NoDefault = object()
> >
> > def get(store, key, default=NoDefault):
> >if default is NoDefault:
> > # do something
> >
>
)
In that case I see a problem with this idiom:
newdict = dict(**olddict)
This would now start throwing errors in case any of the values of olddict
was NoDefault.
Stephan
2017-03-02 13:08 GMT+01:00 M.-A. Lemburg :
> On 02.03.2017 12:31, Stephan Houben wrote:
> > I am not sure if I f
his generator:
def bad_idea():
yield NoDefault
can we guarantee it works with all stuff in itertools?
And that is just the standard library. Now for all the stuff on Pypy..
Stephan
2017-03-02 13:35 GMT+01:00 Chris Angelico :
>
> On Thu, Mar 2, 2017 at 11:22 PM, Stephan Houben wrote
ished?)
Stephan
2017-03-02 15:18 GMT+01:00 Chris Angelico :
> On Fri, Mar 3, 2017 at 1:15 AM, Stephan Houben wrote:
>> I do not think such a magic linter can be written.
>> It seems an obvious instance of the Halting Problem to me.
>
> Yeah it can :) Static analysis is pretty im
I have in the past written a small utility to use compact signatures like:
i i -> i
to indicate a function taking two ints and returning an int.
See for example:
https://github.com/stephanh42/armasm
Op 7 mrt. 2017 10:43 a.m. schreef "George Fischhof" :
> Hi Guys,
>
> right now I had to call f
Hi all,
FWIW, I also strongly prefer the Verbal Expression style and consider
"normal" regular expressions to become quickly unreadable and
unmaintainable.
Verbal Expressions are also much more composable.
Stephan
2017-03-31 9:23 GMT+02:00 Stephen J. Turnbull
:
> Abe Dillon writes:
>
> > Note
FWIW, Javascript itself is moving away from this syntax in favour of a more
Python-like syntax based on the 'class' keyword. This was introduced in
EcmaScript 2015.
Stephan
Op 14 mei 2017 09:35 schreef "Simon Ramstedt" :
> Hi, thanks a lot for your feedback!
>
> On Sun, May 14, 2017, 00:54 Brend
Hi all,
Thanks to this thread I learned about the "attrs" library. I am a
heavy namedtuple (ab)user but I think
I will be using attrs going forward.
If something like attrs would made it in the standard library it would
be awesome.
Thanks,
Stephan
2017-05-16 20:08 GMT+02:00 Brett Cannon :
> Ma
d = attr.ib()
matrix = attr.ib(convert=numpy.asarray)
These are the main advantages I have encountered so far.
Stephan
2017-05-16 23:04 GMT+02:00 Guido van Rossum :
> Stephen,
>
> What features of attrs specifically solve your use cases?
>
> --Guido
>
> On Tue, May 16,
Hi Michel,
> Now OPP is already hard to teach to my students, but if I have to add
> this to the mix, I will just have to tell them to copy / paste it
> blindly for a long time before I can get to the point they can
> understand what it does.
About the teachability, some remarks:
1. You can still
ss.
Hope this clarifies my position.
Stephan
2017-05-17 13:37 GMT+02:00 Michel Desmoulin :
>
>
> Le 17/05/2017 à 13:08, Stephan Houben a écrit :
>> Hi Michel,
>>
>>> Now OPP is already hard to teach to my students, but if I have to add
>>> this to the mix,
Hi Sven,
> But even given that (and I am only speaking for my team), I haven't even
> seen a use-case for namedtuples in a year. Every time we considered it,
> people said: "please make it its own class for documentary purposes; this
> thing will tend to grow faster than we can imagine".
Using na
If this is the *only* objection to attrs let me quote some documentation:
"""
If playful naming turns you off, attrs comes with serious business aliases:
>>> from attr import attrs, attrib
>>> @attrs
... class SeriousCoordinates(object):
... x = attrib()
... y = attrib()
"""
So attrs and
Hi Sven,
"I hope the second ': int' can be omitted because 0 already is an int."
0 is also an Any, an object, a SupportAbs, and a Union[int, str].
And infinitely more, of course.
A typechecker needs to be explicitly told which was intended.
Stephan
Op 17 mei 2017 19:52 schreef "Sven R. Kunze"
Let me quote the attrs docs:
""
convert (callable) – callable() that is called by attrs-generated __init__
methods to convert attribute’s value to the desired format. It is given the
passed-in value, and the returned value will be used as the new value of
the attribute. The value is converted befo
s the docs.
Stephan
Op 19 mei 2017 20:36 schreef "Guido van Rossum" :
So it is only called by __init__ and not by __setattr__?
On Fri, May 19, 2017 at 11:32 AM, Stephan Houben
wrote:
> Let me quote the attrs docs:
>
> ""
> convert (callable) – callable() that is ca
Hi all,
Personally I feel that the current subinterpreter support falls short
in the sense that it still requires
a single GIL across interpreters.
If interpreters would have their own individual GIL,
we could have true shared-nothing multi-threaded support similar to
Javascript's "Web Workers".
it probably avoids headaches.
* Explicit is better than implicit, as somebody once said. ;-)
Stephan
2017-05-26 15:17 GMT+02:00 Nick Coghlan :
> On 26 May 2017 at 22:08, Stephan Houben wrote:
>> Hi all,
>>
>> Personally I feel that the current subinterpreter support falls s
Hi all,
The itertools.tee function can hold on to objects "unnecessarily".
In particular, if you do
iter2 = itertools.tee(iter1, 2)[0]
i.e. you "leak" one of the returned iterators, then all returned
objects are not collected until also iter2 is collected.
I propose a different implementation,
Hi Nick,
> I guess I'll have to scale back my hopes on that front to be closer to
> what Stephan described - even a deep copy equivalent is often going to
> be cheaper than a full serialise/transmit/deserialise cycle or some
> other form of inter-process communication.
I would like to add that in
ing seemed to confirm it.
That's what you get from reading the docs instead of the code.
There is even a justification in the code why it is 57 ;-)
Stephan
2017-05-27 18:53 GMT+02:00 Franklin? Lee :
> On Fri, May 26, 2017 at 2:45 PM, Stephan Houben wrote:
>> Hi all,
>>
>
Hi all,
Two remarks:
1. Note that ℯ also doesn't really work. While you can assign to this
identifier, it actually gets normalized into a plain "e".
2. Unicode has a
Σ : GREEK CAPITAL LETTER SIGMA
and a
∑ : N-ARY SUMMATION
The first is a valid Python identifier, the second not.
Unf
Or perhaps create a small module:
unimath.py==
import math
__all__ = ["π", "τ", "Γ"]
π = math.pi
τ = math.tau
Γ = math.gamma
Then do:
from unimath import *
Put it on the Python Package index.
If it gets wildly popular the case for pu
Or perhaps create a small module:
unimath.py==
import math
__all__ = ["π", "τ", "Γ"]
π = math.pi
τ = math.tau
Γ = math.gamma
Then do:
from unimath import *
Put it on the Python Package index.
If it gets wildly popular the case for pu
Tau was kind of a joke.
Stephan
Op 1 jun. 2017 09:47 schreef "Serhiy Storchaka" :
01.06.17 10:03, David Mertz пише:
It's awfully easy to add in your own code. Since they are simply aliases, I
> don't see why bother put the duplication in the standard library. You can
> even monkey patch if you
ST provide a Latin transliteration
of their names.
"""
Stephan
2017-06-01 10:06 GMT+02:00 Serhiy Storchaka :
> 01.06.17 10:53, Stephan Houben пише:
>>
>> Tau was kind of a joke.
>
>
> math.π is a kind of joke too.
>
> Honest, it is strange, t
> How do you write π (pi) with a keyboard on Windows, Linux or macOS?
On macOS, ⌥ P (Option-P) works.
On all platforms:
1. Make sure you are using Vim.
2. In insert mode: Ctrl-K *p
You can also define abbrev's which will allow you to type pi\ and it
gets replaced by π.
See:
https://gist.github.c
> This shouldn't be a problem for Greek users. ;-)
Well, they still need to switch between keymaps, since presumably
they used the Latin keymap to enter `math.` before they can enter π.
That is actually another general solution: just install the Greek keymap
in addition to your native keymap. The
17 12:32, Stephan Houben пише:
>>>
>>> math.π is a kind of joke too.
>>
>>
>> The point is that tau, being a joke, should not be considered as
>> setting a precedent.
>
>
> If add one joke feature per release, this one looks enough harmless.
>
>
Hi Masayuki,
I admit that my understanding of this issue is very limited.
Nevertheless, I would like to point out that the encoding assumed for a
Python3 source file never depends on the locale.
My understanding is that in the default encoding for Python source files
(utf-8), East Asian Ambiguou
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
I use the conceal feature for this purpose,
but I use
https://github.com/ehamberg/vim-cute-python
instead, which is a more toned-down version of the same idea.
I personally find
x ≤ y, a ∉ B
more readable than
x <= y, a not in B
etc.
Especially the conceal
lambda => λ
is useful for de-clutt
> My humble opinion: I would rather like to see something like:
>
> from some_wide_used_scientific_library.math_constants import *
>
> with good acceptance from scientific users before thinking to add it
> into stdlib.
Agree with this, but note that a similar proposal has once been made to sci
What about just adding the -I (isolated mode) flag to the #! line of
installed scripts?
I was actually surprised this is not already done for the Python scripts in
/use/bin on my Ubuntu box.
Stephan
Op 5 jun. 2017 02:52 schreef "Mike Miller" :
> I'd like to throw some cold water on this one, fo
What about doing it on the systems which *do* support it?
(Which probably covers 99% of the installed base...)
Stephan
Op 5 jun. 2017 11:59 schreef "Greg Ewing" :
> Stephan Houben wrote:
>
>> What about just adding the -I (isolated mode) flag to the #! line of
>> i
Would it not be a job for setuptools?
Setuptools creates the scripts.
Stephan
Op 5 jun. 2017 12:12 schreef "Oleg Broytman" :
On Mon, Jun 05, 2017 at 12:06:45PM +0200, Stephan Houben <
stephan...@gmail.com> wrote:
> What about doing it on the systems which *do* support it
. 2017 13:06 schreef "Nick Coghlan" :
> On 5 June 2017 at 19:49, Stephan Houben wrote:
> > What about just adding the -I (isolated mode) flag to the #! line of
> > installed scripts?
>
> Fedora & derivatives generally do do that, but as others noted, it can
> so
As already mentioned, Vim can display <= as ≤ using the ' conceal' feature.
(And in fact arbitrary substitutions, of course.)
Stephan
Op 7 jun. 2017 8:48 a.m. schreef "Brice PARENT" :
Le 07/06/17 à 07:34, Greg Ewing a écrit :
> Yes, there are a few symbols it would be nice to have.
> A prope
Hi Lucas,
I would consider converting the dict into a namedtuple then.
Essentially the namedtuple acts as a specification for expected fielsds:
abc = namedtuple("ABC", "a b c")
d = {"a":1, "b": 2, "c":3} # presumably you got this from reading some JSON
abc(**d)
# returns: ABC(a=1, b=2, c=3)
Ste
Huh? The semantics of node.js seem to be completely similar to Python in
this respect.
In both cases the circular import works if you go through the mutable
module object but fails if both modules circularly try to import module
members directly.
Stephan
Op 14 jun. 2017 11:17 a.m. schreef "Abdur
Hi Andy,
What you propose is essentially the "try .. catch .. in" construct as
described for Standard ML in:
https://pdfs.semanticscholar.org/b24a/60f84b296482769bb6752feeb3d93ba6aee8.pdf
Something similar for Clojure is at:
https://github.com/rufoa/try-let
So clearly this is something more peo
sing this construct now...
Stephan
2017-06-23 17:09 GMT+02:00 Andy Dirnberger :
> Hi Stephan,
>
> On Fri, Jun 23, 2017 at 6:23 AM, Stephan Houben
> wrote:
>>
>> Hi Andy,
>>
>> What you propose is essentially the "try .. catch .. in" construct as
&g
I would like to add that for example numpy ndarrays are iterables, but
they have an __add__ with completely different semantics, namely
element-wise ( numerical) addition.
So this proposal would conflict with existing libraries with iterable
objects.
Stephan
Op 25 jun. 2017 2:51 p.m. schreef "Se
Hi all,
Is "itertools.chain" actually that common?
Sufficiently common to warrant its own syntax?
In my experience, "enumerate" is far more common
among the iterable operations.
And that doesn't have special syntax either.
A minimal proposal would be to promote "chain" to builtins.
Stephan
20
ins,
let alone to give it dedicated syntax.
I also note that * for repetition is only supported for a few
iterables (list, tuple),
incidentally the same ones which support + for sequence chaining.
Stephan
2017-06-27 12:38 GMT+02:00 Steven D'Aprano :
> On Tue, Jun 27, 2017 at 11:01:32AM +0200
t;numerical processing", it is mostly
*symbolic* calculations and involves a lot of complex algorithms and
datastructures, including sequences.)
Stephan
2017-06-27 13:48 GMT+02:00 Steven D'Aprano :
> On Tue, Jun 27, 2017 at 01:32:05PM +0200, Stephan Houben wrote:
>> Hi Steven,
>>
1 - 100 of 178 matches
Mail list logo