Re: Guido rethinking removal of cmp from sort method

2011-03-25 Thread Antoon Pardon
On Thu, Mar 24, 2011 at 11:49:53PM +, Steven D'Aprano wrote: > On Thu, 24 Mar 2011 17:47:05 +0100, Antoon Pardon wrote: > > > However since that seems to be a problem for you I will be more > > detailed. The original poster didn't ask for cases in which cmp was

Re: Guido rethinking removal of cmp from sort method

2011-03-25 Thread Antoon Pardon
On Fri, Mar 25, 2011 at 11:05:17AM +0100, Stefan Behnel wrote: > Antoon Pardon, 25.03.2011 10:21: > >On Thu, Mar 24, 2011 at 11:49:53PM +, Steven D'Aprano wrote: > >>On Thu, 24 Mar 2011 17:47:05 +0100, Antoon Pardon wrote: > >> > >>>However since

Re: Guido rethinking removal of cmp from sort method

2011-03-28 Thread Antoon Pardon
On Fri, Mar 25, 2011 at 10:40:03PM +, Steven D'Aprano wrote: > On Fri, 25 Mar 2011 13:56:23 +0100, Antoon Pardon wrote: > > > Look we are provided with the cmp_to_key function. If something doesn't > > work with that function or performs realy bad with that funct

Re: Guido rethinking removal of cmp from sort method

2011-03-28 Thread Antoon Pardon
On Fri, Mar 25, 2011 at 10:06:59PM +, Steven D'Aprano wrote: > On Fri, 25 Mar 2011 10:21:35 +0100, Antoon Pardon wrote: > > > On Thu, Mar 24, 2011 at 11:49:53PM +, Steven D'Aprano wrote: > >> On Thu, 24 Mar 2011 17:47:05 +0100, Antoon Pardon wrote: > >

Re: Guido rethinking removal of cmp from sort method

2011-03-29 Thread Antoon Pardon
On Mon, Mar 28, 2011 at 11:35:09AM +, Steven D'Aprano wrote: > [...] > > Forcing people to use a key-function, will produce cases where python > > will ask for more memory and take longer to sort, than allowing to > > provide a cmp function. > > More memory yes; take longer to sort, almost ce

Re: Guido rethinking removal of cmp from sort method

2011-03-29 Thread Antoon Pardon
On Mon, Mar 28, 2011 at 03:43:03PM +, Steven D'Aprano wrote: > On Mon, 28 Mar 2011 14:39:04 +0200, Antoon Pardon wrote: > > > I tried to sort lists of 1 elemens. Each element a tuple two items > > that was to be sorted first according to the first item in as

Re: Guido rethinking removal of cmp from sort method

2011-03-30 Thread Antoon Pardon
On Tue, Mar 29, 2011 at 03:35:40PM -0400, Terry Reedy wrote: > For anyone interested, the tracker discussion on removing cmp is at > http://bugs.python.org/issue1771 > There may have been more on the old py3k list and pydev list. > > One point made there is that removing cmp= made list.sort consis

Re: Guido rethinking removal of cmp from sort method

2011-03-31 Thread Antoon Pardon
On Thu, Mar 31, 2011 at 02:13:53AM +, Steven D'Aprano wrote: > On Wed, 30 Mar 2011 11:06:20 +0200, Antoon Pardon wrote: > > > As far as I can see, key will only produce significant speedups, if > > comparing items can then be completly done internally in the py

Re: Guido rethinking removal of cmp from sort method

2011-04-04 Thread Antoon Pardon
On Fri, Apr 01, 2011 at 10:21:33PM -0400, Terry Reedy wrote: > > rewriting cmp_to_key in C is underway > > http://bugs.python.org/issue11707 > Nice to know! Any chance this wil get into 2.7.x? -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: A question on modification of a list via a function invocation

