Re: syntax difference

2018-06-19 Thread Gregory Ewing
Bart wrote: a[1],b[fn()] = b[fn()],a[1] I suppose if you find yourself doing heaps of swaps with complicated indexes it could be useful to have a swap primitive. In my experience it's a pretty rare thing to want to do, though. Also it only covers one special case of all possible permutations.

Re: Writing an assembler in Python

2018-06-19 Thread dieter
iansuder...@gmail.com writes: > What does the code look like to insert assembler into python and how does > that code send information back to python. Python is a "high level" language: it tries hard to hide many "low level" details such as addresses and memory management. Thus, it is quite far

Re: syntax difference

2018-06-19 Thread Chris Angelico
On Wed, Jun 20, 2018 at 11:19 AM, Steven D'Aprano wrote: > On Wed, 20 Jun 2018 07:52:31 +1000, Chris Angelico wrote: > >>> What do you do in python when a local function variable needs to retain >>> its value? I'm sure it can do it, but I bet it's not as simple as how I >>> do it. >>> >> What do y

Re: syntax difference

2018-06-19 Thread Steven D'Aprano
On Tue, 19 Jun 2018 12:13:40 -0700, Jim Lee wrote: > On 06/19/2018 04:13 AM, Ed Kellett wrote: >> I think >> we're all--still--missing the larger point that "easy to remove" is a >> completely stupid metric for judging language features. Seriously. Not >> a little bit stupid. > > Not if you think

Re: syntax difference

2018-06-19 Thread Steven D'Aprano
On Tue, 19 Jun 2018 12:38:24 -0700, Rick Johnson wrote: > Why shouldn't i have the right to "brush type-hints under the rug" Ian? > After all, if the code *I* write doesn't belong to *ME*, well then, who > *HELL* does it belong to? If you don't want to use type-hints in your own code, why did you

Re: curve_fit in scipy

2018-06-19 Thread Sharan Basappa
> > Secondly, I don't understand how curve_fit knows the number of arguments > > that test_func takes. > > Part of the dynamic nature of Python is that a function carries with it > the number of parameters (as just one among many such properties).  We > call it "introspection" when we examine s

Re: Writing an assembler in Python

2018-06-19 Thread Dan Stromberg
On Tue, Jun 19, 2018 at 7:33 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Tue, 19 Jun 2018 17:41:11 -0700, iansuderman wrote: > > > What does the code look like to insert assembler into python and how > > does that code send information back to python. > > > > It seems y

Re: Writing an assembler in Python

2018-06-19 Thread Steven D'Aprano
On Tue, 19 Jun 2018 17:41:11 -0700, iansuderman wrote: > What does the code look like to insert assembler into python and how > does that code send information back to python. > > It seems you wrote that python is a good compiler for assembly. If > possible I want to add assembly to my python.

Re: syntax difference

2018-06-19 Thread Steven D'Aprano
On Wed, 20 Jun 2018 07:52:31 +1000, Chris Angelico wrote: >> What do you do in python when a local function variable needs to retain >> its value? I'm sure it can do it, but I bet it's not as simple as how I >> do it. >> > What do you mean, "retain its value"? Do you mean the way closures work? I

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

2018-06-19 Thread Jach Fong
Terry Reedy at 2018/6/19 PM 08:35 wrote: On 6/18/2018 8:38 PM, sa...@caprilion.com.tw wrote: Grant Edwards at 2018/6/18 PM 10:36 wrote: On 2018-06-17, Jach Fong wrote: The "address" of the Font object 'TkDefaultFont' changes, why? What makes you think it's the same object the second time an

Re: syntax difference

2018-06-19 Thread Steven D'Aprano
On Tue, 19 Jun 2018 14:07:32 -0700, bart4858 wrote: > Do you think that a feature like swap(x,y) literally only works on two > simple variables? I think that if you write "x" and "y", you mean placeholder names that stand in for arbitrary variable names, not expressions. That's the common and u

Re: Writing an assembler in Python

2018-06-19 Thread iansuderman
What does the code look like to insert assembler into python and how does that code send information back to python. It seems you wrote that python is a good compiler for assembly. If possible I want to add assembly to my python. -- https://mail.python.org/mailman/listinfo/python-list

