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

2017-09-24 Thread Gregory Ewing
Steve D'Aprano wrote: I think that suffers from the same problem as "call by binding" -- assignment is too general a word. If you're learning a new language, you're almost certainly going to learn how assignment works in that language before you get as far as worrying about parameter passing. I

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

2017-09-24 Thread Gregory Ewing
Dennis Lee Bieber wrote: Though "assignment" differs so much between languages That's the point of the term -- it's the same as whatever assignment does in the language concerned. This is true of *every* language I know of that uses the term "call by value" in its official documentatio

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

2017-09-24 Thread Michael Torrie
On 09/24/2017 09:56 AM, Dennis Lee Bieber wrote: > "Binding" itself tends to be Python specific terminology Not so. How it's used in Python terminology is fairly closely aligned with how the word was used in my programming language theory class at uni, where it was defined in mathematical t

Re: _sitebuiltins?

2017-09-24 Thread Chris Angelico
On Mon, Sep 25, 2017 at 11:39 AM, Stefan Ram wrote: > Chris Angelico writes: >>But if anything got imported from somewhere else, you get the >>_original_ source, not the one you got it from: > from ssl import namedtuple > namedtuple.__module__ >>'collections' >>Is that good enough for wha

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

2017-09-24 Thread Steve D'Aprano
On Mon, 25 Sep 2017 08:39 am, Gregory Ewing wrote: > Dennis Lee Bieber wrote: >> "Binding" itself tends to be Python specific terminology -- in that it "Binding" is certainly not Python-specific: https://en.wikipedia.org/wiki/Name_binding and here's an example of the term in use: https://www.g

Re: [Tutor] beginning to code

2017-09-24 Thread Steve D'Aprano
On Sun, 24 Sep 2017 12:37 pm, Bill wrote: >> For example, if I made "Pass-By-Reference Python" where all argument passing >> was done by reference, my language would differ from real Python: >> >> >> function(x, y) # allowed >> function(namespace.x, module.y) # allowed >> function(x + 1, 2) # F

Re: Project Euler 20.

2017-09-24 Thread Paul Rubin
Ian Kelly writes: sum(int(c) for c in str(math.factorial(100))) Doh! Using int(c) didn't occur to me and I didn't know about math.factorial. Notice also that WJ hasn't yet dared posting his crap on comp.lang.haskell. -- https://mail.python.org/mailman/listinfo/python-list

Re: _sitebuiltins?

2017-09-24 Thread Steve D'Aprano
On Mon, 25 Sep 2017 10:03 am, Stefan Ram wrote: > What's the difference between »builtins« and »_sitebuiltins«? > > |>>> type.__module__ > |'builtins' > | > |>>> help.__module__ > |'_sitebuiltins' > > I mean the semantic difference. Why are some entities placed > into »builtins« and some i

Re: _sitebuiltins?

2017-09-24 Thread Chris Angelico
On Mon, Sep 25, 2017 at 10:46 AM, Stefan Ram wrote: > Chris Angelico writes: >>On Mon, Sep 25, 2017 at 10:03 AM, Stefan Ram wrote: >>>What's the difference between »builtins« and »_sitebuiltins«? >>>|>>> type.__module__ >>>|'builtins' >>>| >>>|>>> help.__module__ >>>|'_sitebuiltins' >>def se

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

2017-09-24 Thread Steve D'Aprano
On Mon, 25 Sep 2017 01:56 am, bartc wrote: >> The point I am making is that we could describe just about any and all >> languages with functions "call by binding", whether they are call by value >> like C, call by reference like Fortran, call by need like Haskell, or call by >> sharing like Python

Re: _sitebuiltins?

2017-09-24 Thread Chris Angelico
On Mon, Sep 25, 2017 at 10:03 AM, Stefan Ram wrote: > What's the difference between »builtins« and »_sitebuiltins«? > > |>>> type.__module__ > |'builtins' > | > |>>> help.__module__ > |'_sitebuiltins' > > I mean the semantic difference. Why are some entities placed > into »builtins« and some

Re: Project Euler 20.

2017-09-24 Thread Ian Kelly
On Sun, Sep 24, 2017 at 4:35 PM, Paul Rubin wrote: > > "Robert L." writes: > >> Find the sum of the digits in the number 100! > > In Python? > > So you have come to plague us here too. > > >>> sum(ord(c)-ord('0') for c in str(reduce(lambda a,b: a*b, range(1,101),1))) > 648 Or for any Python 2.6

