Steven D'Aprano wrote:
Or even the subject line of this email thread???
Sorry, crossed over discussions.
But I think it's also true that the null-coalescing
idea is for cases where it's not an error for something
to be None.
--
Greg
___
Python-ideas
> 3 нояб. 2016 г., в 0:28, Denis Akhiyarov
> написал(а):
>
> How does this compare to LINQ in .NET?
Denis,
PythonQL is very similar to LINQ actually. The syntax is a little different -
more Pythonic vs SQL, the clauses can be composed arbitrarily, we have named
tuples, that make nested q
On 11/2/2016 2:30 PM, Zero Piraeus wrote:
If I write something like obj.attr, the failure mode I care about is that
obj has no attribute attr, rather than that obj is specifically None (or
one of a defined group of somewhat Nonelike objects).
I agree with this understanding. The problem wit
On Thu, Nov 03, 2016 at 11:22:45AM +1300, Greg Ewing wrote:
> The proposed .? syntax is designed for cases where it's *not*
> an error for the object to be missing the attribute,
No it is not. That is absolutely not what the syntax means.
I'm sorry to single you out Greg, but have you read the
On 2016-11-02 21:57, Greg Ewing wrote:
MRAB wrote:
target = expr1 || expr2 || expr3
target = expr1 && expr2 && expr3
except that only None would be considered falsey?
Or would that be confusing?
Yes, I think that borrowing an operator from C but giving
it subtly different semantics w
On Thu, Nov 03, 2016 at 02:17:14AM +1000, Nick Coghlan wrote:
> Yeah, and so far the protocol based alternative I'm working on hasn't
> been any less headache-inducing (Mark has been reviewing some early
> iterations and had to draw a diagram to try to follow the proposed
> control flow).
Even if
On 2 November 2016 at 21:50, David Mertz wrote:
> Even though I really don't want new null-coalescing operators, I really
> appreciate the ternary operator in Python (or in C).
>
> On Wed, Nov 2, 2016 at 12:38 PM, Mikhail V wrote:
>>
>> result = a > b ? x : y
>>
>> is IMHO a syntactical herecy. S
On Wed, Nov 02, 2016 at 08:46:54AM -0700, Guido van Rossum wrote:
> But first we need to agree on what even the right definition
> of ?. is. It's been frighteningly difficult to explain this even on this
> list, even though I have a very clear view in my head,
This is Python-Ideas and with respe
MRAB wrote:
target = expr1 || expr2 || expr3
target = expr1 && expr2 && expr3
except that only None would be considered falsey?
Or would that be confusing?
Yes, I think that borrowing an operator from C but giving
it subtly different semantics would be *very* confusing,
especially to
On 10/31/16, Guido van Rossum wrote:
> For "everything to the right" it would seem we have some freedom: e.g. if
> we have "foo.bar?.baz(bletch)" is the call included? The answer is yes --
> the concept we're after here is named "trailer" in the Grammar file in the
> source code (
> https://githu
I actually think that Zero's point here is quite valid... At some earlier
point in the thread, I believe that Nick Coughlin was saying that we should
be asking ourselves _why_ we want to do something like this and the result
of that discussion was because there is pain when working with
"pseudo-str
On 10/15/16, Nick Coghlan wrote:
> * None-coalescing operator: x ?or y
> * None-severing operator: x ?and y
> * None-coalescing augmented assignment: x ?= y
> * None-severing attribute access: x?.attr
> * None-severing subscript lookup: x?[expr]
Please don't be too harsh to me for my next words!
Zero Piraeus writes:
If I write something like obj.attr, the failure mode I care about is
that
obj has no attribute attr, rather than that obj is specifically None (or
one of a defined group of somewhat Nonelike objects).
Clearly, in such a circumstance, obj is not what I ex
On Wed, Nov 2, 2016 at 12:02 PM, Mikhail V wrote:
> Actually even with ASCII (read for python 2.7) I would also be happy
> to have such function: say I just want to keep only digits so I write:
>
> digits = "0123456789"
> newstring = somestring.keep(digits)
>
well, with ascii, it's not too hard
Hi Ben,
Mostly I just print to stdout, I imagine more flexibility would be needed
in general.
This is for python 2.7 - don't know if it works for 3.
def profile(sort='time', restriction=(), callers=None, callees=None,
filename=None):
def _profileDecorator(func):
"print profile stats
Okay, got it, that sounds fair enough. With your @profile decorator how do
you tell it when and where to print the output? Can you post the source for
your decorator?
On Wed, Nov 2, 2016 at 4:52 PM, Tim Mitchell
wrote:
> I use an @profile() decorator for almost all my profiling. If you want to
I use an @profile() decorator for almost all my profiling. If you want to
profile function foo you just decorate it and re-run the program.
With a with block you have to find the places where foo is called and put
with statements around the calls.
I think both approaches are equally valid and usef
Even though I really don't want new null-coalescing operators, I really
appreciate the ternary operator in Python (or in C).
On Wed, Nov 2, 2016 at 12:38 PM, Mikhail V wrote:
> result = a > b ? x : y
>
> is IMHO a syntactical herecy. Such things disgust me from programming.
> Why on earth one ca
Zero Piraeus writes:
> If I write something like obj.attr, the failure mode I care about is that
> obj has no attribute attr, rather than that obj is specifically None (or
> one of a defined group of somewhat Nonelike objects).
>
> Clearly, in such a circumstance, obj is not what I expected it to
On 11/02/2016 12:32 PM, Nikolaus Rath wrote:
On Nov 02 2016, Zero Piraeus
wrote:
On Wed, 2016-11-02 at 08:46 -0700, Guido van Rossum wrote:
[...] we need to agree on what even the right definition of ?. is. It's
been frighteningly difficult to explain this even on this list, even
though I hav
On Nov 02 2016, Zero Piraeus
wrote:
> On Wed, 2016-11-02 at 08:46 -0700, Guido van Rossum wrote:
>> [...] we need to agree on what even the right definition of ?. is. It's
>> been frighteningly difficult to explain this even on this list, even
>> though I have a very clear view in my head, and PE
On 2 November 2016 at 19:34, MRAB wrote:
> How about borrowing from C:
>
> target = expr1 || expr2 || expr3
> target = expr1 && expr2 && expr3
>
> except that only None would be considered falsey?
>
> Or would that be confusing?
Sorry for intruding into discussion and off-topic again,
Su
On 27 October 2016 at 00:17, Chris Barker wrote:
> 1) an easy way to spell "remove all the characters other than these"
>
> I think that's a good idea. What with unicode having an enormous number
> of code points, it really does make sense to have a way to specify
> only what you >want, rather tha
2016-10-25 12:29 GMT-02:00 Paul Moore :
> On the other hand, the *ideas* are really interesting and valuable.
> I'm certainly planning on looking at PyScanPrev when I get the chance.
> And the discussions can frequently make people rethink their beliefs.
>
> So people posting ideas here should exp
On 2016-11-02 16:17, Nick Coghlan wrote:
[snip]
Yeah, and so far the protocol based alternative I'm working on hasn't
been any less headache-inducing (Mark has been reviewing some early
iterations and had to draw a diagram to try to follow the proposed
control flow).
I think I have a way to simp
Hi folks,
Every time I do some Python profiling (with cProfile) the API feels kinda
baroque, and I have to write ~10 line helper functions to do what I want.
For example, if I want the return value of running some function and the
profiling output as a string (e.g., to send as part of a web respon
:
Disclaimer: I haven't followed all of this discussion, so some or all of
the following may already have been expressed better (and perhaps refuted
better still).
On Wed, 2016-11-02 at 08:46 -0700, Guido van Rossum wrote:
> [...] we need to agree on what even the right definition of ?. is. It's
2016-10-25 12:02 GMT-02:00 Stephen J. Turnbull :
> My point is that although new syntax may be useful for simple cases,
> serious applications will worry about computational accuracy and
> likely will provide packages that handle general cases that nest these
> simple cases. Given they exist, mos
On Tue, Nov 1, 2016 at 12:15 AM, Stephen J. Turnbull <
turnbull.stephen...@u.tsukuba.ac.jp> wrote:
> > pretty slick -- but any hope of it being as fast as a C implemented
> method?
>
> I would expect not in CPython, but if "fast" matters, why are you
> using CPython rather than PyPy or Cython?
On 02.11.2016 17:17, Nick Coghlan wrote:
The gist is that rather than writing the bare:
target = expr1 ?? expr2 ?? expr3
You'd instead write None-coalescing as:
target = exists(expr1) ?? exists(expr2) ?? expr3
and None-propagating as:
target = missing(expr1) ?? missing(expr2) ??
On 3 November 2016 at 01:46, Guido van Rossum wrote:
> But I also recall learning CoffeeScript via cargo-culting a large existing
> codebase and having not the foggiest ideas when it made sense to use ?. and
> when plain . was enough. So I think this feature is not very
> new-user-friendly and I s
But I also recall learning CoffeeScript via cargo-culting a large existing
codebase and having not the foggiest ideas when it made sense to use ?. and
when plain . was enough. So I think this feature is not very
new-user-friendly and I still expect that in the end we'll have two
rejected PEPs. But
On 2 November 2016 at 00:46, Guido van Rossum wrote:
> I personally find the ?keyword pattern has less appeal than ?, ?? or ?. .
Good to know :)
Cheers,
Nick.
--
Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia
___
Python-ideas mailing
On Wed, Nov 2, 2016 at 9:18 PM, Steven D'Aprano wrote:
> On Wed, Nov 02, 2016 at 02:09:24PM +1100, Chris Angelico wrote:
>> We already expect "to the left" and "to the right" to end based on
>> operator precedence rules. Parentheses are used to control operator
>> precedence. It would surprise peo
On Wed, Nov 02, 2016 at 02:09:24PM +1100, Chris Angelico wrote:
> We already expect "to the left" and "to the right" to end based on
> operator precedence rules. Parentheses are used to control operator
> precedence. It would surprise people *greatly* if they didn't bound
> the effect of the questi
35 matches
Mail list logo