Re: Is it possible to call a class but without a new instance created?

2018-06-18 Thread Jach Fong
Ben Finney at 2018/6/19 PM 10:20 wrote: Jach Fong writes: Although it passed the first examination, I have no idea if it can work correctly in the real application:-) Neither do I. What is the real-world problem you are trying to solve? Why do you think this (and not some more idiomatic Pyth

Re: syntax difference (type hints)

2018-06-18 Thread Gregory Ewing
Steven D'Aprano wrote: Sometimes the type system cannot infer the type of a variable or name, and needs a hint from the author. Or it can infer it, but is unable to produce intelligible error messages without some intermediate signposts to follow. -- Greg -- https://mail.python.org/mailman/lis

Re: syntax difference

2018-06-18 Thread Dan Stromberg
On Mon, Jun 18, 2018 at 10:08 PM, Chris Angelico wrote: > On Tue, Jun 19, 2018 at 1:46 PM, Dan Stromberg > wrote: > > Great languages are small but extensible, easy to read, and don't require > > learning a lot before you can get started writing code or reading someone > > else's code. > > > > G

Re: syntax difference

2018-06-18 Thread Chris Angelico
On Tue, Jun 19, 2018 at 1:46 PM, Dan Stromberg wrote: > Great languages are small but extensible, easy to read, and don't require > learning a lot before you can get started writing code or reading someone > else's code. > > Great languages: C and Scheme. And Python. > > But isn't Lua smaller tha

Re: syntax difference

2018-06-18 Thread Dan Stromberg
On Mon, Jun 18, 2018 at 5:52 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Mon, 18 Jun 2018 21:03:14 +0100, Bart wrote: > > > In the case of Python, it is > > already so big and has so many features crammed in that adding type > > hints probably makes little difference. >

Re: syntax difference (type hints)

2018-06-18 Thread Dan Stromberg
On Mon, Jun 18, 2018 at 5:45 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Mon, 18 Jun 2018 14:57:30 +, Schachner, Joseph wrote: > > I believe the proposed type hints are only necessary > > for function definitions, > > What is the basis of this belief? How much exper

Re: Is it possible to call a class but without a new instance created?

2018-06-18 Thread Ben Finney
Jach Fong writes: > Although it passed the first examination, I have no idea if it can > work correctly in the real application:-) Neither do I. What is the real-world problem you are trying to solve? Why do you think this (and not some more idiomatic Python feature) is needed for solving that p

Re: Is it possible to call a class but without a new instance created?

2018-06-18 Thread Jach Fong
Ben Finney at 2018/6/18 PM 03:29 wrote: Jach Fong writes: I also make a test of my own and it fails too. class A: ... objs = [] ... def __init__(self, exists=False): ... if exists: self = self.objs[0] The function parameters (bound here to the names ‘self’, ‘exists’)

Re: Folk etymology, was Re: Python list vs google group

2018-06-18 Thread Gene Heskett
On Monday 18 June 2018 19:24:14 Jim Lee wrote: > On 06/18/2018 04:09 PM, Gregory Ewing wrote: > > Peter Otten wrote: > >> "folk etymology" would be the retrofitting of the exotic "Schottky" > >> into two familiar words "shot" and "key". Sometimes the writer > >> assumes that these words are someho

Re: Is it possible to call a class but without a new instance created?

2018-06-18 Thread Jach Fong
It seems most of confusion comes from mixing up python object and tk widgets, and ignored that the tkinter is really a python-tk-interface. Thank you for pointing it out. Terry Reedy at 2018/6/18 PM 05:19 wrote: To answer the question of the title, which is a bit different from the question in

Re: syntax difference

2018-06-18 Thread Steven D'Aprano
On Mon, 18 Jun 2018 21:03:14 +0100, Bart wrote: > In the case of Python, it is > already so big and has so many features crammed in that adding type > hints probably makes little difference. You've never used C++ have you? Describing Python as a "big" language is ludicrous. -- Steven D'Apran

Re: syntax difference

2018-06-18 Thread Steven D'Aprano
On Mon, 18 Jun 2018 08:10:12 -0700, Rick Johnson wrote: > "Type-hint comments" don't exist yet. Yes they do, and they have existed for years. https://www.python.org/dev/peps/pep-0526/ But don't let a little thing like the fact you have no clue whatsoever about this stop you from pontificatin

Re: syntax difference (type hints)

2018-06-18 Thread Steven D'Aprano
On Mon, 18 Jun 2018 14:57:30 +, Schachner, Joseph wrote: > Assuming that we want Python to remain a dynamically typed (but strongly > typed) language, There is no question about that. > I believe the proposed type hints are only necessary > for function definitions, What is the basis of t