Re: syntax difference

2018-06-19 Thread bart4858
Some of that can be done. It may not need specific support. But my intention is to have an ordinary language for everyday coding not one that can only be understood by CS professors. Mine is unusual in that I can drop features I rarely use, which means that everything in it gets good use. Inclu

Re: syntax difference

2018-06-19 Thread Chris Angelico
On Wed, Jun 20, 2018 at 8:14 AM, wrote: > Features? Important ones? Go back 40 years and see how important they were > then. Most of them,nobody had heard of, and would not be meaningful. > Let's see. Forty years ago was 1978. Databasing was a little bit important. I mean, not much... just that

Re: syntax difference

2018-06-19 Thread bart4858
Features? Important ones? Go back 40 years and see how important they were then. Most of them,nobody had heard of, and would not be meaningful. Now do the same with my list - most are programming features that could be understood and appreciated even then. Finally, imagine going forward 40 year

Re: syntax difference

2018-06-19 Thread Chris Angelico
On Wed, Jun 20, 2018 at 7:41 AM, wrote: > I think you're getting a programming language mixed up with a bunch of random > libraries. > > If you want to do any actual coding rather than scripting, such as > implementing some of that stuff, then this is where those basic language > features that

Re: syntax difference

2018-06-19 Thread bart4858
I think you're getting a programming language mixed up with a bunch of random libraries. If you want to do any actual coding rather than scripting, such as implementing some of that stuff, then this is where those basic language features that are missing from core Python become useful. What do

Re: syntax difference

2018-06-19 Thread Chris Angelico
On Wed, Jun 20, 2018 at 7:07 AM, wrote: > Do you think that a feature like swap(x,y) literally only works on two simple > variables? X and y represent any two lvalue expressions. For example, a[I] > and a[I+1]. Python will evaluate each twice. > > My version sets up two references then exchange

Re: syntax difference

2018-06-19 Thread bart4858
Do you think that a feature like swap(x,y) literally only works on two simple variables? X and y represent any two lvalue expressions. For example, a[I] and a[I+1]. Python will evaluate each twice. My version sets up two references then exchanges what they point to with one bytecode. -- Bart

Re: syntax difference

2018-06-19 Thread Ian Kelly
On Tue, Jun 19, 2018 at 1:42 PM Rick Johnson wrote: > > On Tuesday, June 19, 2018 at 1:02:52 PM UTC-5, Ian wrote: > > On Mon, Jun 18, 2018 at 2:57 PM Rick Johnson > > It's a "burden" (actually, a helpful tool) to the > > programmer either way: whether it's in a comment or an > > annotation, it's t

Re: syntax difference

2018-06-19 Thread Chris Angelico
On Wed, Jun 20, 2018 at 5:38 AM, Rick Johnson wrote: >> You've been answered time and time again -- the devs are >> volunteers and are not beholden to do whatever you want >> just because you don't like it -- yet for some reason you >> keep asking. > > Are you a dev? > > Is Chris a Dev? > > Is Ste

Re: syntax difference

2018-06-19 Thread Rick Johnson
On Tuesday, June 19, 2018 at 1:02:52 PM UTC-5, Ian wrote: > On Mon, Jun 18, 2018 at 2:57 PM Rick Johnson [...] > > The point is, from the POV of the interpreter and the > > programmer. comments are always going to be comments > > regardless of whether special purpose tools parse them or > > not. An

Re: syntax difference

2018-06-19 Thread Jim Lee
On 06/19/2018 04:13 AM, Ed Kellett wrote: I think we're all--still--missing the larger point that "easy to remove" is a completely stupid metric for judging language features. Seriously. Not a little bit stupid. Not if you think of the feature as analogous to cancer. -Jim -- https://mail.py

Re: syntax difference

2018-06-19 Thread Grant Edwards
On 2018-06-19, Steven D'Aprano wrote: > I know that Rick's attitude towards reality is that facts are only for > other people, and that once he has made up his mind nothing will budge > it, *especially* not facts, but for anyone reading this who might be > fooled into imagining that Rick has a

Re: syntax difference