2017-09-04 Thread Antoon Pardon
| | | 7 | | 7 | | | 7 | | | | | |---> | | +-+ +-+ | / +-+ / ^ ^ / ^ | | / | -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: A question on modification of a list via a function invocation

2017-09-04 Thread Antoon Pardon
r or ?) is central to python's semantics > If they are so central, then it should be easy to show > quotes from The Python Language Reference to support that > claim. The section about assignment talks about reference counts. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: A question on modification of a list via a function invocation

2017-09-04 Thread Antoon Pardon
Op 04-09-17 om 13:08 schreef Stefan Ram: > Antoon Pardon writes: >> Op 04-09-17 om 12:22 schreef Stefan Ram: >>> Rustom Mody writes: >>>>> Stefan Ram wrote: >>>>>> JavaScript and Python do not have references as values >>>>>

Re: A question on modification of a list via a function invocation

2017-09-04 Thread Antoon Pardon
Op 04-09-17 om 15:24 schreef Steve D'Aprano: > I accept that many people dislike, or do not understand, conceptual models > where > objects can be in more than one location at once. For many people, dropping > into the implementation and talking about references is easier to understand. > But that

Re: A question on modification of a list via a function invocation

2017-09-04 Thread Antoon Pardon
Op 04-09-17 om 15:26 schreef Steve D'Aprano: > On Mon, 4 Sep 2017 08:52 pm, Antoon Pardon wrote: > >> Op 04-09-17 om 12:22 schreef Stefan Ram: >>> Rustom Mody writes: >>>>> Stefan Ram wrote: >>>>>> JavaScript and Python do not have refe

Re: A question on modification of a list via a function invocation

2017-09-04 Thread Antoon Pardon
On 04-09-17 16:30, Steve D'Aprano wrote: > On Tue, 5 Sep 2017 12:09 am, Antoon Pardon wrote: > >> Op 04-09-17 om 15:26 schreef Steve D'Aprano: >>> On Mon, 4 Sep 2017 08:52 pm, Antoon Pardon wrote: >>> >>>> Op 04-09-17 om 12:22 schreef Stefa

How do I find what kind of exception is thrown.

2017-09-05 Thread Antoon Pardon
a problem I would like to catch earlier however I have no idea what exception I would have to catch in order to treat this case. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I find what kind of exception is thrown.

2017-09-05 Thread Antoon Pardon
On 05-09-17 13:39, Steve D'Aprano wrote: > On Tue, 5 Sep 2017 06:50 pm, Antoon Pardon wrote: > >> Python 2.6.4 on a solaris box. >> >> I have a program in which all kind of excptions can be thrown and caugth. >> The main program is something like below: &

Re: A question on modification of a list via a function invocation

2017-09-06 Thread Antoon Pardon
| | | | +-+ +-+ ^ ^ | | And in case of a VAR parameter in Pascal like procedure f(VAR x); f(y) one could use the following, which is the same as after an assignment in python. +-+

Re: A question on modification of a list via a function invocation

2017-09-06 Thread Antoon Pardon
Op 06-09-17 om 14:58 schreef Steve D'Aprano: > On Wed, 6 Sep 2017 05:12 pm, Antoon Pardon wrote: > > [...] >>> I'm not saying that we should never use this model. Its a good model. But we >>> should be clear that it is a model of the implementation, and it desc

Re: A question on modification of a list via a function invocation

2017-09-06 Thread Antoon Pardon
ion of the language one talks > about does. > But that makes it difficult to point to similar semantics in two languages, when those languages use different wording to express those semantics. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: A question on modification of a list via a function invocation

2017-09-07 Thread Antoon Pardon
ls1) print(id(ls2), ls2) print("") swap(ls1, ls2) print(id(ls1), ls1) print(id(ls2), ls2) Which on my computer produces: 140178186781768 [1, 3, 5, 7] 140178186794632 [0, 2, 4, 6] 140178186781768 [0, 2, 4, 6] 140178186794632 [1, 3, 5, 7] -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: A question on modification of a list via a function invocation