Re: Why an object changes its "address" between adjacent calls?

2018-06-18 Thread sa...@caprilion.com.tw
Grant Edwards at 2018/6/18 PM 10:36 wrote: On 2018-06-17, Jach Fong wrote: C:\Python34\Doc>py Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. import tkinter as tk root = tk.Tk(

Re: Folk etymology, was Re: Python list vs google group

2018-06-18 Thread Jim Lee
On 06/18/2018 04:09 PM, Gregory Ewing wrote: Peter Otten wrote: "folk etymology" would be the retrofitting of the exotic "Schottky" into two familiar words "shot" and "key". Sometimes the writer assumes that these words are somehow related to the labeled object. Well, there is a thing call

Re: Folk etymology, was Re: Python list vs google group

2018-06-18 Thread Gregory Ewing
Peter Otten wrote: "folk etymology" would be the retrofitting of the exotic "Schottky" into two familiar words "shot" and "key". Sometimes the writer assumes that these words are somehow related to the labeled object. Well, there is a thing called "shot noise", and you can probaby get it from

Re: Python list vs google group

2018-06-18 Thread Gene Heskett
On Monday 18 June 2018 11:45:45 Joe Pfeiffer wrote: > Peter Otten <__pete...@web.de> writes: > > Gene Heskett wrote: > >> This biggest single thing wrong with any of those old scsi > >> interfaces is the bus's 5 volt isolation diode, the designer speced > >> a shotkey(sp) diode, and some damned be

Re: Folk etymology, was Re: Python list vs google group

2018-06-18 Thread Joe Pfeiffer
Peter Otten <__pete...@web.de> writes: > Grant Edwards wrote: > >> On 2018-06-18, Joe Pfeiffer wrote: >>> Peter Otten <__pete...@web.de> writes: >>> Gene Heskett wrote: > This biggest single thing wrong with any of those old scsi interfaces > is the bus's 5 volt isolation diode,

Re: syntax difference

2018-06-18 Thread Jim Lee
On 06/18/2018 02:36 PM, Schachner, Joseph wrote: Now that you know that 1) You are not required to modify your source code at all, even if you want to get full utility from typing, and 2) you really don't have use typing at all, nothing forces you to, and 3) it's been developed by the Pytho

RE: syntax difference

2018-06-18 Thread Schachner, Joseph
On YouTube you can watch videos of Guido van Rossum presenting at PyCon from a few years ago, in which he makes clear that he has been thinking about this since 2000, that he wants someone else to guide this PEP along its path because he is too close to it, and that NOTHING about having a typing

Re: syntax difference

2018-06-18 Thread Chris Angelico
On Tue, Jun 19, 2018 at 6:52 AM, Rick Johnson wrote: > On Monday, June 18, 2018 at 2:48:58 PM UTC-5, Ian wrote: >> I would also note that none of this applies to type hinting >> in any case. Type hints don't require the programmer to be >> able to explain anything in natural language, nor are they

Re: syntax difference

2018-06-18 Thread Rick Johnson
On Monday, June 18, 2018 at 2:48:58 PM UTC-5, Ian wrote: > I would also note that none of this applies to type hinting > in any case. Type hints don't require the programmer to be > able to explain anything in natural language, nor are they > prone to becoming out-of-sync. > > Because if they do, t

Re: syntax difference

2018-06-18 Thread Jim Lee
On 06/18/2018 12:52 PM, Rhodri James wrote: On 18/06/18 19:34, Jim Lee wrote: Type hints are just that - hints.  They have no syntactic meaning to the parser, This is plainly not true, otherwise the parser would be throwing syntax errors at you all the time.  Whether they have semantic mean

Re: syntax difference

2018-06-18 Thread Chris Angelico
On Tue, Jun 19, 2018 at 6:25 AM, Rick Johnson wrote: > Chris Angelico wrote: > [...] >> assert """ >> , ", ";print('Will I print?');\ >> "';print("Or will I?");\ >> ';print("What about me?");'''\ >> print("And me? Where endeth");"""\ >> print('the assertion?');\ > > Chris, that's not code.

Re: syntax difference

2018-06-18 Thread Rick Johnson
Chris Angelico wrote: [...] > assert """ > , ", ";print('Will I print?');\ > "';print("Or will I?");\ > ';print("What about me?");'''\ > print("And me? Where endeth");"""\ > print('the assertion?');\ Chris, that's not code... That's a syntactical representation of some random flea circus.

Re: syntax difference