2018-06-19 Thread Mark Lawrence
On 19/06/18 18:10, Ian Kelly wrote: On Tue, Jun 19, 2018 at 3:14 AM Steven D'Aprano wrote: On Mon, 18 Jun 2018 10:01:58 -0700, Rick Johnson wrote: 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

Re: syntax difference

2018-06-19 Thread Ian Kelly
On Mon, Jun 18, 2018 at 2:57 PM 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

Re: syntax difference

2018-06-19 Thread Rick Johnson
On Tuesday, June 19, 2018 at 4:12:10 AM UTC-5, Steven D'Aprano wrote: [...] > People have been requesting static typing in Python virtually since Day > 1, "Day one"??? Really? "People"??? How many people? Contrary to to your fuzzy memories, Steven, we all know that Guido _purposely_ desig

Re: syntax difference

2018-06-19 Thread Ian Kelly
On Tue, Jun 19, 2018 at 3:14 AM Steven D'Aprano wrote: > > On Mon, 18 Jun 2018 10:01:58 -0700, Rick Johnson wrote: > > > 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

Re: syntax difference

2018-06-19 Thread Steven D'Aprano
On Mon, 18 Jun 2018 10:34:54 -0700, Jim Lee wrote: > The syntax should be defined inside comments Then you ought to be pleased that from Python 4.0 (or from Python 3.7 with a ``__future__`` import) annotations will be treated as strings by the interpreter. That makes them effectively special c

Re: [pypy-dev] A quick question for you!

2018-06-19 Thread William ML Leslie
On 18 June 2018 at 22:18, Etienne Robillard wrote: > 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? > gc is enabled by default. you only need to use gc.ena

Re: syntax difference

2018-06-19 Thread Rick Johnson
Rhodri James wrote: [...] > It has little flea executioners running around with little flea axes > chopping off little flea heads? Hmm. And who knew that Python-list was really just a homicidal flea circus. Go figure! -- https://mail.python.org/mailman/listinfo/python-list

Re: syntax difference

2018-06-19 Thread Rick Johnson
On Tuesday, June 19, 2018 at 5:21:25 AM UTC-5, Chris Angelico wrote: > On Tue, Jun 19, 2018 at 8:12 PM, Steven D'Aprano > wrote: > > On Mon, 18 Jun 2018 11:34:40 -0700, Jim Lee wrote: > > > >> On 06/18/2018 11:18 AM, Chris Angelico wrote: > >>> What, fundamentally, is the difference between type h

Re: curve_fit in scipy

2018-06-19 Thread Gary Herron
This is a Python forum, but what you are asking is not a Python question.  You might find a better source of answers on a scipy specific forum. But here's my attempt at answers: On 06/19/2018 08:26 AM, sharan.basa...@gmail.com wrote: Hi All, I am working out an exercise on curve_fit functi

Re: syntax difference

2018-06-19 Thread Steven D'Aprano
On Tue, 19 Jun 2018 11:52:22 +0100, Bart wrote: > On 19/06/2018 11:33, Steven D'Aprano wrote: >> On Tue, 19 Jun 2018 10:19:15 +0100, Bart wrote: >> >>> * Swap(x,y) (evaluate each once unlike a,y=y,x) >> >> Sigh. Really? You think x,y = y,x evaluates x and y twice? > > Yes. Well, you would be w

curve_fit in scipy