Re: python console menu level looping

2017-09-24 Thread Cameron Simpson
On 24Sep2017 21:41, Daiyue Weng wrote: Hi, I tried to make a menu using print statements in Python 3. The code is as follows, One thing, please try to preserve the code indenting in messages. What you pasted is all hard against the left side of the screen. I've tried to repair it. print('

Re: Project Euler 20.

2017-09-24 Thread Paul Rubin
"Robert L." writes: >> Find the sum of the digits in the number 100! > In Python? So you have come to plague us here too. >>> sum(ord(c)-ord('0') for c in str(reduce(lambda a,b: a*b, range(1,101),1))) 648 -- https://mail.python.org/mailman/listinfo/python-list

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

2017-09-24 Thread Gregory Ewing
Dennis Lee Bieber wrote: "Binding" itself tends to be Python specific terminology -- in that it is the parameter /name/ that gets bound/attached to the argument /object/. It is the same method as used in any Python "assignment" statement, Which is why I think "call by assignment" would

Re: python console menu level looping

2017-09-24 Thread Daiyue Weng
Sry for the unclear formatting, this is the original code with correct format (copy from pycharm), print('insert data into: ') data_insert_method = ['new collection', 'existing collection'] for index, elem in enumerate(data_insert_method): print(index, '-', elem) while 1: how_to_insert =

Re: python console menu level looping

2017-09-24 Thread Daiyue Weng
well, in my case, there is no GUI, and we do not intend to use it since this script is only for internal testing purposes. So I am just wondering how to loop menu in this context. On 24 September 2017 at 22:03, Stefan Ram wrote: > Daiyue Weng writes: > >I am wondering how to loop back to the 1s

python console menu level looping

2017-09-24 Thread Daiyue Weng
Hi, I tried to make a menu using print statements in Python 3. The code is as follows, print('insert data into: ') data_insert_method = ['new collection', 'existing collection'] for index, elem in enumerate(data_insert_method): print(index, '-', elem) while 1: how_to_insert = input('Choose a meth

Compiling Python for iOS 11

2017-09-24 Thread Patrick Stinson
Has anyone successfully compiled python for iOS 11? I tried with 3.5.2 and 3.6.2 and got the following errors: turin:Python-3.6.2 patrick$ make Makefile:9845: warning: overriding commands for target `.obj/_pickle.o' Makefile:8855: warning: ignoring old commands for target `.obj/_pickle.o' /Appli

Re: Reference cycles

2017-09-24 Thread Peter Otten
Steve D'Aprano wrote: > Is there a way to log when the garbage collector finds and collects a > reference cycle? > > I don't care about objects claimed by the reference counter, I only care > about cycles. I don't know, and I don't think so. Would a structure like a --- b --- c | | | d

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

2017-09-24 Thread bartc
On 24/09/2017 15:49, Steve D'Aprano wrote: On Mon, 25 Sep 2017 12:35 am, Stefan Ram wrote: WRT to assertions about Python, I try to base them on the "The Python Language Reference, Release 3.6.0" (PRL). So, WRT to parameter passing, I would use this part of the PRL: »The follo

Reference cycles

2017-09-24 Thread Steve D'Aprano
Is there a way to log when the garbage collector finds and collects a reference cycle? I don't care about objects claimed by the reference counter, I only care about cycles. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https:/

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

2017-09-24 Thread Steve D'Aprano
On Mon, 25 Sep 2017 12:35 am, Stefan Ram wrote: > WRT to assertions about Python, I try to base them on the > "The Python Language Reference, Release 3.6.0" (PRL). > > So, WRT to parameter passing, I would use this part of the PRL: > > »The following constructs bind names: formal par

Re: SyntaxError: multiple statements found while compiling a single statement

2017-09-24 Thread khushi27gkcse
On Saturday, October 8, 2016 at 11:32:17 AM UTC+5:30, Cai Gengyang wrote: > Any idea how to correct this error ? Looks fine to me > > >>> rect_x = 50 > > # Main Program Loop --- > while not done: > for event in pygame.event.get(): # User did something > if event

Re: PyQt: viewport vs window - how do you translate co-ordinates?

2017-09-24 Thread Veek M
On Saturday, September 23, 2017 at 8:44:25 PM UTC+5:30, Michael Torrie wrote: > On 09/23/2017 05:38 AM, Veek M wrote: > > I didn't understand any of that - could someone expand on that para? > > Is there a reading resource that explains the Viewport and translations? I > > am not a CS student so I