2018-06-18 Thread Chris Angelico
On Tue, Jun 19, 2018 at 6:03 AM, Bart wrote: > In the end I got rid of them to keep the language purer, smaller and > simpler. Other approaches which don't involve annotating source code (eg. > type inference) are better IMO. Inference is great when it works. How do you assist a type inference en

Re: syntax difference

2018-06-18 Thread Bart
On 18/06/2018 15:03, Steven D'Aprano wrote: It is 2018. People who say that static typing cannot be integrated with dynamic languages are nearly half a century behind the state of the art in computer programming. It can be, but it spoils the language. In the case of Python, it is already so b

Re: syntax difference

2018-06-18 Thread Rhodri James
On 18/06/18 19:34, Jim Lee wrote: Type hints are just that - hints.  They have no syntactic meaning to the parser, This is plainly not true, otherwise the parser would be throwing syntax errors at you all the time. Whether they have semantic meaning to the parser is more debatable. -- Rhod

Re: syntax difference

2018-06-18 Thread Rhodri James
On 18/06/18 19:21, Jim Lee wrote: Thanks for the explanation, but it only reinforces my view.  The more entrenched this feature becomes, the more we will see annotation-based tools and, at some point, we will all be forced to used annotations in order to take advantage of the tools. So don't

Re: syntax difference

2018-06-18 Thread Ian Kelly
On Mon, Jun 18, 2018 at 10:19 AM Rick Johnson wrote: > And even from the POV of a programmer, comments can be more > useful if they are ignored than if they are not. Some > programmers lack the skill required to properly explain the > workings of an algorithm in natural language, and thus, the > r

Re: syntax difference

2018-06-18 Thread Chris Angelico
On Tue, Jun 19, 2018 at 5:26 AM, Rick Johnson wrote: > On Monday, June 18, 2018 at 12:46:36 PM UTC-5, Chris Angelico wrote: > >> What about assertions? Are they comments too? Should we >> have, for instance: >> >> if x > 0: >> ... >> elif x < 0: >> ... >> else: >> #assert: x == 0 >>

Re: syntax difference

2018-06-18 Thread Rick Johnson
On Monday, June 18, 2018 at 1:50:09 PM UTC-5, Chris Angelico wrote: [...] > I don't know what you mean by "syntactic meaning". Do you mean that > they create no executable bytecode, that they have no run-time > influence? Because that's not entirely true; they are stored, and can > be viewed at run

Re: syntax difference

2018-06-18 Thread Rick Johnson
On Monday, June 18, 2018 at 1:02:18 PM UTC-5, Ian wrote: [...] > When PEP 3107 was written, it was anticipated that > annotations would find more uses than just type hinting. > Some of those proposed ideas (e.g. database query mapping) > depend on the annotation being readable at run-time, for > wh

Re: syntax difference

2018-06-18 Thread Rick Johnson
On Monday, June 18, 2018 at 12:46:36 PM UTC-5, Chris Angelico wrote: > What about assertions? Are they comments too? Should we > have, for instance: > > if x > 0: > ... > elif x < 0: > ... > else: > #assert: x == 0 > ... > > or is it better to use an 'assert' statement? After all

Re: syntax difference

2018-06-18 Thread Ian Kelly
On Mon, Jun 18, 2018 at 11:27 AM Rick Johnson wrote: > > Ian wrote: > > > Uh, yes, they do. They're defined in PEP 484, and Mypy uses them for > > type-checking Python 2 code, where the annotations don't exist. > > So when will the interleaved type-hints be removed from the language > specificati

Re: syntax difference

2018-06-18 Thread Jim Lee
On 06/18/2018 11:49 AM, Chris Angelico wrote: On Tue, Jun 19, 2018 at 4:34 AM, Jim Lee wrote: On 06/18/2018 11:18 AM, Chris Angelico wrote: What, fundamentally, is the difference between type hints and assertions, such that - in your view - one gets syntax and the other is just comments?

Re: syntax difference

2018-06-18 Thread Chris Angelico
On Tue, Jun 19, 2018 at 4:34 AM, Jim Lee wrote: > > > On 06/18/2018 11:18 AM, Chris Angelico wrote: >> >> What, fundamentally, is the difference between type hints and assertions, >> such that - in >> your view - one gets syntax and the other is just comments? > > Type hints are just that - hints.

Re: syntax difference

2018-06-18 Thread Jim Lee
On 06/18/2018 11:18 AM, Chris Angelico wrote: What, fundamentally, is the difference between type hints and assertions, such that - in your view - one gets syntax and the other is just comments? Type hints are just that - hints.  They have no syntactic meaning to the parser, and do not affect