2017-09-08 Thread Antoon Pardon
through the other." while it seems more natural to me to understand it as: "if and only if *all* mutations made through one are visible through the other." So since it is possible to mutate b in ways that are not reflected in a, I can't really see this as a false positive. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

mutiprocessing gui

2017-09-11 Thread Antoon Pardon
connection. Could one write a wrapper so that the multiprocessing.Queue or multiprocessing.Pipe could be usable like that? -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] beginning to code

2017-09-18 Thread Antoon Pardon
of interface with the io module because a read from classes in that module will produce an empty (byte)string to indicate the end of the stream. Once you understand how python does things, you can work with it, but IMO the way python does things is IMO not at all that obvious as people would like us to think. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] beginning to code

2017-09-19 Thread Antoon Pardon
Op 18-09-17 om 15:47 schreef Paul Moore: > On 18 September 2017 at 14:30, Antoon Pardon wrote: >> Well that you reduce an object to a boolean value is not obvious to >> begin with. A TypeError because you are treating a non-boolean as >> a boolean would have been more

Re: [Tutor] beginning to code

2017-09-19 Thread Antoon Pardon
Op 18-09-17 om 15:58 schreef Chris Angelico: > On Mon, Sep 18, 2017 at 11:30 PM, Antoon Pardon wrote: > >> Well that you reduce an object to a boolean value is not obvious to >> begin with. A TypeError because you are treating a non-boolean as >> a boolean would have

Re: [Tutor] beginning to code

2017-09-19 Thread Antoon Pardon
Op 19-09-17 om 09:40 schreef Chris Angelico: > On Tue, Sep 19, 2017 at 5:10 PM, Antoon Pardon wrote: > >> I don't find it really usefull. How useful is it that you can type >> if a: instead of if a != 0: ? I have yet to encounter a situation >> where I thought: Yes I

Re: [Tutor] beginning to code

2017-09-19 Thread Antoon Pardon
Op 19-09-17 om 09:46 schreef Chris Angelico: > On Tue, Sep 19, 2017 at 5:22 PM, Antoon Pardon wrote: >> But the problem is that the following two pieces of code don't do >> the same in Python. >> >> if x: pass >> if x is True: pass >> > ...

Re: [Tutor] beginning to code

2017-09-19 Thread Antoon Pardon
Op 19-09-17 om 11:22 schreef Steven D'Aprano: > On Tue, 19 Sep 2017 09:10:04 +0200, Antoon Pardon wrote: > >> Op 18-09-17 om 15:47 schreef Paul Moore: >>> On 18 September 2017 at 14:30, Antoon Pardon >>> wrote: >>>> Well that you reduce an object

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Antoon Pardon
me method as used in any Python "assignment" statement, > > Which is why I think "call by assignment" would be > a much better term! > But since the semantics of an assignment depends on the language, "call by assignment" says nothing abouth the semantics of th

Re: [Tutor] beginning to code

2017-09-25 Thread Antoon Pardon
int depend on the assignment being a copy-over operation, as you did here. The fact that assignment is an *alias* opertation is illustrated by the fact that a mutation through one name, is visible through the other name. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] beginning to code

2017-09-25 Thread Antoon Pardon
> other variant. That isn't call by reference semantics. No it doesn't, not unless the assignment mutates by copying the value on the right side over the variable on the left side. Your assertions about call by reference only apply in a particular context, one where assignments mutate the variable that is assigned to. This is a point you continuously ignore. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Antoon Pardon
Op 25-09-17 om 11:41 schreef Marko Rauhamaa: > Antoon Pardon : > >> the semantics of an assignment depends on the language > I've only seen one kind of assignment in the general-purpose programming > languages I know, maybe with the exception of Prolog and Rust. I disa

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Antoon Pardon
Op 25-09-17 om 13:32 schreef Marko Rauhamaa: > Antoon Pardon : > >> Op 25-09-17 om 11:41 schreef Marko Rauhamaa: >>> Antoon Pardon : >>> >>>> the semantics of an assignment depends on the language >>> I've only seen one kind of assignment

