On Fri, 16 Feb 2018 21:22:48 -0600, boB Stepp wrote:
> This article is written by Nathan Murthy, a staff software engineer at
> Tesla. The article is found at:
> https://medium.com/@natemurthy/all-the-things-i-hate-about-
python-5c5ff5fda95e
>
> Apparently he chose his article title as "click ba
On Sat, 17 Feb 2018 12:53:08 +0100, Cecil Westerhof wrote:
> Cecil Westerhof writes:
>
>> I just found Twython. I managed to post a tweet with:
>> from twython import Twython
>> twitter = Twython(APP_KEY, APP_SECRET,
>> OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
>> posted
On Sat, 17 Feb 2018 03:29:49 -0500, Terry Reedy wrote:
> His dreadful strawperson code snippet should not be allowed even in a
> beginning programming class, let alone in professional programs.
>
> def foo(x):
> if is_valid(x):
> return "hello world"
> else:
> return b
On Fri, 16 Feb 2018 14:18:16 -0800, windhorn wrote about running scripts
from the interpreter:
[...]
> That works, but nothing is very convenient for debugging simple scripts.
> If I run the script from a command prompt it works, but I lose all my
> other stuff (debugging functions, variables, e
On Sat, 17 Feb 2018 15:25:15 +1100, Chris Angelico wrote:
> 1) Type safety.
>
> This is often touted as a necessity for industrial-grade software. It
> isn't. There are many things that a type system, no matter how
> sophisticated, cannot catch;
The usual response to that is to make ever-finer-
On Sun, 18 Feb 2018 08:02:10 +1100, Chris Angelico wrote:
[...]
>> The usual response to that is to make ever-finer-grained types, until
>> the type-system can prove the code is correct.
>>
>> integers
>> positive integers
>> positive integers greater than 10
>> positive integers greater than 10 b
On Sun, 18 Feb 2018 19:38:03 -0500, Dennis Lee Bieber wrote:
> On Mon, 19 Feb 2018 00:09:40 + (UTC), Steven D'Aprano
> declaimed the following:
>
>
>>Or more realistically, suppose you want your type system to ensure that
>>you don't lay off the wrong wor
On Mon, 19 Feb 2018 02:14:26 +, bartc wrote:
> On 19/02/2018 00:09, Steven D'Aprano wrote:
>
>> Sure, but only the most boring, uninteresting kinds of types can be so
>> named. The point is that "sufficiently fine-grained types" can be
>> arbitrarily
On Mon, 19 Feb 2018 04:26:32 +0100, Anders Wegge Keller wrote:
> På Mon, 19 Feb 2018 08:47:14 +1100
> Tim Delaney skrev:
>> On 18 February 2018 at 22:55, Anders Wegge Keller
>> wrote:
>
>
>> > That list is not only weakly typed, but rather untyped. There are no
>> > safeguards in the language
On Mon, 19 Feb 2018 09:40:09 +0100, Alain Ketterlin wrote:
> Tim Delaney writes:
>
> [...]
>> As others have said, typing is about how the underlying memory is
>> treated.
>
> No. It is much more than that. Typing is about everything you can say
> about a given statement.
"Everything"? Truly *
On Mon, 19 Feb 2018 20:14:32 +1100, Chris Angelico wrote:
> As an integer, 3.141590 is 107853 $
>
> Looks to me like C is perfectly happy to interpret a float as an int.
Yes, but that's not an *automatic* coercion. To count as weakly typed,
the compiler has to do it automatically, without a
On Mon, 19 Feb 2018 12:19:14 +0100, Alain Ketterlin wrote:
> Steven D'Aprano writes:
>
>> On Mon, 19 Feb 2018 09:40:09 +0100, Alain Ketterlin wrote:
>>
>>> Tim Delaney writes:
>>>
>>> [...]
>>>> As others have said, typing is about
On Mon, 19 Feb 2018 12:35:19 +, bartc wrote:
> Type systems get rapidly very complicated when you have to deal with
> arbitrary sets of values and with arbitrary rules of interaction.
> Someone has to devise a programming language to allow all that without
> tying itself up in knots. Someone e
On Mon, 19 Feb 2018 13:28:26 +, Paul Moore wrote:
> [1] The most basic question, which people making such claims often can't
> answer, is "Do you mean that values are strongly typed, or that names
> are? Or did you mean that variables are, because if so Python doesn't
> even have variables in
On Mon, 19 Feb 2018 14:06:36 +0100, Anders Wegge Keller wrote:
> Array is not even close to providing a strongly typed container.
That's a mighty powerful claim that goes against the documentation for
the array module. Can you back your claims up?
Here's an array and a list:
import array
arr =
On Tue, 20 Feb 2018 02:35:37 +1100, Chris Angelico wrote:
> But C is a language saddled with so much history and backward
> compatibility constraints that there are some things you just CAN'T make
> into errors
Indeed. C is not even close to a safe language, hence the move to create
(and more i
On Tue, 20 Feb 2018 12:18:47 +0100, Antoon Pardon wrote:
> On 19-02-18 15:25, Steven D'Aprano wrote:
>>
>>> Ones like C++ has already tied itself itself up in knots just doing
>>> the basics; I'm not sure how it would handle even my 1,3,5,7,9 type.
>>&
On Mon, 19 Feb 2018 16:34:29 +0100, Anders Wegge Keller wrote:
> På Mon, 19 Feb 2018 15:15:19 + (UTC) Steven D'Aprano
> skrev:
>> On Mon, 19 Feb 2018 14:06:36 +0100, Anders Wegge Keller wrote:
>>
>> > Array is not even close to providing a strongly typed c
On Sat, 17 Feb 2018 21:27:52 +0100, Cecil Westerhof wrote:
[...]
>> Okay. What happens when you try?
>
> Then the tweet is posted as a reply on the the first tweet.
>
> (So problem solved.)
Ah, sorry, I did not understand your second post. I thought you were
posting it as an update to the pro
On Tue, 20 Feb 2018 15:23:44 +0100, Antoon Pardon wrote:
>> Okay. Now create a constraint on a name in C++ such that it can only
>> accept integers representing A.D. years which, on the Gregorian
>> calendar, are leap years. (Using a dedicated integer-like type is
>> permitted.) It must accept all
On Tue, 20 Feb 2018 14:12:08 +0100, Anders Wegge Keller wrote:
> På Tue, 20 Feb 2018 12:28:25 + (UTC) Steven D'Aprano
> skrev:
>> On Mon, 19 Feb 2018 16:34:29 +0100, Anders Wegge Keller wrote:
>>
>> > På Mon, 19 Feb 2018 15:15:19 + (UTC) Steven D'Apr
statistics.mode() currently raises an exception if there is more than one
mode.
Is anyone using this function in production? Or not using it because it
doesn't do what you want, as the case may be?
--
Steve
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, 20 Feb 2018 17:11:05 +, Wild, Marcel, Prof
wrote:
> I scarcely know Python, and I have no intention delving into it further.
> I was forced to use Python because it features binary decision
> diagrams, which MATHEMATICA doesn't. Coming from Mathematica the
> account of Nathan Murph
On Tue, 20 Feb 2018 22:19:13 +0100, Christian Gollwitzer wrote:
[...]
> LeapYearCheck could be implemented using template metaprogramming
> (quite horrible) or the new funky constexpr feature in C++11/C++14 (less
> horrible).
Thanks Christian. That's certainly interesting, I don't know much about
On Tue, 20 Feb 2018 14:41:42 -0800, Maroso Marco wrote:
> My program seems to have a problem and i don't understand which! Firstly
> it worked and now just went to run it again and it doesnt.
[...]
> Can someone please tell me how to transform it in a service to run on
> Windows?
There is absolut
On Tue, 20 Feb 2018 12:42:23 -0800, Rick Johnson wrote:
> For instance, if the age is queried many times a second, it would be a
> much wiser design to set-up an event that will advance the age at the
> end of the last second of every year
Do you really mean to say that everybody in the world has
On Tue, 20 Feb 2018 10:17:12 -0700, Ian Kelly wrote:
> On Tue, Feb 20, 2018 at 8:38 AM, Steven D'Aprano
> wrote:
>> On Tue, 20 Feb 2018 15:23:44 +0100, Antoon Pardon wrote:
>>
>>>> Okay. Now create a constraint on a name in C++ such that it can only
>>&
On Wed, 21 Feb 2018 04:13:56 -0500, Etienne Robillard wrote:
> Hi,
>
> Would it be possible to build a Python to Julia code generator??
>
> i'm interested to learn Julia and would love to have the capacity to
> embed or run native Python code in Julia..
http://blog.leahhanson.us/post/julia/juli
https://www.ibm.com/developerworks/community/blogs/jfp/entry/Python_Meets_Julia_Micro_Performance?lang=en
--
Steve
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 22 Feb 2018 12:03:09 +, bartc wrote:
> The idea of the Fibonacci benchmark is to test how effectively an
> implementation manages large numbers of recursive function calls. Then,
> fib(36) would normally involve 48,315,633 calls.
>
> This version does only 37, giving a misleading impr
On Thu, 22 Feb 2018 13:32:45 +0100, ast wrote:
> Hello
>
> I share a very valuable table I found on StackOverflow about file
> opening modes
>
> If like me you always forget the details of file opening mode, the
> following table provides a good summary
Thanks!
--
Steve
--
https://mail.py
On Thu, 22 Feb 2018 19:55:08 +, Jack Fearnley wrote:
> I realize that this thread is about benchmarking and not really about
> generating fibonacci numbers, but I hope nobody is using this code to
> generate them on a 'production' basis,
>
> Fibonacci numbers, any linearly recursive sequence
On Thu, 22 Feb 2018 17:53:30 +, bartc wrote:
> On 22/02/2018 16:00, Steven D'Aprano wrote:
>> On Thu, 22 Feb 2018 12:03:09 +, bartc wrote:
>>
>>> The idea of the Fibonacci benchmark is to test how effectively an
>>> implementation manages lar
On Fri, 23 Feb 2018 00:26:33 +, bartc wrote:
> The point of the article was Julia vs. Python. You can't make Python
> faster by switching to a faster algorithm; you have to use the same one
> on both.
No, the point of the article was to write Python code that is as fast as
the Julia code.
I
On Fri, 23 Feb 2018 11:00:28 +0100, Stefan Behnel wrote:
> I've even seen proper Cython benchmark code that a C compiler can fully
> analyse as static and replaces by a constant, and then get wonder
> speedups from it that would never translate to any real-world gains.
This is one of the reasons
On Fri, 23 Feb 2018 11:00:28 +0100, Stefan Behnel wrote:
> I've even seen proper Cython benchmark code that a C compiler can fully
> analyse as static and replaces by a constant, and then get wonder
> speedups from it that would never translate to any real-world gains.
This is one of the reasons
On Fri, 23 Feb 2018 23:41:44 +1100, Chris Angelico wrote:
[...]
>> Integer pixel values
>
> Maybe in 64 bits for the time being, but 32 certainly won't be enough.
> As soon as you do any sort of high DPI image manipulation, you will
> exceed 2**32 total pixels in an image (that's just 65536x6553
On Sat, 24 Feb 2018 00:03:06 +1100, Chris Angelico wrote:
>> Is numpy a general purpose C library that can also be called from any
>> language that can use a C API? Or is it specific to Python?
>>
>>
> No, it's a general purpose FORTRAN library that can also be called from
> any language that can
On Fri, 23 Feb 2018 12:17:50 +, bartc wrote:
> On 23/02/2018 01:27, Steven D'Aprano wrote:
>> On Thu, 22 Feb 2018 17:53:30 +, bartc wrote:
>
>>> The actual result is irrelevant, so long as its correct. The important
>>> thing is those 50 million calls.
On Fri, 23 Feb 2018 13:51:33 +, Ben Bacarisse wrote:
[...]
>> I don't know why the Julia programmers chose to use such a poor
>> algorithm:
>
> It's odd indeed, but given that they did, what you take to be the point
> of the article -- to write a good Python algorithm as fast as the
> terribl
On Fri, 23 Feb 2018 10:50:50 -0600, Python wrote:
> On Fri, Feb 23, 2018 at 01:38:01AM -0500, Terry Reedy wrote:
>> It is no secret that Python's interpreted function calls are slower
>> than function calls compiled to machine code and that Python's infinite
>> precision integer arithmetic is slow
On Fri, 23 Feb 2018 19:25:35 +, bartc wrote:
> On 23/02/2018 18:05, Steven D'Aprano wrote:
>> On Fri, 23 Feb 2018 13:51:33 +, Ben Bacarisse wrote:
>
>> Stop writing crap code and then complaining that the language is "too
>> slow". Write better co
On Fri, 23 Feb 2018 12:43:06 -0600, Python wrote:
> Even if testing optimized
> code is the point, as the article claims, it utterly fails to do that.
> Bad science.
You've used that statement two or three times now.
*This isn't science*.
There's nothing scientific about writing benchmarks, or
On Mon, 26 Feb 2018 01:50:16 +1100, Chris Angelico wrote:
> If you actually need character-by-character, you'd need "for character
> in fh.read()" rather than iterating over the file itself. Iterating over
> a file yields lines.
Indeed. But I wonder if there's a performance cost/gain to iterating
On Sun, 25 Feb 2018 18:33:47 -0800, Rick Johnson wrote:
> On Friday, February 23, 2018 at 10:41:45 AM UTC-6, Steven D'Aprano
> wrote: [...]
>> There are dozens of languages that have made the design choice to limit
>> their default integers to 16- 32- or 64-bit fixed si
On Sun, 25 Feb 2018 21:19:19 -0800, Rick Johnson wrote:
> I agree with your sarcasm. And that's why these types of auto
> conversions should be optional. I agree that most times it's more
> practical to let python handle the dirty details. But in some cases,
> where you need to squeeze out a few
On Sun, 25 Feb 2018 20:22:17 -0800, Rick Johnson wrote:
> So of course, speed is not and should not be the
> primary concern, but to say that execution speed is of _no_ concern is
> quite absurd indeed.
I'm pretty sure that nobody here has said that speed is of no concern.
Rather, I would argue
On Sun, 25 Feb 2018 19:26:12 -0800, Rick Johnson wrote:
> On Friday, February 23, 2018 at 8:48:55 PM UTC-6, Steven D'Aprano wrote:
> [...]
>> Take the Fibonacci double-recursion benchmark. Okay, it tests how well
>> your language does at making millions of function calls. W
On Mon, 26 Feb 2018 22:34:00 +1100, Chris Angelico wrote:
[...]
>> (We tried painting Go Faster stripes on the server, and it didn't
>> work.)
>
> Steven Middlename D'Aprano! You should know better than that. "It didn't
> work" is not good enough.
I have a class with a large number of parameters (about ten) assigned in
`__init__`. The class then has a number of methods which accept
*optional* arguments with the same names as the constructor/initialiser
parameters. If those arguments are None, the defaults are taken from the
instance attr
On Mon, 26 Feb 2018 21:55:35 +0300, Kirill Balunov wrote:
> Hi,
>
> I am a little bit confused with `locals` builtin in these moments:
>
> 1. The documentation says that _free varaibles_ are returned, which
> seems incorrect description.
I can't answer that, sorry.
> 2. The documentation has
On Tue, 27 Feb 2018 02:09:53 +1100, Chris Angelico wrote:
> You're still reimplementing the C code in Python, which is inefficient.
> Have you considered going back to the *actual algorithm* and
> implementing that idiomatically in Python? I think you'll find that (a)
> the code is more readable,
On Mon, 26 Feb 2018 17:18:38 -0800, Rick Johnson wrote:
> On Tuesday, February 20, 2018 at 5:45:36 PM UTC-6, Steven D'Aprano
> wrote:
>> On Tue, 20 Feb 2018 12:42:23 -0800, Rick Johnson wrote:
>>
>> > For instance, if the age is queried many times a second, it woul
On Mon, 26 Feb 2018 17:18:38 -0800, Rick Johnson wrote:
[...]
> So, for instance: if your birthday is January 25th 1969, the last second
> of the last day of your _first_ year is January 24th 1970 @ 11:59:59PM.
> And the last second of the last day of your _second_ year is January
> 24th 1971 @ 11
On Mon, 26 Feb 2018 17:39:43 +0100, Peter Otten wrote:
[...]
> I have not yet looked into dataclasses. Don't they handle the __init__()
> part? Anyway, here's my attempt to make spam() less spammy:
I'm not too concerned about __init__, it's only one method :-)
> $ cat attrs_to_args_decorator.p
On Mon, 26 Feb 2018 16:23:39 -0800, Rick Johnson wrote:
> On Monday, February 26, 2018 at 5:44:18 PM UTC-6, MRAB wrote: [...]
>> Before using or'd-logic, you need to know whether the value could be
>> falsey, e.g. 0.
>
> True. However. Steven failed to provide a
On Tue, 27 Feb 2018 09:15:12 +1100, Ben Finney wrote:
> Steven D'Aprano writes:
>
>> I have a class with a large number of parameters (about ten) assigned
>> in `__init__`. The class then has a number of methods which accept
>> *optional* arguments with the
On Mon, 26 Feb 2018 17:05:46 -0800, Dan Stromberg wrote:
[...]
> I don't have IronPython handy, but according my (quite possibly flawed)
> test program, locals() is a copy on CPython 3, CPython 2, Pypy3, Pypy,
> Jython and MicroPython.
>
> I didn't see any interpreters that returned the namespace
On Tue, 27 Feb 2018 11:27:21 +, bartc wrote:
[...]
>> The built-in generator is using a completely different algorithm
>> though, so rate of generation isn't the entire story. How long is the
>> period of the one you're using? (How long before it loops?)
>
> I believe it's 5*2**1320480*(2**64
On Tue, 27 Feb 2018 10:56:18 -0700, Ian Kelly wrote:
> Cheaters are gonna cheat. In the unlikely event they don't get the
> answer here, they'll probably just manage to convince somebody to do the
> work for them somewhere else. Honestly, I don't know if it's even worth
> the bother to engage.
It
On Wed, 28 Feb 2018 18:04:11 +1100, Chris Angelico wrote:
> On Wed, Feb 28, 2018 at 5:54 PM, dieter wrote:
[...]
>> I am still working with Python 2 (Python 3 may behave differently).
>> There, during debugging, I would sometimes like to change the value of
>> variables (I know that the variable
On Wed, 28 Feb 2018 18:01:42 +1100, Chris Angelico wrote:
> If you really want a list of ALL the local names in a function, you can
> look at its __code__ object, which has a tuple of variable names:
>
> print(func1.__code__.co_varnames)
>
> That information is static to the function, as it is i
On Wed, 28 Feb 2018 16:13:52 -0500, Etienne Robillard wrote:
> Hey,
>
> I want to know why this question is being silently ignored by this
> group.
Possibly because we have no idea of the answer? Or we thought it was too
obvious to answer?
Do you have a microphone that can detect ultrasound? C
On Wed, 28 Feb 2018 14:51:09 -0800, ooomzay wrote:
> Informal Background
> ===
>
> Python's lack of Deterministic Object Destruction semantics strikes me
> as very unpythonic. This state of affairs spawns lengthy diatribes on
> __del__(),
I've never seen any of these lengthy dia
Hey Chris, regretting writing that "Statement-Local Name Bindings" PEP
yet? :-)
I know *I'm* regretting that you wrote it, because this is the sort of
language feature that has the potential to make Python significantly ugly
and worse, and I'd like to have my say, but there's no way I have time
On Wed, 28 Feb 2018 09:58:24 -0800, Aktive wrote:
> what the hell do you care about cheating..
>
> the world doest care about cheating.
>
> its about skill.
Because cheaters don't have skill. That's why they cheat.
> You guys been too much in school
Ah, spoken like a cheater.
--
Steve
On Wed, 28 Feb 2018 15:44:45 -0800, ooomzay wrote:
>> Here's one example: reference cycles. When do they get detected?
>
> Orphan cycle _detection_ is orthogonal to this proposal.
It certainly is not. Dealing with cycles is why most of the world has
moved on from reference counters. (Or at leas
On Thu, 01 Mar 2018 08:54:52 +1100, Chris Angelico wrote:
> But this part sounds like prime quality tinfoil hat material:
>
>> Tell me how exactly ultrasonic side channels may activate remotely
>> specific neural pathways implicated in aggressivity and how to block
>> theses specific side channel
On Wed, 28 Feb 2018 18:46:05 -0800, Rick Johnson wrote:
> On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico
> wrote:
>
>> Here's one example: reference cycles. When do they get detected? Taking
>> a really simple situation:
>>
>> class Foo:
>> def __init__(self):
>>
On Wed, 28 Feb 2018 18:51:33 -0800, Rick Johnson wrote:
>> What happens if the __del__ method recreates a reference to the object?
>
> So make instantation of the object in its __del__ method an illegal op!
Why should it be illegal? And could that even be enforced in Python?
Is this one of thos
On Thu, 01 Mar 2018 16:49:35 -0800, Rick Johnson wrote:
> Remember, the challenge is _not_ simply a matter of circular references
> (there is literally tons of Python code out there which creates CRs for
> various reasons), no, the challenge is to create a custom class which
> references _itself_,
On Thu, 01 Mar 2018 16:26:47 -0800, ooomzay wrote:
>> >> When does the destination file get closed?
>> >
>> > When you execute:-
>> >
>> >del dst
>> >
>> > or:-
>> >
>> >dst = something_else
>>
>> What if you don't?
>
> Then the resource will remain open until your script exits at which
On Thu, 01 Mar 2018 22:46:56 -0700, Ian Kelly wrote:
> On Thu, Mar 1, 2018 at 10:35 PM, Chris Angelico
> wrote:
>> On Fri, Mar 2, 2018 at 4:16 PM, Ian Kelly
>> wrote:
>>> On Wed, Feb 28, 2018 at 8:00 PM, Chris Angelico
>>> wrote:
Not off hand, but I can provide an EXTREMELY real-world exam
On Fri, 02 Mar 2018 07:09:19 -0800, ooomzay wrote:
[...]
>> If you're going to *require* the programmer to explicitly del the
>> reference:
>>
>> f = open("file")
>> text = f.read()
>> del f
>
> But I am not! On the contrary RAII frees the programmer from even having
> to remember to
On Fri, 02 Mar 2018 14:45:55 -0600, Python wrote:
> On Mon, Feb 26, 2018 at 09:57:06AM +0000, Steven D'Aprano wrote:
>> Besides, if you want Python with no GIL so you can run threaded code,
>> why aren't you using IronPython or Jython?
>
> But this is just anoth
I see people replying to Paul Rubin, but I'm not seeing his posts.
I've reading this through gmane.
Does anyone know what's going on?
Thanks,
Steve
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, 03 Mar 2018 12:37:08 -0500, Richard Damon wrote:
> With RAII and immediate destruction on end of scope, we can automate the
> release, without it and you need a lot of explicit code to manage these
> resources.
Not so much.
with resource_i_care_about() as rsrc:
process(rsrc)
is har
On Sat, 03 Mar 2018 10:01:43 -0700, Ian Kelly wrote:
> On Sat, Mar 3, 2018 at 9:19 AM, Richard Damon
> wrote:
>> One idea does come to mind though, would it be reasonable, and somewhat
>> Pythonic, for a class to define member functions like __ref__ and
>> __unref__ (or perhaps some other name) t
On Sat, 03 Mar 2018 08:02:35 -0800, ooomzay wrote:
[...]
>> > But I am not! On the contrary RAII frees the programmer from even
>> > having to remember to close the file. The poster asked what would
>> > happen if the resource was deliberately kept open by storing a
>> > reference at global scope.
On Sat, 03 Mar 2018 18:19:37 -0800, Ooomzay wrote:
>> def function():
>> x = open_resource()
>> process(x)
>> # and we're done with x now, but too lazy to explicitly close it
>> sleep(1) # Simulate some more work. Lots of work.
>> return
>> # and finally x is closed (2
On Sun, 04 Mar 2018 04:37:46 -0800, Ooomzay wrote:
> On Sunday, 4 March 2018 04:23:07 UTC, Steven D'Aprano wrote:
>> [...]
>> [This PEP] imposes enormous burdens on the maintainers of at least five
>> interpreters (CPython, Stackless, Jython, IronPython, PyPy) all of
&
On Sun, 04 Mar 2018 03:37:38 -0800, Ooomzay wrote:
> Please consider the case of a composite resource: You need to implement
> __enter__, __exit__ and track the open/closed state at every level in
> your component hierarchy - even if some levels hold no resources
> directly.
I'm sorry, that descr
On Sun, 04 Mar 2018 09:37:34 -0500, Ned Batchelder wrote:
> On 3/4/18 7:37 AM, Ooomzay wrote:
>> On Sunday, 4 March 2018 04:23:07 UTC, Steven D'Aprano wrote:
>>> [...]
>>> [This PEP] imposes enormous burdens on the maintainers of at least
>>> five
On Mon, 05 Mar 2018 09:20:24 +1100, Chris Angelico wrote:
> Okay, that sounds reasonable. Let's help things out by creating a
> special syntax for reference-counted object usage
[...]
> Feel free to bikeshed the exact keywords and function names, of course.
I see what you did there.
:-)
--
S
On Sun, 04 Mar 2018 16:58:38 -0800, Ooomzay wrote:
> Here is an example of a composite resource using RAII:-
>
> class RAIIFileAccess():
> def __init__(self, fname):
> print("%s Opened" % fname)
> def __del__(self):
> print("%s Closed" % fname)
>
> class A():
> def __
On Mon, 05 Mar 2018 07:31:57 -0800, Ooomzay wrote:
> We do not expect this to work in PyPy.
Or Jython, IronPython, possibly not Stackless either, or in the
interactive interpreter of (probably) any implementation, or CPython if
the object is garbage collected during interpreter shutdown or is i
On Mon, 05 Mar 2018 09:22:33 -0800, Ooomzay wrote:
[...]
>> Looking at that code, my major thought is that there is far too much
>> OO design, not enough simplicity.
>
> If this is far too much OO for you then RAII will be of no interest to
> you.
I think this is probably the wisest thing you h
On Mon, 05 Mar 2018 18:13:59 -0600, Peng Yu wrote:
> Hi,
>
import re
prog=re.compile('[a-f]+')
help(prog)
>
> I can use the above command to access SRE_Pattern. But this involves the
> creation of an object of the class.
If you're using help() interactively, the cost of creating
On Sat, 03 Mar 2018 04:28:24 +, 高岡陽太 wrote:
> Hello,
>
> I found a difference of behavior about `except` statement between
> CPython 2.7 and 3.x .
> `except EXC_CLASS:` calls `__subclasscheck__` in 2.7, but does not in
> 3.x .
Python 3 does not accept virtual subclasses for exception handli
On Wed, 10 Aug 2016 06:20 am, Ltc Hotspot wrote:
> Hi, Everyone:
>
> What is the source of the following,
> 'error message: SyntaxError: invalid syntax (, line 2)'
>
> v. Python 3.3
>
> Code reads:
>
> x=1
> if x==1
> # indent 4 spaces
> print "x = 1"
>
> Hal
The error message tells
On Wed, 10 Aug 2016 04:29 am, Juan Pablo Romero Méndez wrote:
> Hello,
>
> In online forums sometimes people complain that they end up having to test
> constantly for None,
Then don't return None to indicate an error. If you write this:
def create_spam(arg):
if condition:
return Sp
On Wed, 10 Aug 2016 06:51 am, Juan Pablo Romero Méndez wrote:
> 2016-08-09 13:18 GMT-07:00 Rob Gaddi :
>> It's not a style, it's the absence of one.
>>
>> def add2list(lst, elem):
>> lst.extend([elem, elem])
>> return lst
>>
>> I did all the type checking I needed to there; none whatsoeve
On Wed, 10 Aug 2016 11:02 am, Chris Angelico wrote:
> On Wed, Aug 10, 2016 at 10:58 AM, Juan Pablo Romero Méndez
> wrote:
>> This is interesting. You are Ok having runtime errors?
>
> Absolutely. In real terms, there's no difference between "compile-time
> error" and "run-time error that you tr
On Wed, 10 Aug 2016 11:45 am, Lawrence D’Oliveiro wrote:
> GvR has said “we’re all consenting adults here”. He was referring to the
> “public/private/protected” access-control business that most
> object-oriented languages require you to go through. But there is another
> area where I think this p
On Wednesday 10 August 2016 12:49, Lawrence D’Oliveiro wrote:
> On Wednesday, August 10, 2016 at 2:04:39 PM UTC+12, Chris Angelico wrote:
>
>> Animated GIFs support transparency.
>
> But they don’t do full colour.
Define "full colour".
GIFs don't directly support 16-bit or 32-bit colours in a
On Wednesday 10 August 2016 12:53, Lawrence D’Oliveiro wrote:
> On Tuesday, August 9, 2016 at 4:20:37 AM UTC+12, Chris Angelico wrote:
>> Firstly, the bare "except:" clause should basically never be used;
>> instead, catch a very specific exception and figure out what you want to
>> do here
>
> Y
On Wednesday 10 August 2016 15:20, Juan Pablo Romero Méndez wrote:
> Ok, so you suggested 1) catching exceptions at the point where you care, 2)
> preemptively check for certain runtime conditions to avoid exceptions 3)
> write as many tests as possible 4) learn to live with runtime errors.
>
>
On Wed, 10 Aug 2016 07:48 pm, BartC wrote:
> On 10/08/2016 02:47, Steven D'Aprano wrote:
>> How about the difference between getting a compile-time error immediately
>> you try to compile your program, and a run-time error three quarters of
>> the way through pr
On Thu, 11 Aug 2016 06:57 am, Cai Gengyang wrote:
> Yea, using IDLE on OSX, Python 3.4.3.
>
> Yeah it works now ... I had to increase the font size and the indentation
> width. When that happened , it could define miles_driven
You were always defining "miles_driven", it is just that the display
Its sometimes very useful to apply a function to each element of a list in
turn. One common term for that is "vectorized function".
Julia has a convenient syntactic shortcut for this:
http://julia.readthedocs.io/en/latest/manual/functions/#dot-syntax-for-vectorizing-functions
func(arg)
call
2301 - 2400 of 15563 matches
Mail list logo