Re: syntax difference

2018-06-18 Thread Jim Lee
On 06/18/2018 11:01 AM, Ian Kelly wrote: On Mon, Jun 18, 2018 at 11:39 AM Jim Lee wrote: On 06/18/2018 07:03 AM, Steven D'Aprano wrote: As a human programmer, you surely perform your own ad hoc type checking when you write and debug code. Of course. And, I use linting tools and other forms

Re: syntax difference

2018-06-18 Thread Chris Angelico
On Tue, Jun 19, 2018 at 4:09 AM, Jim Lee wrote: > > > On 06/18/2018 10:46 AM, Chris Angelico wrote: >> >> On Tue, Jun 19, 2018 at 3:34 AM, Jim Lee wrote: >>> >>> >>> On 06/18/2018 07:03 AM, Steven D'Aprano wrote: As a human programmer, you surely perform your own ad hoc type checking >>

Re: syntax difference

2018-06-18 Thread Jim Lee
On 06/18/2018 10:46 AM, Chris Angelico wrote: On Tue, Jun 19, 2018 at 3:34 AM, Jim Lee wrote: On 06/18/2018 07:03 AM, Steven D'Aprano wrote: As a human programmer, you surely perform your own ad hoc type checking when you write and debug code. Of course. And, I use linting tools and other

Re: syntax difference

2018-06-18 Thread Ian Kelly
On Mon, Jun 18, 2018 at 11:39 AM Jim Lee wrote: > On 06/18/2018 07:03 AM, Steven D'Aprano wrote: > > As a human programmer, you surely perform your own ad hoc type checking > > when you write and debug code. > Of course. And, I use linting tools and other forms of static type > checking. What I

Re: syntax difference

2018-06-18 Thread Chris Angelico
On Tue, Jun 19, 2018 at 3:34 AM, Jim Lee wrote: > > > On 06/18/2018 07:03 AM, Steven D'Aprano wrote: >> >> As a human programmer, you surely perform your own ad hoc type checking >> when you write and debug code. > > Of course. And, I use linting tools and other forms of static type > checking.

Re: syntax difference

2018-06-18 Thread Jim Lee
On 06/18/2018 07:03 AM, Steven D'Aprano wrote: As a human programmer, you surely perform your own ad hoc type checking when you write and debug code. Of course.  And, I use linting tools and other forms of static type checking.  What I don't like is adding the *syntax* for static type checkin

Re: syntax difference

2018-06-18 Thread Rick Johnson
Ian wrote: > Uh, yes, they do. They're defined in PEP 484, and Mypy uses them for > type-checking Python 2 code, where the annotations don't exist. So when will the interleaved type-hints be removed from the language specification? -- https://mail.python.org/mailman/listinfo/python-list

Re: syntax difference

2018-06-18 Thread Rick Johnson
Steven D'Aprano wrote: > Moving the type-checking out of the core language into the > IDE or linter which can be used or not used according to > the desire of the programmer Except, what your poppycock commentary seems to glaze over is the fact that whilst a programmer can certainly decided to "us

Re: syntax difference

2018-06-18 Thread Rick Johnson
Steven D'Aprano said: > Python is not only alive and well, but actually growing in > popularity according to (as far as I can see) all the well- > known measures of language popularity. Steven *ALSO* said: > "Ever since I learned about confirmation bias, I've been > seeing it everywhere." Hmm? --

Re: syntax difference

2018-06-18 Thread Ed Kellett
are you someone's ironic 3rd-year art project signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: syntax difference

2018-06-18 Thread Rick Johnson
Steven D'Aprano wrote: [...] > particular at DropBox, which is (I believe) funding a lot of Guido's time > on this, because they need it. And now we get to the truth! Guido's new puppet master is the sole reason why this fine community -- of once free-roaming *STALLIONS*-- is now corralled an

Re: syntax difference

2018-06-18 Thread Rick Johnson
Bart wrote: [...] > For example, comments that start with #T# (and in my case, > that begin at the start of a line). Such would be a _breeze_ to parse out. And i would argue (given a sufficiently unique tag) that arbitrary white space would not be any more error prone, either. Thus, your "tagged c

Folk etymology, was Re: Python list vs google group

2018-06-18 Thread Peter Otten
Grant Edwards wrote: > On 2018-06-18, Joe Pfeiffer wrote: >> Peter Otten <__pete...@web.de> writes: >> >>> Gene Heskett wrote: >>> This biggest single thing wrong with any of those old scsi interfaces is the bus's 5 volt isolation diode, the designer speced a shotkey(sp) diode, and