Re: [Tutor] beginning to code

2017-09-25 Thread Antoon Pardon
Op 25-09-17 om 14:24 schreef Steve D'Aprano: > On Mon, 25 Sep 2017 08:05 pm, Antoon Pardon wrote: > >> Pass by reference doesn't imply being able to >> write a swap function. > Really. Do you have a counter-example? Python, smalltalk, scheme. > > >> A s

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Antoon Pardon
Op 25-09-17 om 14:16 schreef Marko Rauhamaa: > Antoon Pardon : > >> Op 25-09-17 om 13:32 schreef Marko Rauhamaa: >>> In Python, assignment "mutates the target" as well. It's only that in >>> Python, the target is always a pointer. >> Fine if you w

Re: [Tutor] beginning to code

2017-09-25 Thread Antoon Pardon
Op 25-09-17 om 14:53 schreef Ned Batchelder: > On 9/25/17 8:24 AM, Steve D'Aprano wrote: >> On Mon, 25 Sep 2017 08:05 pm, Antoon Pardon wrote: >> >>> Pass by reference doesn't imply being able to >>> write a swap function. >> Really. Do you hav

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Antoon Pardon
Op 25-09-17 om 15:16 schreef Marko Rauhamaa: > Antoon Pardon : > >> Op 25-09-17 om 14:16 schreef Marko Rauhamaa: >>> Python only operates with pointers. You can operate with pointers in >>> Pascal as well. >> You are talking about implementation details. >

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Antoon Pardon
On 25-09-17 16:29, Marko Rauhamaa wrote: > Antoon Pardon : > >> Op 25-09-17 om 15:16 schreef Marko Rauhamaa: >>> No, I'm not. I'm talking about pointers in the abstract sense, both in >>> case of Python and Pascal. Neither language gives any hint as t

Re: [Tutor] beginning to code

2017-09-25 Thread Antoon Pardon
On 25-09-17 15:37, Ned Batchelder wrote: > On 9/25/17 9:15 AM, Antoon Pardon wrote: >> Op 25-09-17 om 14:53 schreef Ned Batchelder: >>> On 9/25/17 8:24 AM, Steve D'Aprano wrote: >>>> On Mon, 25 Sep 2017 08:05 pm, Antoon Pardon wrote: >>>> >

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Antoon Pardon
On 25-09-17 19:31, Chris Angelico wrote: > On Tue, Sep 26, 2017 at 3:04 AM, Antoon Pardon > wrote: >> On 25-09-17 16:29, Marko Rauhamaa wrote: >>> Antoon Pardon : >>> >>>> Op 25-09-17 om 15:16 schreef Marko Rauhamaa: >>>>> No, I'm

Re: Call by binding [was Re: [Tutor] beginning to code]

2017-09-25 Thread Antoon Pardon
On 25-09-17 20:01, Chris Angelico wrote: > On Tue, Sep 26, 2017 at 3:54 AM, Antoon Pardon > wrote: >> On 25-09-17 19:31, Chris Angelico wrote: >>> If by "identity" you mean the integer values returned by id(), then >>> nope, you're still wrong - ther

Re: [Tutor] beginning to code

2017-09-25 Thread Antoon Pardon
On 25-09-17 21:44, Ned Batchelder wrote: > On 9/25/17 5:32 AM, Antoon Pardon wrote: >> Can you explain, what you mean by "Pass-By-Reference" as far a I understand, >> pass by reference means that the parameter of the function becomes an alias >> of the argument, s

Re: Grumpy-pants spoil-sport [was Re: [Tutor] beginning to code]

2017-09-25 Thread Antoon Pardon
same for all these languages, I'm not surprises people get confused. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] beginning to code

