;?
>
> I'm only looking for answers for Python 3. (The results in Python 2 are
> genuinely weird :-)
I would expect an UnboundLocalError: local variable 'result' referenced before
assignment.
--
Antoon Pardon.
--
https://mail.python.org/mailman/listinfo/python-list
On 26-06-18 11:22, Steven D'Aprano wrote:
> On Tue, 26 Jun 2018 10:20:38 +0200, Antoon Pardon wrote:
>
>>> def test():
>>> a = 1
>>> b = 2
>>> result = [value for key, value in locals().items()]
>>> return result
> [..
On 26-06-18 12:09, Chris Angelico wrote:
> On Tue, Jun 26, 2018 at 8:04 PM, Antoon Pardon wrote:
>> On 26-06-18 11:22, Steven D'Aprano wrote:
>>> On Tue, 26 Jun 2018 10:20:38 +0200, Antoon Pardon wrote:
>>>
>>>>> def test():
>>>>>
On 26-06-18 12:39, Steven D'Aprano wrote:
> On Tue, 26 Jun 2018 12:04:16 +0200, Antoon Pardon wrote:
>
>> On 26-06-18 11:22, Steven D'Aprano wrote:
>>> On Tue, 26 Jun 2018 10:20:38 +0200, Antoon Pardon wrote:
>>>
>>>>> def test():
>>&g
ch
> sets if you take the DIY approach).
Well that is technically correct but not the whole story. Few languages allow
you to
blend in your DIY approach, so that from a users perspective it makes little
difference
whether the datatype was provided by the language or the result of a DIY
approach.
On 05-07-18 08:58, Steven D'Aprano wrote:
>
>> Optimize for readability, not writability.
> And that is why we all hold COBOL up as the paragon of excellence for a
> programming language! *wink*
>
> Or if you don't like COBOL, how about Hypertalk?
Well you always mention how like english the if-e
On 05-07-18 11:59, Steven D'Aprano wrote:
> On Thu, 05 Jul 2018 17:34:55 +1200, Gregory Ewing wrote:
>
>
>>> Indeed, that's often the best way, except for the redundant type hint,
>>> which makes you That Guy:
>>>
>>> x: int = 0 # set x to the int 0
>> But you've shown in an earlier example th
On 05-07-18 15:07, Steven D'Aprano wrote:
> On Thu, 05 Jul 2018 13:54:28 +0200, Antoon Pardon wrote:
>
>> On 05-07-18 11:59, Steven D'Aprano wrote:
>>> On Thu, 05 Jul 2018 17:34:55 +1200, Gregory Ewing wrote:
>>>
>>>
>>>>> Indeed, tha
On 06-07-18 08:17, Steven D'Aprano wrote:
> On Thu, 05 Jul 2018 16:09:52 +0200, Antoon Pardon wrote:
>
>>> This is not an innovation of Mypy. It's how type inference is supposed
>>> to work. If a particular type checker doesn't do that, it is doing it
>
by changing PYSIDE's value I can run an
> entire application with PySide2 or with PyQt5.
The following is untested but what about
if PYSIDE:
import PySide2 as PyQt
else:
import PyQt5 as PyQt
Qt = PyQt.QtCore.Qt
QIcon = PyQt.QtGui.QIcon
...
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
On 15-07-18 09:33, Marko Rauhamaa wrote:
> Paul Rubin :
>> Py3's unicode picture is described here and it isn't pretty:
>> http://secure-web.cisco.com/1IcToGhkZqGKNSVqMv5ljEo0GVPh0uuAPgKzSBMCkoNElVbHgu4uHpyfdyIj8PrqISD2JssJJnw1yWSFp13DBGOiCdp_Mk9wI4ph_RJ63PeRB_HErunPFzgNvsDR5SDgVe66MmpAG7A4O1NO-NKK
On 16-07-18 16:24, Marko Rauhamaa wrote:
> Antoon Pardon :
>
>> I really don't understand why the author of that article didn't just
>> copy his python2 program but used sys.stdin.buffer and
>> sys.sydout.buffer instead of plain sys.stdin and stdout.
> Yes,
On 17-07-18 10:27, Marko Rauhamaa wrote:
> Steven D'Aprano :
>> On Mon, 16 Jul 2018 21:48:42 -0400, Richard Damon wrote:
>>> Who says there needs to be one. A good engineer will use the
>>> definition that is most appropriate to the task at hand. Some things
>>> need very solid definitions, and som
On 17-07-18 14:22, Marko Rauhamaa wrote:
> Antoon Pardon :
>
>> On 17-07-18 10:27, Marko Rauhamaa wrote:
>>> Also, Python2's strings do as good a job at delivering codepoints as
>>> Python3.
>> No they don't. The programs that I work on, need to be a
On 18-07-18 10:07, Marko Rauhamaa wrote:
>> Sure there were some surprises or gotcha's, but the result was still
>> better than doing it in python2 and they were easier to deal with than
>> in python2.
> BTW, in those needs, even Python2 has Unicode strings and unicodedata at
> your disposal.
Sure
On 06-09-18 10:50, Chris Angelico wrote:
> On Thu, Sep 6, 2018 at 6:44 PM, Marko Rauhamaa wrote:
>> Chris Angelico :
>>
>>> On Thu, Sep 6, 2018 at 2:29 PM, Marko Rauhamaa wrote:
Marko Rauhamaa (Marko Rauhamaa):
> Steven D'Aprano :
>> I have this snippet of SML code which I'm trying
On 07-09-18 22:08, Michael F. Stemper wrote:
>
>> try
>>id = xmlmodel.attrib['name']
>> except KeyError:
>>id = "constant power"
> Never mind! After I continued testing, I realized that the above
> should have been written as:
>
> if 'name' in xmlmodel.attrib:
> id = xmlmodel.attrib
local variables of the thread function.
What is gained by using threading.local instances?
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
I want my decimal code be usable with threads, how should I write it?
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
On 14-09-18 10:29, Chris Angelico wrote:
> On Fri, Sep 14, 2018 at 5:25 PM, Antoon Pardon wrote:
>>
>> ... Suppose I have two threads, one in which I need
>> a precision of 3 and the other in which I need a precision of 7. In what
>> circumstances is it needed to use t
er
> indentation level and let the user decide whether that's displayed as 2,
> 3, 4, or 8 spaces or 57 pixels or whatever.
>
> In practice it doesn't work in my experience. There is always someone in
> a team who was "just testing that new editor" and replaced
On 10-10-18 04:18, jf...@ms4.hinet.net wrote:
> Richard Damon at 2018.10.9 UTC+8 PM 8:40:29 wrote:
>> Moderators are generally appointed by those who do 'pay the bill' for
>> the mailing list they are moderators for, and serve at their pleasure.
>> Mailing List are generally 'private property', tho
On 13-10-18 09:37, Peter J. Holzer wrote:
> On 2018-10-09 09:55:34 +0200, Antoon Pardon wrote:
>> On 08-10-18 19:43, Peter J. Holzer wrote:
>>> On 2018-10-08 10:36:21 +1100, Chris Angelico wrote:
>>>> How wide my indents are on my screen shouldn't influen
On 20-10-18 14:38, Peter J. Holzer wrote:
> On 2018-10-16 06:37:56 +1100, Chris Angelico wrote:
>> On Tue, Oct 16, 2018 at 6:34 AM Peter J. Holzer wrote:
>>> On 2018-10-15 14:12:54 +0200, Antoon Pardon wrote:
>>>> On 13-10-18 09:37, Peter J. Holzer wrote:
>
Op 28-03-16 om 03:05 schreef Steven D'Aprano:
> On Mon, 28 Mar 2016 05:01 am, Marco S. wrote:
>
>> Steven D'Aprano wrote:
>>
>>> The point you might have missed is that treating lists as if they were
>>> mappings violates at least one critical property of mappings: that the
>>> relationship between
;
mapping I'll limit the operations on that mapping as to keep it that way. Which
in a number of case can be perfectly done with python-lists.
So generally there is no reason to limit the word "mapping" to stable mappings.
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
Op 30-03-16 om 12:28 schreef Jussi Piitulainen:
> Steven D'Aprano writes:
>
>> On Wed, 30 Mar 2016 06:12 pm, Jussi Piitulainen wrote:
>>
>>> Steven D'Aprano writes:
>>>
Given a surjection (many-to-one mapping)
>>> No. And I doubt that Wikipedia says that.
>> No to what? What are you disagreein
Op 30-03-16 om 14:22 schreef Steven D'Aprano:
> On Wed, 30 Mar 2016 09:28 pm, Jussi Piitulainen wrote:
>
>> Steven D'Aprano writes:
>>
>>> On Wed, 30 Mar 2016 06:12 pm, Jussi Piitulainen wrote:
>>>
Steven D'Aprano writes:
> Given a surjection (many-to-one mapping)
No. And I doubt
Op 30-03-16 om 17:56 schreef Steven D'Aprano:
> On Thu, 31 Mar 2016 12:12 am, Antoon Pardon wrote:
>
>> Op 30-03-16 om 14:22 schreef Steven D'Aprano:
>
> [...]
>>> Why is a mapping (such as a dict) best described as a surjection?
>>> Consider:
Op 31-03-16 om 04:40 schreef Steven D'Aprano:
> On Thu, 31 Mar 2016 06:07 am, Antoon Pardon wrote:
>
>>> Because fundamentally, it doesn't matter whether dicts are surjections or
>>> not. They're still many-to-one mappings, and those mappings between keys
Op 31-03-16 om 04:44 schreef Steven D'Aprano:
> On Thu, 31 Mar 2016 03:52 am, Random832 wrote:
>
>> Like, these are common patterns:
>>
>> for i, x in enumerate(l):
>># do some stuff, sometimes assign l[i]
>>
>> for k, v in d.items():
>># do some stuff, sometimes assign d[k]
>
> for a, b in
Op 31-03-16 om 12:36 schreef Steven D'Aprano:
> On Thu, 31 Mar 2016 06:52 pm, Antoon Pardon wrote:
>
>> it is your burden to argue that problem.
> No it isn't. I don't have to do a thing.
If that is how you think about this, why do you contribute? I completly
unders
Op 31-03-16 om 12:36 schreef Steven D'Aprano:
> On Thu, 31 Mar 2016 06:52 pm, Antoon Pardon wrote:
>
>> it is your burden to argue that problem.
> No it isn't. I don't have to do a thing. All I need to do is sit back and
> wait as this discussion peters off into n
Op 31-03-16 om 13:57 schreef Chris Angelico:
> Okay. I'll put a slightly different position: Prove that your proposal
> is worth discussing by actually giving us an example that we can
> discuss. So far, this thread has had nothing but toy examples (and
> bogoexamples that prove nothing beyond that
Op 31-03-16 om 16:12 schreef Mark Lawrence via Python-list:
> On 31/03/2016 14:27, Random832 wrote:
>> So can we discuss how a unified method to get a set of all valid
>> subscripts (and/or subscript-value pairs) on an object would be a useful
>> thing to have without getting bogged down in theoret
Playing around with the collections and collections.abc modules in
python3.4 I stumbled upon the following: >>> from collections.abc import
Sequence >>> from collections import deque >>> isinstance(list(),
Sequence) True >>> isinstance(deque(), Sequence) False >>> This seems
strange to me. As far a
Second tryal, I hope the formatting doesn't get messed up now
Playing around with the collections and collections.abc modules in
python3.4 I stumbled upon the following:
>>> from collections.abc import Sequence
>>> from collections import deque
>>> isinstance(list(), Sequence)
True
>>> isinstance
Op 07-04-16 om 11:12 schreef Peter Otten:
>
from collections import deque
from collections.abc import Sequence
[name for name in set(dir(Sequence)) - set(dir(deque)) if not
> name.startswith("_")]
> ['index']
>
> So the index() method seems to be what is missing.
the index() method
risons, because there is no
__cmp__ method, to make such a codefication.
Is there a way to work around these limitations or
should I resign myself to working within them?
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
Op 07-04-16 om 14:22 schreef Chris Angelico:
...
> There's no __cmp__ method, but you could easily craft your own
> compare() function:
>
> def compare(x, y):
> """Return a number < 0 if x < y, or > 0 if x > y"""
> if x == y: return 0
> return -1 if keyify(x) < keyify(y) else 1
>
>
Op 08-04-16 om 00:21 schreef Chris Angelico:
> On Fri, Apr 8, 2016 at 6:56 AM, Antoon Pardon
> wrote:
>> That solution will mean I will have to do about 100% more comparisons
>> than previously.
> Try it regardless. You'll probably find that performance is fine.
&g
Op 07-04-16 om 23:08 schreef Ben Finney:
> Antoon Pardon writes:
>
>> With this method I have to traverse the two tuples almost always
>> twice. Once to find out if they are equal and if not a second time to
>> find out which is greater.
> You are essentially describ
Op 08-04-16 om 09:47 schreef Ben Finney:
> Antoon Pardon writes:
>
>> But it was already working and optimized. The python3 approach forces
>> me to make changes to working code and make the performance worse.
> Yes, changing from Python 2 to Python 3 entails changing workin
Op 08-04-16 om 16:08 schreef Chris Angelico:
> On Fri, Apr 8, 2016 at 11:31 PM, Antoon Pardon
> wrote:
>> Doing it as follows:
>> seq1 < seq2
>> seq2 < seq1
>>
>> takes about 110 seconds.
>>
>>
>> Doing it like this:
>
Op 08-04-16 om 15:52 schreef Marko Rauhamaa:
> Antoon Pardon :
>
>> Well having a list of 1000 Sequence like object. Each sequence
>> containing between 1 and 100 numbers. Comparing each sequence
>> to each other a 100 times. I get the following results.
>>
>&
Op 08-04-16 om 16:25 schreef Chris Angelico:
> On Sat, Apr 9, 2016 at 12:20 AM, Antoon Pardon
> wrote:
>>> You only need ONE comparison, and the other is presumed to be its
>>> opposite. When, in the Python 3 version, would you need to compare
>>> twice?
&g
Op 09-04-16 om 13:49 schreef Ben Finney:
> Antoon Pardon writes:
>
>> You don't seem to understand. I only do two comparisons and no the
>> equality is not necesarrily cheaper.
>>
>> I am talking about the difference between the following two:
>>
&
responding values. As long as a dict can't provide
me with that answer, it doesn't matter that it will out perform
lookups in my trees.
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
Op 09-04-16 om 17:31 schreef Chris Angelico:
> On Sun, Apr 10, 2016 at 1:24 AM, Antoon Pardon
> wrote:
>>
>> So? I need a structure that can easily give me an answer to the
>> following: Given key1 and key2 what are the the keys between them
>> with their correspon
I have been looking at the enum documentation and it
seems enums are missing two features I rather find
important.
1) Given an Enum value, someway to get the next/previous
one
2) Given two Enum values, iterate over the values between
them.
Did I miss those in the documentation or are they
I have a unittest for my avltree module.
Now I want this unittest to also run on a subclass of avltree.
How can I organise this, so that I can largely reuse the
original TestCase?
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
Op 14-04-16 om 17:05 schreef Steven D'Aprano:
> On Fri, 15 Apr 2016 12:08 am, Antoon Pardon wrote:
>
>> I have a unittest for my avltree module.
>>
>> Now I want this unittest to also run on a subclass of avltree.
>> How can I organise this, so that I can lar
Op 15-04-16 om 09:42 schreef Chris Angelico:
> On Fri, Apr 15, 2016 at 4:52 PM, Antoon Pardon
> wrote:
>> Op 14-04-16 om 17:05 schreef Steven D'Aprano:
>>> On Fri, 15 Apr 2016 12:08 am, Antoon Pardon wrote:
>>>
>>>> I have a unittest for my avltre
d the
rest, something equally simple might have worked here. But that is another
discussions.
[Sensible suggestions removed.]
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
Op 15-04-16 om 13:43 schreef Antoon Pardon:
> Op 15-04-16 om 11:10 schreef Steven D'Aprano:
>> If you have code which is not parameterized, and you want to parameterize
>> it, you have to refactor. Unit tests are no different from anything else.
> I don't agree with tha
Op 15-04-16 om 18:47 schreef Steven D'Aprano:
> On Fri, 15 Apr 2016 10:48 pm, Antoon Pardon wrote:
>
>> Starting from this:
>>
>> class Test_AVLTree(unittest.TestCase):
>>
>> def test_empty_tree_is_false(self):
>> insta
ll personnaly I would like the introduction of weights.
So that reserved keywords are in bold and identifiers are
thin.
With unicode we could use the mathematical bold letters for
reserved words.
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
Op 06-06-16 om 05:52 schreef Steven D'Aprano:
> On Mon, 6 Jun 2016 03:42 am, Random832 wrote:
>
>> On Sun, Jun 5, 2016, at 02:37, Steven D'Aprano wrote:
>>> No they don't. You are confusing the implementation with the programming
>>> model.
>>>
>>> Following the assignment:
>>>
>>> x = 99
>>>
>>> i
Op 07-06-16 om 12:18 schreef Steven D'Aprano:
> We're talking about mental models. Sure, you could come up
> with some kind of Tardis-like mental model where objects
> exist in more than one location at once. But why would
> you bother going to such mental contortions?
> Because (self-recursive dat
Op 07-06-16 om 17:33 schreef Random832:
> On Tue, Jun 7, 2016, at 08:32, Antoon Pardon wrote:
>>> Here's a thought experiment for you. Suppose in Python 3.6, Guido announces
>>> that Python will support a form of high-level pointer (not the scary,
>>> da
Op 07-06-16 om 18:03 schreef Steven D'Aprano:
> On Tue, 7 Jun 2016 10:32 pm, Antoon Pardon wrote:
>
>> That people often use the shortcut "x is 999" doesn't make the statement
>> wrong that variables are essentially references in Python.
> No, I'm
Op 08-06-16 om 10:47 schreef Steven D'Aprano:
> On Wednesday 08 June 2016 17:53, Antoon Pardon wrote:
>
>> Python could go the simula route, which has two kinds of
>> assignment. One with the python semantics and one with C
>> semantics.
>>
>> Let as use :=
Op 08-06-16 om 12:33 schreef BartC:
> On 08/06/2016 10:41, Antoon Pardon wrote:
>> Op 08-06-16 om 10:47 schreef Steven D'Aprano:
>>> On Wednesday 08 June 2016 17:53, Antoon Pardon wrote:
>>>
>>>> Python could go the simula route, which has two k
om simula.
It is possible to write simula programs that almost exclusively
use reference assignments. Limiting yourself like that, would
also not allow you to do /proper/ referencing.
It seems weird to refuse to call something a /proper/ reference,
while what is missing is not a reference assig
Op 08-06-16 om 18:37 schreef Marko Rauhamaa:
> Antoon Pardon :
>
>> You can do something like that in simula, but only because
>> simula has two kinds of assignments. One kind that is
>> simular to python and one that is similar to C.
>> The one that is simila
nt than in an environment where you don't
doesn't make the aliases go away.
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
Op 09-06-16 om 09:36 schreef Steven D'Aprano:
> On Wednesday 08 June 2016 19:41, Antoon Pardon wrote:
>
>>> What you seem to be describing is similar to reference parameter semantics
>>> from Pascal. Assignment doesn't work that way in C, or Python.
>> I
Op 09-06-16 om 11:10 schreef BartC:
> On 09/06/2016 08:50, Antoon Pardon wrote:
>> Op 08-06-16 om 19:29 schreef BartC:
>>> I don't see why we should determine what a /proper/ reference
>>>> can do, based on what it does in one specific language.
>>>
Op 09-06-16 om 11:19 schreef Marko Rauhamaa:
>
>> In a rather straight forward environment with classes/structs that
>> have an x and y attribute, the following lines behave differently
>> in C and Python.
>>
>> A.x = 1;
>> A.y = 2;
>>
>> B = A;
>>
>> B.x = 3;
>> B.y = 4;
>>
>> In C the v
Op 09-06-16 om 12:48 schreef BartC:
>
> What does it matter?
>
> If swap() can be implemented via such a function, then it means that
> the language has such capability, which can be useful in different
> scenarios.
>
> If it can't, then the language hasn't.
>
> Python doesn't have it so it can't i
Op 09-06-16 om 12:53 schreef BartC:
> On 09/06/2016 10:46, Antoon Pardon wrote:
>> Op 09-06-16 om 09:36 schreef Steven D'Aprano:
>
>>> Your example demonstrates object mutation, not assignment.
>>
>> Generally assignment and mutation don't contradict eac
Op 09-06-16 om 13:46 schreef Julien Salort:
> Antoon Pardon wrote:
>
>> A.x = 1;
>> A.y = 2;
>>
>> B = A;
>>
>> B.x = 3;
>> B.y = 4;
>>
>>
>> In C the variable A will still be x:1, y:2.
>> In Python the variable A
Op 09-06-16 om 14:25 schreef BartC:
> On 09/06/2016 12:08, Antoon Pardon wrote:
>> Op 09-06-16 om 12:48 schreef BartC:
>>>
>>> What does it matter?
>>>
>>> If swap() can be implemented via such a function, then it means that
>>> the language
Op 09-06-16 om 14:17 schreef BartC:
> On 09/06/2016 12:19, Antoon Pardon wrote:
>> Op 09-06-16 om 12:53 schreef BartC:
>>> On 09/06/2016 10:46, Antoon Pardon wrote:
>>>> Op 09-06-16 om 09:36 schreef Steven D'Aprano:
>>>
>>>>>
Op 12-06-16 om 23:10 schreef BartC:
> On 12/06/2016 20:25, Ned Batchelder wrote:
>> Just as here there is no link between x
>> and y:
>>
>> x = 12
>> y = x
>
> (And that's a good illustration of why 'y' isn't a name reference to 'x',
> referring to the "...ducks limp" thread. But best n
Op 19-06-16 om 23:20 schreef BartC:
> On 19/06/2016 15:35, Antoon Pardon wrote:
>> Op 12-06-16 om 23:10 schreef BartC:
>>> On 12/06/2016 20:25, Ned Batchelder wrote:
>>>> Just as here there is no link between x
>>>> and y:
>>>>
>
Op 20-06-16 om 14:15 schreef Steven D'Aprano:
> On Mon, 20 Jun 2016 09:14 pm, Antoon Pardon wrote:
>
>> Op 19-06-16 om 23:20 schreef BartC:
>>> On 19/06/2016 15:35, Antoon Pardon wrote:
>>>> Op 12-06-16 om 23:10 schreef BartC:
>>>>> On 12/06/20
Op 20-06-16 om 16:53 schreef 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 to 'x'
Op 21-06-16 om 12:41 schreef BartC:
> On 21/06/2016 09:08, Antoon Pardon wrote:
>> Op 20-06-16 om 16:53 schreef Steven D'Aprano:
>
>>> You know, there's not actually a rule or law that says you have to
>>> automatically take the contrary position to everythi
Op 22-06-16 om 04:48 schreef Steven D'Aprano:
> I'm doing some arithmetic on complex numbers involving INFs, and getting
> unexpected NANs.
>
> py> INF = float('inf')
> py> z = INF + 3j
> py> z
> (inf+3j)
> py> -z
> (-inf-3j)
>
> So far, nothing unexpected has occurred. But:
>
> py> -1*z # should
When I need
real booleans, encountering whatever else that can act like a boolean,
is more often than not an indication something went wrong but the
detection of it going wrong is delayed, because almost everything
can act like a boolean. It is why I have sometime found the need
to write:
if flag is
Op 23-06-16 om 09:05 schreef 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".
No zero is not nothin
f I have to test for emptyness, I always write
if len(seq) > 0:
Because this will throw an exception when len can't
apply to seq and so this will catch possible bugs
sooner than writing:
if not seq.
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
Op 23-06-16 om 10:48 schreef 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.
I don't care. In modern mathemati
Op 23-06-16 om 11:10 schreef Marko Rauhamaa:
> Lawrence D’Oliveiro :
>
>> On Thursday, June 23, 2016 at 8:17:02 PM UTC+12, Marko Rauhamaa wrote:
>>> if len(leftover) > 0:# no, I'd never write this
>>> ...
>> I regularly write “len(leftover) != 0”. Why not?
> The __len__ method is no
Op 23-06-16 om 11:39 schreef 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, Lawren
Op 23-06-16 om 11:53 schreef Marko Rauhamaa:
> Antoon Pardon :
>
>> Op 23-06-16 om 11:10 schreef Marko Rauhamaa:
>>> The __len__ method is not guaranteed to execute in O(1). See:
>>>
>>>https://docs.python.org/3/reference/datamodel.html?highlig
>>&
Op 23-06-16 om 12:59 schreef Marko Rauhamaa:
> Antoon Pardon :
>
>> Op 23-06-16 om 11:53 schreef Marko Rauhamaa:
>> Maybe something like this:
>>
>> def empty(sq):
>> try:
>> iter(sq).next()
>> except StopIteration:
>>
Op 23-06-16 om 13:45 schreef Chris Angelico:
> On Thu, Jun 23, 2016 at 7:23 PM, Antoon Pardon
> wrote:
>> I don't care. In modern mathematics, zero is usaly defined as the
>> empty set. The empty set contains nothing, but it isn't nothing
>> itself. Otherwise
Op 23-06-16 om 14:37 schreef Steven D'Aprano:
> So I'm not really sure what you are trying to describe. I guess it might be
> something like this:
>
> def spam(alist):
> if alist:
> process(alist)
> else:
> print("empty list")
>
>
> If you pass 1 instead of an actual list,
Op 01-07-16 om 15:52 schreef Steven D'Aprano:
> On Fri, 1 Jul 2016 10:25 pm, Christopher Reimer wrote:
>
>> For my BASIC interpreter, each line of BASIC is broken this way into
>> tokens.
> [...]
>> By using * to unpack the split line, my program no longer crashes and no
>> try/except block is need
0.95 and 1.05.
Now between which two numbers is 0001 supposed to be?
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
Op 12-07-16 om 12:27 schreef Marko Rauhamaa:
> Antoon Pardon :
>
>> Op 12-07-16 om 06:19 schreef Steven D'Aprano:
>>> How do you represent 1 mm to a precision of four significant digits,
>>> in such a way that it is distinguished from 1 mm to one significant
&g
Op 13-07-16 om 10:49 schreef Steven D'Aprano:
> On Wednesday 13 July 2016 17:05, Lawrence D’Oliveiro wrote:
>
>> On Wednesday, July 13, 2016 at 6:22:31 PM UTC+12, Ian wrote:
>>
>>> I never claimed it's not useful. I don't really have a problem with
>>> format supporting it, either. But if it does,
#x27;t educated about learning curves and so I think common
usage among educated speakers is inadequate as a yard stick.
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
Op 15-07-16 om 11:20 schreef Marko Rauhamaa:
> Antoon Pardon :
>
>> Op 15-07-16 om 08:06 schreef Marko Rauhamaa:
>>> Common usage among educated speakers ordinarily is the yardstick for
>>> language questions.
>> But educated about what exactly?
> In this cas
Op 15-07-16 om 10:40 schreef Jussi Piitulainen:
> Antoon Pardon writes:
>
>> Op 15-07-16 om 08:06 schreef Marko Rauhamaa:
>>> Common usage among educated speakers ordinarily is the yardstick for
>>> language questions.
>> But educated about what exactly?
&g
Op 15-07-16 om 12:56 schreef Steven D'Aprano:
> On Fri, 15 Jul 2016 06:40 pm, Jussi Piitulainen wrote:
>
>> Antoon Pardon writes:
>>
>>> Op 15-07-16 om 08:06 schreef Marko Rauhamaa:
>>>> Common usage among educated speakers ordinarily is the yardstick f
Op 15-07-16 om 15:39 schreef Random832:
>
> On Fri, Jul 15, 2016, at 07:44, Antoon Pardon wrote:
>
>> No, that is what people come up with afterwards. If you just start a
>> conversation about how people learn and how long it would take to get
>> some mastery and how we
Op 15-07-16 om 15:38 schreef Jussi Piitulainen:
> Antoon Pardon writes:
>
>> No, that is what people come up with afterwards. If you just start a
>> conversation about how people learn and how long it would take to get
>> some mastery and how we could present progre
301 - 400 of 1820 matches
Mail list logo