Re: syntax difference

2018-06-18 Thread Rick Johnson
On Monday, June 18, 2018 at 6:43:36 AM UTC-5, Steven D'Aprano wrote: > The programmer can ignore [type-hints], just as they can > ignore any other form of documentation. Type-hints, as implemented, break all the rules of conventional documentation. In any programming language i have ever seen, for

Re: syntax difference

2018-06-18 Thread Rick Johnson
On Monday, June 18, 2018 at 6:57:27 AM UTC-5, Steven D'Aprano wrote: > I still think that Python has been going nowhere but downhill ever since > extended slicing was added in version 1.4. Apples to oranges! -- https://mail.python.org/mailman/listinfo/python-list

Re: syntax difference

2018-06-18 Thread Ben Bacarisse
Bart writes: > On 18/06/2018 11:45, Chris Angelico wrote: >> On Mon, Jun 18, 2018 at 8:33 PM, Bart wrote: > > >>> You're right in that neither task is that trivial. >>> >>> I can remove comments by writing a tokeniser which scans Python source and >>> re-outputs tokens one at a time. Such a toke

Re: syntax difference

2018-06-18 Thread Rick Johnson
Chris Angelico wrote: > Bart wrote: [...] > > What will those look like? If copyright/license comments > > have their own specific syntax, then they just become > > another token which has to be recognized. > > If they have specific syntax, they're not comments, are they? Yes, they are. >From the

Re: Python list vs google group

2018-06-18 Thread Grant Edwards
On 2018-06-18, Joe Pfeiffer wrote: > Peter Otten <__pete...@web.de> writes: > >> Gene Heskett wrote: >> >>> This biggest single thing wrong with any of those old scsi interfaces is >>> the bus's 5 volt isolation diode, the designer speced a shotkey(sp) >>> diode, and some damned bean counter saw t

Re: syntax difference (type hints)

2018-06-18 Thread Chris Angelico
On Tue, Jun 19, 2018 at 12:57 AM, Schachner, Joseph wrote: > Assuming that we want Python to remain a dynamically typed (but strongly > typed) language, I believe the proposed type hints are only necessary for > function definitions, where the caller really needs to know the types of > argument

Re: Python list vs google group

2018-06-18 Thread Joe Pfeiffer
Peter Otten <__pete...@web.de> writes: > Gene Heskett wrote: > >> This biggest single thing wrong with any of those old scsi interfaces is >> the bus's 5 volt isolation diode, the designer speced a shotkey(sp) >> diode, and some damned bean counter saw the price diff and changed it to > > Is this

Re: syntax difference

2018-06-18 Thread Rick Johnson
On Monday, June 18, 2018 at 5:45:28 AM UTC-5, Chris Angelico wrote: > So in both cases, you would probably end up with something > like 2to3. And there you have it! Just Like Python3000, the python devs have caused a major disruption by saddling us with the syntactic noise of type- hints. There

Re: syntax difference (type hints)

2018-06-18 Thread Ian Kelly
FYI, Python type hints aren't "proposed"; they're already here. The function annotation syntax was added in 3.0, without any imposition of semantic meaning or requirements on it, and allowed to simmer for several years for third-party frameworks to find uses for. Python 3.5 added the typing module

Re: syntax difference

2018-06-18 Thread Ian Kelly
On Mon, Jun 18, 2018 at 9:17 AM Rick Johnson wrote: > > Chris Angelico wrote: > [...] > > What was the quote before that? > > > > > "Type-hint comments" would allow: > > > (3) and those who utterly *HATE* them, to write a simpl[e] > > > little function which will strip them from any and all >

RE: syntax difference (type hints)

2018-06-18 Thread Dan Strohl via Python-list
> -Original Message- > From: Python-list On > Behalf Of Schachner, Joseph > Sent: Monday, June 18, 2018 7:58 AM > To: Ed Kellett ; python-list@python.org > Subject: RE: syntax difference (type hints) > > EXTERNAL MAIL: python-list-bounces+d.strohl=f5@python.org > > Assuming that we

Re: syntax difference

2018-06-18 Thread Rick Johnson
Jim Lee wrote: > Chris wrote: > > > > I said that you can't decry changes that were before > > your time (they're simply the way things are). > > Really? Wow. I'd hate to live in your world! Just > because something exists, it can't be challenged or > questioned. Got it! Chris is a good choi

Re: syntax difference