2017-09-26 Thread Antoon Pardon
s if those are the only two options (a common > misunderstanding). > > Elsewhere in this thread, someone asserted that to be call by > reference, you have to be able to write a swap(x,y) function.  True > call-by-reference would make this possible.  Python cannot do it. I can write

Re: Grumpy-pants spoil-sport

2017-09-26 Thread Antoon Pardon
. I can write a swap function for lists in python, so is it correct to conclude that list arguments are passed by reference? -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Grumpy-pants spoil-sport

2017-09-26 Thread Antoon Pardon
Op 26-09-17 om 12:09 schreef Marko Rauhamaa: > Antoon Pardon : > >> That wont happen as long as people continue to do damage with e.g. >> claiming that the python assignment is not an alias operation. >> >> There is IMO no conceptual damage by regarding the call sem

Re: Aliasing [was Re: [Tutor] beginning to code]

2017-09-26 Thread Antoon Pardon
On 26-09-17 14:28, Steve D'Aprano wrote: > On Tue, 26 Sep 2017 03:26 am, Antoon Pardon wrote: > >> Sorry, what he wrote contradicts that. Maybe he was just really confused >> at that moment, but it still needed correction. If the assignment is >> an alias opera

Re: Aliasing [was Re: [Tutor] beginning to code]

2017-09-27 Thread Antoon Pardon
Op 27-09-17 om 04:58 schreef Steve D'Aprano: > On Wed, 27 Sep 2017 02:03 am, Stefan Ram wrote: > >> Steve D'Aprano writes: >>> On Tue, 26 Sep 2017 03:26 am, Antoon Pardon wrote: >>>> at that moment, but it still needed correction. If the assignme

Re: Aliasing [was Re: [Tutor] beginning to code]

2017-09-27 Thread Antoon Pardon
her context it doesn't you can't interfere conclusions about the assignment in the second context based on the effects an assignment has in the first context because we are talking about two differnt operations that just use the same lable. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Aliasing [was Re: [Tutor] beginning to code]

2017-09-27 Thread Antoon Pardon
doesn't actually achieve what swap() does. If you refer to languages like Pascal or C, for illustrating that you can write a swap function in them, the swapping that happens there is one of content. So claiming that swapping contend doesn't actually achieves whar swap() does, seems wro

Re: Aliasing [was Re: [Tutor] beginning to code]

2017-09-27 Thread Antoon Pardon
Op 27-09-17 om 09:38 schreef Steven D'Aprano: No, the model that C++ and Pascal use is not different in this aspect. > that Pascal var parameters and C++ reference variables operate the same > way as Python variable assignment, the *kindest* thing I can say is that > you are ignorant. The kind

Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-11-27 Thread Antoon Pardon
ll be just too hard. > (or one must define a new whole language specially for some local script) Well maybe the value is not huge, but I really appreciate the possibility. Being able to write something like below, makes things a lot more clear for me. Po = Pc + R * Vec(cos(θo), sin(θo)) Pe = Pc + R * Vec(cos(θe), sin(θe)) 𝚫θ = θe - θo 𝚫P = Pe - Po -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: request fails on wikipedia (https) - certificate verify failed (Posting On Python-List Prohibited)

2017-12-13 Thread Antoon Pardon
to use > your system-provided package manager to install additional components. > If you want to argue otherwise, argue it, don't just assert it. Why do you ask this of Jon Ribbens? As far as I can see, Laurence D'Oliveiro, just stated something as fact, without argument. Why do y

Re: Why does __ne__ exist?

2018-01-08 Thread Antoon Pardon
operator was so important, I think it would have been better to introduce boxed operators, like [+], [<] ... where the default behaviour would be an elementary wise application of the non-boxed operator. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: Why does __ne__ exist?

2018-01-08 Thread Antoon Pardon
like this is idiomatic: > > some_arr = np.array([-1, 0, 1, 2, 3, 4, 5, 2, -1, 3, -1, 6, 7, 3]) > valid = some_arr[some_arr != -1] I guess it was rather useful because list comprehension wasn't included in the language at that moment, but I don't find it that much more useful than:

Re: Simple graphic library for beginners

2018-01-10 Thread Antoon Pardon
On 10-01-18 13:40, Jan Erik Moström wrote: > I'm looking for a really easy to use graphic library. The target users > are teachers who have never programmed before and is taking a first > (and possible last) programming course. > > I would like to have the ability to draw lines, circles, etc. Nothi

2.6.7: Does socket.gethostbyaddr truncate?

2018-01-30 Thread Antoon Pardon
a bug? If the latter, is there a work around? -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Distance between point and a line passing through other two points

2018-02-07 Thread Antoon Pardon
On 07-02-18 12:06, Dhananjay wrote: > Hello all, > > ... > I want to write a script that can calculate shortest distance d between > point (x0,y0,z0) and the line((x1,y1,z1), (x2,y2,z2)). > In other words, > d = distance(a, line(b,c)) > Since I have information of the coordinates of these points on

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-19 Thread Antoon Pardon
oubt its original author realized that the > requests were being repeated. Pseudo-coded: But was that a reflection on C# or on the original author? -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Antoon Pardon
On 19-02-18 16:18, Ned Batchelder wrote: > On 2/19/18 9:54 AM, Steven D'Aprano wrote: >> 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 name

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Antoon Pardon
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. >> >> But Python has classes and can do some of this stuff; how would it >> handle a numeric type that is constr

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Antoon Pardon
On 20-02-18 13:11, Paul Moore wrote: > On 20 February 2018 at 11:18, Antoon Pardon wrote: >> Personnally I would prefer the type system of Pascal and Modula2 with >> their interval type >> above a Digit class in python. For the simple reason that once you had >> decla

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Antoon Pardon
On 20-02-18 13:24, Steven D'Aprano wrote: > 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

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Antoon Pardon
I'm not proficient with C++, but IIUC, you could make a class in C++ and have the constructor and copy operator check for these kind of things. True it would be run-time checks but that would already be more than Python can give. >>> That (run-time checks) is exactly the sa

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Antoon Pardon
On 20-02-18 14:55, Chris Angelico wrote: > On Wed, Feb 21, 2018 at 12:38 AM, Antoon Pardon wrote: >> Why should this be done at compile time? I say a static language can do >> the same as a dynamic language and your counter point is to ask for how >> that static language c

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Antoon Pardon
On 20-02-18 15:04, Paul Moore wrote: > On 20 February 2018 at 13:53, Antoon Pardon wrote: > >> You can't put such constraints on names in Python. > I know. That's what *I* said some time ago. So why did you bother complaining to me when I wrote it? -- https://mail.py

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Antoon Pardon
On 20-02-18 14:58, Chris Angelico wrote: > On Wed, Feb 21, 2018 at 12:53 AM, Antoon Pardon wrote: >> In C++ I can do something like: >> >> SomeClass MyVar; >> >> And after that the kind of possible assignments to MyVar are constraint. It >> makes the ru

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-21 Thread Antoon Pardon
On 20-02-18 16:38, 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 >>> accept integers representing A.D. years which, on the Gregorian >>> calend

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-21 Thread Antoon Pardon
On 21-02-18 05:13, Steven D'Aprano wrote: > 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: >>> >>>>> Ok

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-21 Thread Antoon Pardon
On 21-02-18 06:18, Terry Reedy wrote: > On 2/20/2018 8:38 AM, Antoon Pardon wrote: > >> People praise the dynamic nature of Python here on this list and then >> often enough seem to recoil when they see a piece of code really using >> that dynamism. > > ... > >

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-21 Thread Antoon Pardon
On 21-02-18 11:31, Terry Reedy wrote: > On 2/21/2018 3:15 AM, Antoon Pardon wrote: >> On 21-02-18 06:18, Terry Reedy wrote: >>> On 2/20/2018 8:38 AM, Antoon Pardon wrote: >>> >>>> People praise the dynamic nature of Python here on this list and then >>&

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread Antoon Pardon
On 23-02-18 02:27, Steven D'Aprano wrote: > Why do you care about the 50 million calls? That's crazy -- the important > thing is *calculating the Fibonacci numbers as efficiently as possible*. No necessarily. David Beazley in his talks sometimes uses an ineffecient algorithm for calculating fib

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread Antoon Pardon
om the standard implementation of the language unable of doing that then people testing languages shouldn't be burdened with going to search for some implementation that can. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Antoon Pardon
On 26-02-18 15:41, Steven D'Aprano wrote: > 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 No

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Antoon Pardon
On 26-02-18 15:41, Steven D'Aprano wrote: > 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 No