2018-06-19 Thread Sharan Basappa
Hi All, I am working out an exercise on curve_fit function available scipy package. While I understand in general about curve_fit, I am unable to understand the following: params, params_covariance = optimize.curve_fit(test_func, x_data, y_data, p0

Re: syntax difference

2018-06-19 Thread Steven D'Aprano
On Tue, 19 Jun 2018 12:13:30 +0100, Ed Kellett wrote: > I think > we're all--still--missing the larger point that "easy to remove" is a > completely stupid metric for judging language features. Seriously. Not a > little bit stupid. +1 -- Steven D'Aprano "Ever since I learned about confirmation

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

2018-06-19 Thread Terry Reedy
On 6/18/2018 8:38 PM, sa...@caprilion.com.tw wrote: 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

Re: syntax difference

2018-06-19 Thread Chris Angelico
On Tue, Jun 19, 2018 at 9:33 PM, Rhodri James wrote: > On 18/06/18 21:39, Chris Angelico wrote: >> >> On Tue, Jun 19, 2018 at 6:25 AM, Rick Johnson >> wrote: >>> >>> Chris Angelico wrote: >>> [...] assert """ , ", ";print('Will I print?');\ "';print("Or will I?");\ ';

Re: syntax difference

2018-06-19 Thread Rhodri James
On 18/06/18 21:39, Chris Angelico wrote: 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?');\ Ch

Re: syntax difference

2018-06-19 Thread Chris Angelico
On Tue, Jun 19, 2018 at 9:07 PM, Bart wrote: > On 19/06/2018 11:45, Chris Angelico wrote: >> >> On Tue, Jun 19, 2018 at 8:33 PM, Steven D'Aprano >> wrote: >>> >>> Yeah, I get it, you like your language to have lots and lots and lots of >>> syntax to do *slightly* different things. But it doesn't

Re: syntax difference

2018-06-19 Thread Ed Kellett
On 2018-06-19 11:21, Chris Angelico wrote: > Isn't it nice how comments, being terminated exclusively by > end-of-line, allow the introduction of subtle bugs? Let's see how many > people spot the (presumably deliberate) bug in Steve's code here. Hardly subtle. It does also make them considerably

Re: syntax difference

2018-06-19 Thread Bart
On 19/06/2018 11:45, Chris Angelico wrote: On Tue, Jun 19, 2018 at 8:33 PM, Steven D'Aprano wrote: Yeah, I get it, you like your language to have lots and lots and lots of syntax to do *slightly* different things. But it doesn't seem to be so good at doing application level functionality. Its b

Re: syntax difference

2018-06-19 Thread Chris Angelico
On Tue, Jun 19, 2018 at 8:52 PM, Bart wrote: > On 19/06/2018 11:33, Steven D'Aprano wrote: >> >> On Tue, 19 Jun 2018 10:19:15 +0100, Bart wrote: >> >>> * Swap(x,y) (evaluate each once unlike a,y=y,x) >> >> >> Sigh. Really? You think x,y = y,x evaluates x and y twice? > > > Yes. Try: > > count=0 >

Re: syntax difference

2018-06-19 Thread Bart
On 19/06/2018 11:33, Steven D'Aprano wrote: On Tue, 19 Jun 2018 10:19:15 +0100, Bart wrote: * Swap(x,y) (evaluate each once unlike a,y=y,x) Sigh. Really? You think x,y = y,x evaluates x and y twice? Yes. Try: count=0 def fn(): global count count=count+1 return 1 a

Python Training in Bangalore

2018-06-19 Thread sandy star
Python Training in Bangalore Best Python Training Courses in Bangalore – Marathahalli, BTM Layout, Rajajinagar & Jaya Nagar. We train the students from basic level to advanced concepts with a real-time environment. We are the Best Python Training Institute in bangalore. URL : https://www.be

Re: syntax difference

2018-06-19 Thread Chris Angelico
On Tue, Jun 19, 2018 at 8:33 PM, Steven D'Aprano wrote: > Yeah, I get it, you like your language to have lots and lots and lots of > syntax to do *slightly* different things. But it doesn't seem to be so > good at doing application level functionality. Its basically just a less > efficient, slight

Re: syntax difference

2018-06-19 Thread Steven D'Aprano
On Tue, 19 Jun 2018 10:19:15 +0100, Bart wrote: > * Swap(x,y) (evaluate each once unlike a,y=y,x) Sigh. Really? You think x,y = y,x evaluates x and y twice? The rest of your list seemed like a very nice list of low-level operations, if you want a low-level language with lots of redundancy and

Re: Speed of animation with matplotlib.animation

2018-06-19 Thread ast
Le 19/06/2018 à 11:47, Peter Otten a écrit : ast wrote: Le 19/06/2018 à 10:57, Peter Otten a écrit : ast wrote: No, with dt = 100 it should last 200 * 100ms = 20.000ms = 20s with dt = 0.1 it should last 200 * 0.1ms = 20ms = 0.02s but your computer is probably not fast enough for that

Re: syntax difference

2018-06-19 Thread Chris Angelico
On Tue, Jun 19, 2018 at 8:12 PM, Steven D'Aprano wrote: > On Mon, 18 Jun 2018 11:34:40 -0700, 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 o

Re: syntax difference

2018-06-19 Thread Steven D'Aprano
On Mon, 18 Jun 2018 11:34:40 -0700, 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.  They

Re: syntax difference

2018-06-19 Thread Chris Angelico
On Tue, Jun 19, 2018 at 7:19 PM, Bart wrote: > My own dynamic language is much smaller than Python, much less dynamic, much > less extendable, and lower level. > > Yet it might have a dozen highly useful features, ones I consider basic, > that are already built-in and Just Work without having to g

Re: Speed of animation with matplotlib.animation

2018-06-19 Thread Peter Otten
ast wrote: > Le 19/06/2018 à 10:57, Peter Otten a écrit : >> ast wrote: >> >>> I noticed that the speed of animations made >>> with module matplotlib.animation always seems >>> wrong. >> >>> dt = 0.1 # 100 ms >> >>> interval : number, optional >>> >>> Delay between frames in millisecon

Re: syntax difference

2018-06-19 Thread Steven D'Aprano
On Mon, 18 Jun 2018 13:52:24 -0700, Rick Johnson wrote: > I have asked time and time again for someone to directly justify why > py-dev won't offer a tool to remove the interleaved type-hint syntax > from scripts. You say that as if the core developers were obligated to cater to your every idle

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

2018-06-19 Thread Jach Fong
Jim Lee at 2018/6/19 PM 03:44 wrote: On 06/18/2018 09:22 PM, Jach Fong wrote: 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 proble

Re: Speed of animation with matplotlib.animation

2018-06-19 Thread Gregory Ewing
Steven D'Aprano wrote: The animation should last 20s, but on my computer it is twice faster Try replacing your CPU with one half as fast. Or push the Turbo button to slow it down to 4.77MHz. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Speed of animation with matplotlib.animation

2018-06-19 Thread ast
Le 19/06/2018 à 10:57, Peter Otten a écrit : ast wrote: I noticed that the speed of animations made with module matplotlib.animation always seems wrong. dt = 0.1 # 100 ms interval : number, optional Delay between frames in milliseconds. Defaults to 200. What's wrong ? From t

Re: syntax difference

2018-06-19 Thread Bart
On 19/06/2018 06:08, 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. Great languages: C and Scheme. And

Re: syntax difference

2018-06-19 Thread Steven D'Aprano
On Mon, 18 Jun 2018 10:01:58 -0700, Rick Johnson wrote: > 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

Re: Speed of animation with matplotlib.animation

2018-06-19 Thread Peter Otten
ast wrote: > I noticed that the speed of animations made > with module matplotlib.animation always seems > wrong. > dt = 0.1 # 100 ms > interval : number, optional > > Delay between frames in milliseconds. Defaults to 200. > > > What's wrong ? >From the above I would conclude that you

Re: syntax difference

2018-06-19 Thread Steven D'Aprano
On Mon, 18 Jun 2018 09:39:21 -0700, Rick Johnson wrote: > 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! That whooshing noise yo

Re: Speed of animation with matplotlib.animation

2018-06-19 Thread Steven D'Aprano
On Tue, 19 Jun 2018 10:34:55 +0200, ast wrote: > The animation should last 20s, but on my computer it is twice faster [...] > What's wrong ? Try replacing your CPU with one half as fast. *wink* (Sorry for the bad advice, I couldn't resist.) -- Steven D'Aprano "Ever since I learned about conf

Speed of animation with matplotlib.animation

2018-06-19 Thread ast
Hello I noticed that the speed of animations made with module matplotlib.animation always seems wrong. Here is a small example for demonstration purpose: import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation fig = plt.figure() ax = fig.add_subplot(111) tx

Re: [pypy-dev] A quick question for you!

2018-06-19 Thread Etienne Robillard
Le 2018-06-18 à 22:47, William ML Leslie a écrit : On 18 June 2018 at 22:18, Etienne Robillard wrote: 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? gc is en

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

2018-06-19 Thread Jim Lee
On 06/18/2018 09:22 PM, Jach Fong wrote: 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