2018-06-18 Thread Rick Johnson
Chris Angelico wrote: [...] > What was the quote before that? > > > "Type-hint comments" would allow: > > (3) and those who utterly *HATE* them, to write a simpl[e] > > little function which will strip them from any and all > > source code they might be forced to maintain. > > Put up or s

RE: syntax difference (type hints)

2018-06-18 Thread Schachner, Joseph
Assuming that we want Python to remain a dynamically typed (but strongly typed) language, I believe the proposed type hints are only necessary for function definitions, where the caller really needs to know the types of arguments to pass in. At the moment that purpose is (I think adequately) s

RE: syntax difference

2018-06-18 Thread Schachner, Joseph
As soon as I sent the previous message I realized it's "doc string" not def string. Pardon me. --- Joe S. -Original Message- From: Ed Kellett Sent: Monday, June 18, 2018 8:47 AM To: python-list@python.org Subject: Re: syntax difference On 2018-06-18 13:18, Chris Angelico wrote: > 1)

Re: Why an object changes its "address" between adjacent calls?

2018-06-18 Thread Grant Edwards
On 2018-06-17, Jach Fong wrote: > C:\Python34\Doc>py > Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 > bit (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import tkinter as tk > >>> root = tk.Tk() > >>> tk.Label(root, tex

Re: syntax difference

2018-06-18 Thread Steven D'Aprano
Further to my earlier comments... On Sun, 17 Jun 2018 12:07:14 -0700, Jim Lee wrote: > IMHO, trying to shoehorn static type checking on top of a dynamically > typed language shows that the wrong language was chosen for the job. Relevant: http://lambda-the-ultimate.org/node/1519 and this quote

Re: Technical altitude, was Re: Python list vs google group

2018-06-18 Thread Steven D'Aprano
On Mon, 18 Jun 2018 15:59:58 +0200, Peter Otten wrote: > Other than that I find it hard to believe that a "bean counter" can > change a technical spec. He may put pressure on the designer, but when > the designer gives in he's still responsible for the resulting technical > problems. Surely it de

Re: syntax difference

2018-06-18 Thread Steven D'Aprano
On Mon, 18 Jun 2018 15:11:05 +0300, Marko Rauhamaa wrote: [...] > So the point *was* popularity!? I suspected as much. Presumably you missed the invisible sarcasm tags. As well as the point that despite all the "type annotation is killing Python" FUD from certain corners of the Python community

Re: syntax difference

2018-06-18 Thread Gregory Ewing
Bart wrote: I can remove comments by writing a tokeniser which scans Python source and re-outputs tokens one at a time. Such a tokeniser normally ignores comments. What was being talked about wasn't removing *all* comments, but removing just the ones that contain type hints. But to remove typ

Re: syntax difference

2018-06-18 Thread Steven D'Aprano
On Sun, 17 Jun 2018 12:07:14 -0700, Jim Lee wrote: > IMHO, trying to shoehorn static type checking on top of a dynamically > typed language shows that the wrong language was chosen for the job. The experience of computer languages like Lisp, Smalltalk/StrongTalk, Erlang, Racket, Javascript vari

Technical altitude, was Re: Python list vs google group

2018-06-18 Thread Peter Otten
Gene Heskett wrote: > On Monday 18 June 2018 09:16:10 Peter Otten wrote: > >> Gene Heskett wrote: >> > This biggest single thing wrong with any of those old scsi >> > interfaces is the bus's 5 volt isolation diode, the designer speced >> > a shotkey(sp) diode, and some damned bean counter saw the

Re: Python list vs google group

2018-06-18 Thread Gene Heskett
On Monday 18 June 2018 09:16:10 Peter Otten wrote: > Gene Heskett wrote: > > This biggest single thing wrong with any of those old scsi > > interfaces is the bus's 5 volt isolation diode, the designer speced > > a shotkey(sp) diode, and some damned bean counter saw the price diff > > and changed i

A quick question for you!

2018-06-18 Thread Etienne Robillard
Hi, Quick question: Does anyone of you know what is the effect of enabling gc.enable() in sitecustomize.py when using PyPy? Can it reduce latency for long-lived WSGI applications? Thanks, Etienne -- Etienne Robillard tkad...@yandex.com https://www.isotopesoftware.ca/ -- https://mail.pytho

Re: syntax difference

2018-06-18 Thread Chris Angelico
On Mon, Jun 18, 2018 at 10:07 PM, Bart wrote: > On 18/06/2018 12:33, Chris Angelico wrote: >> >> On Mon, Jun 18, 2018 at 9:16 PM, Bart wrote: > > >>> What will those look like? If copyright/licence comments have their own >>> specific syntax, then they just become another token which has to be >>

Re: Python list vs google group

2018-06-18 Thread Peter Otten
Gene Heskett wrote: > This biggest single thing wrong with any of those old scsi interfaces is > the bus's 5 volt isolation diode, the designer speced a shotkey(sp) > diode, and some damned bean counter saw the price diff and changed it to Is this a case of

Re: Is it possible to call a class but without a new instance created?

2018-06-18 Thread Chris Angelico
On Mon, Jun 18, 2018 at 5:17 PM, Vincent Vande Vyvre wrote: > What you try to do is called a /singleton./ In this case, not necessarily a singleton, but returning a cached object that's the same for any given argument. Basically, interned objects. But yes, the same idea. ChrisA -- https://mail.

Re: Is it possible to call a class but without a new instance created?

2018-06-18 Thread Vincent Vande Vyvre
Le 18/06/18 à 06:48, Jach Fong a écrit : After looking into the \tkiniter\font.py source file, triggered by Jim's hint on my previous subject "Why an object changes its "address" between adjacent calls?", I get more confused. Below was quoted from the font.py: def nameto

Re: Understanding memory location of Python variables

2018-06-18 Thread Jeremy Black
Also, I don't think you can rely on memory being allocated sequentially any more now that everyone has implemented some level of ASLR. https://en.wikipedia.org/wiki/Address_space_layout_randomization On Sat, Jun 16, 2018 at 12:22 PM Alister via Python-list < python-list@python.org> wrote: > On S

Re: syntax difference

2018-06-18 Thread Ed Kellett
On 2018-06-18 13:18, Chris Angelico wrote: > 1) Parse the code, keeping all the non-essential parts as well as the > essential parts. > 2) Find the comments, or find the annotations > 3) If comments, figure out if they're the ones you want to remove. > 4) Reconstruct the file without the bits you w