Re: Tuple unpacking inside lambda expressions

2022-04-19 Thread Antoon Pardon
Op 16/04/2022 om 23:36 schreef Sam Ezeh: Two questions here. Firstly, does anybody know of existing discussions (e.g. on here or on python-ideas) relating to unpacking inside lambda expressions? I found myself wanting to write the following. ``` map( lambda (module, data): result.process(

Re: tail

2022-04-24 Thread Antoon Pardon
to text 2) Split into lines 3) Iterate backwards over the lines Tada! Done. And in Python, quite easy. The downside, of course, is that you have to store the entire file in memory. Why not just do: tail = collections.deque(text_stream, maxlen = nr_of_lines) tail.reverse() ... -- Antoon Pardon

Re: min, max with position

2022-06-05 Thread Antoon Pardon
us old f...s and the visually-challenged!) ell = l one = 1 min(enumerate(ell), key=lambda x: x[one]) I'd like to point to the operator module which allows you to write the above as: min(enumerate(ell), key=operator.itemgetter(one)) -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Creating lambdas inside generator expression

2022-06-29 Thread Antoon Pardon
Or you could try this as an alternative: conds = [ (lambda code: lambda msg: msg.hascode(code))(z) for z in ("foo", "bar") ] Op 29/06/2022 om 12:43 schreef Johannes Bauer: Aha! conds = [ lambda msg, z = z: msg.hascode(z) for z in ("foo", "bar") ] Is what I was looking for to explicitly use

My first attempt at a package.

2022-07-19 Thread Antoon Pardon
should be build with the following linix command: $ date '+installed on %Y:%M:%d at %T' > data.cfg -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: My first attempt at a package.

2022-07-25 Thread Antoon Pardon
Op 19/07/2022 om 16:57 schreef David Lowry-Duda: On Tue, Jul 19, 2022 at 03:58:41PM +0200, Antoon Pardon wrote: I am writing a python package which has the following structure PACKAGE    * module1.py    * module2.py    * data.cfg However the data.cfg should be build at installation time

Re: My first attempt at a package.

2022-07-26 Thread Antoon Pardon
Op 25/07/2022 om 16:43 schreef Dennis Lee Bieber: On Mon, 25 Jul 2022 10:39:46 +0200, Antoon Pardon declaimed the following: Yes it is, but it doesn't answer my question: How do I create a package in which a file is built at install time. I just want to build a configuration file that

Re: Exclude 'None' from list comprehension of dicts

2022-08-04 Thread Antoon Pardon
turn an empty dictionary in case of a failure? In that case your list will be all dictionaries and empty ones will be processed fast enough. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Exclude 'None' from list comprehension of dicts

2022-08-15 Thread Antoon Pardon
Op 5/08/2022 om 07:50 schreef Loris Bennett: Antoon Pardon writes: Op 4/08/2022 om 13:51 schreef Loris Bennett: Hi, I am constructing a list of dictionaries via the following list comprehension: data = [get_job_efficiency_dict(job_id) for job_id in job_ids] However

Re: Exclude 'None' from list comprehension of dicts

2022-08-16 Thread Antoon Pardon
Op 16/08/2022 om 00:20 schreef dn: On 16/08/2022 00.56, Antoon Pardon wrote: Op 5/08/2022 om 07:50 schreef Loris Bennett: Antoon Pardon   writes: Op 4/08/2022 om 13:51 schreef Loris Bennett: Hi, I am constructing a list of dictionaries via the following list comprehension:     data

Re: How to make a variable's late binding crosses the module boundary?

2022-08-31 Thread Antoon Pardon
le_variable in both cases the module that did the import will not notice the change in the original module. focussing on the code smell, is leading the attention away from the problem. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make a variable's late binding crosses the module boundary?

2022-08-31 Thread Antoon Pardon
Op 31/08/2022 om 09:53 schreef dn: On 31/08/2022 19.38, Antoon Pardon wrote: Op 30/08/2022 om 23:52 schreef dn: The conversation seems to be wandering some way from the OP. Whereas both of these answers are clever (and I assume work), the question becomes: why would you want to do this

What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
. I just want a tool for syntax errors. No style enforcements. Any recommandations? -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
Op 9/10/2022 om 17:49 schreef Avi Gross: My guess is that finding 100 errors might turn out to be misleading. If you fix just the first, many others would go away. At this moment I would prefer a tool that reported 100 errors, which would allow me to easily correct 10 real errors, over the p

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
Op 9/10/2022 om 19:23 schreef Karsten Hilbert: Am Sun, Oct 09, 2022 at 06:59:36PM +0200 schrieb Antoon Pardon: Op 9/10/2022 om 17:49 schreef Avi Gross: My guess is that finding 100 errors might turn out to be misleading. If you fix just the first, many others would go away. At this moment

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
Op 9/10/2022 om 21:18 schreef Avi Gross: Antoon, it may also relate to an interpreter versus compiler issue. Something like a compiler for C does not do anything except write code in an assembly language. It can choose to keep going after an error and start looking some more from a less stab

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
Op 9/10/2022 om 21:18 schreef Avi Gross: Antoon, it may also relate to an interpreter versus compiler issue. Something like a compiler for C does not do anything except write code in an assembly language. It can choose to keep going after an error and start looking some more from a less stab

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
such a tool doesn't need to go through all the provided information. If after correcting a few errors, the users find the rest of the information gives him a headache, he can just ignore all that and just run a new iteration. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Antoon Pardon
Op 10/10/2022 om 00:45 schreef Cameron Simpson: On 09Oct2022 21:46, Antoon Pardon wrote: Is it that onerous to fix one thing and run it again? It was once when you handed in punch cards and waited a day or on very busy machines. Yes I find it onerous, especially since I have a pipeline

Re: What to use for finding as many syntax errors as possible.

2022-10-11 Thread Antoon Pardon
Op 10/10/2022 om 19:08 schreef Robert Latest via Python-list: Antoon Pardon wrote: I would like a tool that tries to find as many syntax errors as possible in a python file. I'm puzzled as to when such a tool would be needed. How many syntax errors can you realistically put into a s

Re: for -- else: what was the motivation?

2022-10-11 Thread Antoon Pardon
in python with the same kind of syntax: https://code.activestate.com/recipes/580625-collection-pipeline-in-python/ I have my own python3 module with stuff like that and I find it very usefull. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: flattening lists

2022-10-12 Thread Antoon Pardon
,3],[4,5,6,7],[8,9]] >>> list(itertools.chain.from_iterable(lst)) [1, 2, 3, 4, 5, 6, 7, 8, 9] -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: Find the path of a shell command

2022-10-12 Thread Antoon Pardon
s when evoked directly in a cron script but not via a python script, you may need to export the PATH in your cron script. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: for -- else: what was the motivation?

2022-10-16 Thread Antoon Pardon
nger a strugle searching for a keyword that will break as little programs as possible. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   9   10   >