Re: Python list vs google group

2018-06-18 Thread Alister via Python-list
On Fri, 15 Jun 2018 09:32:05 -0700, T Berger wrote: > On Friday, June 15, 2018 at 11:55:59 AM UTC-4, Chris Angelico wrote: >> Perhaps quantity is not the important thing here. > > It is the important thing. I'm stuck with a problem and still waiting > for replies to my email. I've decided to repo

Re: syntax difference

2018-06-18 Thread Marko Rauhamaa
Jim Lee : > Really?  Wow.  I'd hate to live in your world!  Just because something > exists, it can't be challenged or questioned.  Got it! No need to get overly agitated just because someone says something preposterous. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Understanding memory location of Python variables

2018-06-18 Thread Daniel Montecillo
I am also wondering about this behavior. Thank you Chris A for providing the explanation. On Jun 16, 2018, at 5:45 PM, Chris Angelico mailto:ros...@gmail.com>> wrote: On Sun, Jun 17, 2018 at 2:38 AM, mailto:ip.b...@gmail.com>> wrote: Hi everyone, I'm intrigued by the output of the following

Re: Python list vs google group

2018-06-18 Thread Gene Heskett
On Friday 15 June 2018 23:52:12 Gregory Ewing wrote: > Jim Lee wrote: > > It was so long ago that I forgot some of the > > details, but it boiled down to the TWAIN driver pushing the SCSI bus > > out of spec. > > Clearly you didn't sacrifice enough goats! > > https://odetocode.com/blogs/scott/arch

Re: Flask failure

2018-06-18 Thread T Berger
On Friday, June 15, 2018 at 1:48:16 PM UTC-4, Elismar Luz wrote: > Address already in use! Hi Elismar, I'm new to Python and didn't understand your post when I first read it. Thanks, Tamara -- https://mail.python.org/mailman/listinfo/python-list

Re: syntax difference

2018-06-18 Thread Marko Rauhamaa
Chris Angelico : > On Mon, Jun 18, 2018 at 9:50 PM, Steven D'Aprano > wrote: >> On Mon, 18 Jun 2018 06:35:40 +1000, Chris Angelico wrote: >> >>> On Mon, Jun 18, 2018 at 6:23 AM, Marko Rauhamaa >>> wrote: I'm also saddened by the type hinting initiative. When you try to be best for ever

Re: syntax difference

2018-06-18 Thread Bart
On 18/06/2018 12:33, Chris Angelico wrote: On Mon, Jun 18, 2018 at 9:16 PM, Bart wrote: What will those look like? If copyright/licence comments have their own specific syntax, then they just become another token which has to be recognised. If they have specific syntax, they're not comments

Re: syntax difference

2018-06-18 Thread Steven D'Aprano
On Sun, 17 Jun 2018 16:46:05 -0700, Rick Johnson wrote: > People like myself will outright refuse to maintain your code. Whew Dan, you dodged a bullet there. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.pyth

Re: syntax difference

2018-06-18 Thread Chris Angelico
On Mon, Jun 18, 2018 at 9:50 PM, Steven D'Aprano wrote: > On Mon, 18 Jun 2018 06:35:40 +1000, Chris Angelico wrote: > >> On Mon, Jun 18, 2018 at 6:23 AM, Marko Rauhamaa >> wrote: >>> Jim Lee : IMHO, trying to shoehorn static type checking on top of a dynamically typed language shows tha

Re: syntax difference

2018-06-18 Thread Steven D'Aprano
On Mon, 18 Jun 2018 06:56:56 +1000, Chris Angelico wrote: > You talk about "risk it all by trying to take the whole cake" as if > annotations are a change. But if they were already around before you > first met the language, then they're just part of the language. You > might as well argue against

Re: syntax difference

2018-06-18 Thread Steven D'Aprano
On Mon, 18 Jun 2018 06:35:40 +1000, Chris Angelico wrote: > On Mon, Jun 18, 2018 at 6:23 AM, Marko Rauhamaa > wrote: >> Jim Lee : >>> IMHO, trying to shoehorn static type checking on top of a dynamically >>> typed language shows that the wrong language was chosen for the job. >> >> I'm also sadde

Re: syntax difference

2018-06-18 Thread Steven D'Aprano
On Sun, 17 Jun 2018 11:10:55 -0700, Rick Johnson wrote: > Steven D'Aprano wrote: >> Bart Wrote: >> > So what's a Type Hint associated with in Python? >> Since it is a type *hint*, not a type *declaration*, the interpreter >> can and does ignore it. > > But yet, the _programmer_ cannot ignore it.

Re: syntax difference

2018-06-18 Thread Chris Angelico
On Mon, Jun 18, 2018 at 9:16 PM, Bart wrote: > On 18/06/2018 11:45, Chris Angelico wrote: >> >> On Mon, Jun 18, 2018 at 8:33 PM, Bart wrote: > > > >>> You're right in that neither task is that trivial. >>> >>> I can remove comments by writing a tokeniser which scans Python source >>> and >>> re-o

Re: syntax difference

2018-06-18 Thread Bart
On 18/06/2018 11:45, Chris Angelico wrote: On Mon, Jun 18, 2018 at 8:33 PM, Bart wrote: You're right in that neither task is that trivial. I can remove comments by writing a tokeniser which scans Python source and re-outputs tokens one at a time. Such a tokeniser normally ignores comments.

ANN: Version 0.1.5 of sarge (a subprocess wrapper library) has been released.

2018-06-18 Thread Vinay Sajip via Python-list
Version 0.1.5 of Sarge, a cross-platform library which wraps the subprocessmodule in the standard library, has been released. What changed?- - Fixed #37: Instead of an OSError with a "no such file or directory" message,  a ValueError is raised with a more informative "Command not foun

Re: Metasyntactic thingies

2018-06-18 Thread Rhodri James
On 17/06/18 10:09, Steven D'Aprano wrote: But what placeholder names do you use for functions, methods or other actions? As in, placeholder verbs rather than nouns? Aside from such boring ones as "do_work" and similar, the only placeholder verb I can think of is frobnicate. Does anyone else hav

Re: syntax difference

2018-06-18 Thread Chris Angelico
On Mon, Jun 18, 2018 at 8:33 PM, Bart wrote: > On 18/06/2018 01:10, Chris Angelico wrote: >> >> On Mon, Jun 18, 2018 at 9:30 AM, Rick Johnson >> wrote: >>> >>> On Sunday, June 17, 2018 at 2:07:40 PM UTC-5, Jim Lee wrote: >>> IMHO, trying to shoehorn static type checking on top of a dynamical

Re: syntax difference

2018-06-18 Thread Bart
On 18/06/2018 01:10, Chris Angelico wrote: On Mon, Jun 18, 2018 at 9:30 AM, Rick Johnson wrote: On Sunday, June 17, 2018 at 2:07:40 PM UTC-5, Jim Lee wrote: IMHO, trying to shoehorn static type checking on top of a dynamically typed language shows that the wrong language was chosen for the jo

Re: Is it possible to call a class but without a new instance created?

2018-06-18 Thread Terry Reedy
To answer the question of the title, which is a bit different from the question in the text, yes. type(None)() always returns the singleton None object. (And one can write a singleton class in Python also.) bool() always returns one of False or True. int() and str() may return either a new o

  1   2   >