Re: tictactoe script - commented - may have pedagogical value

2017-09-07 Thread Steven D'Aprano
On Thu, 07 Sep 2017 01:45:01 +, Stefan Ram wrote: > Steve D'Aprano writes: >>web.archive.org/web/20040428174214/http://www.geocities.com/ flo_kreidler/tictactoe.html >>I am intrigued by the (alleged?) HTML version of tic-tac-toe. Can >>somebody explain what it is doing and how it works? > >

Re: non-standard glibc location

2017-09-07 Thread dieter
"Fetchinson . via Python-list" writes: > I'm trying to install a binary package (tensorflow) which contains > some binary C extensions. Now my system glibc is 2.15 but the binaries > in the C extensions were created (apparently) with glibc 2.17. So I > thought no problemo I installed glibc 2.17 t

what is payload

2017-09-07 Thread Andrej Viktorovich
Hello, Have working sample with strange property - payload: class ExampleClass(object): def __init__(self,value): print("Initialising instance...") self.payload = value exampleInstance = ExampleClass(42) print(exampleInstance.payload) Is it some default field that all objec

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

2017-09-07 Thread Antoon Pardon
Op 07-09-17 om 03:27 schreef Steve D'Aprano: > >> Yes it is. Pascal VAR parameters are exactly like Python a assignment. > Proof by assertion? > > "It is true, because I say it is true!" I didn't just assert, I also explained. That you choose to ignore the explanation doesn't make it a proof by as

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

2017-09-07 Thread Marko Rauhamaa
Chris Angelico : > *facepalm* > > I got nothing to say to you. Then why say anything? Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-07 Thread Marko Rauhamaa
Dennis Lee Bieber : > On Wed, 06 Sep 2017 10:37:42 +0300, Marko Rauhamaa > declaimed the following: > >> >>Which reminds me of this puzzle I saw a couple of days ago: >> >> 1 + 4 = 5 >> 2 + 5 = 12 >> 3 + 6 = 21 >> 8 + 11 = ? >> >>A mathematician immediately comes up with a "wrong" answer.

Re: what is payload

2017-09-07 Thread eth0
Era el Thu, 7 Sep 2017 00:48:34 -0700 (PDT) en comp.lang.python, cuando de repente Andrej Viktorovich dijo lo siguiente acerca de what is payload: > Hello, > > Have working sample with strange property - payload: > > class ExampleClass(object): > def __init__(self,value): > prin

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-07 Thread Chris Angelico
On Thu, Sep 7, 2017 at 5:59 PM, Marko Rauhamaa wrote: > Dennis Lee Bieber : > >> On Wed, 06 Sep 2017 10:37:42 +0300, Marko Rauhamaa >> declaimed the following: >> >>> >>>Which reminds me of this puzzle I saw a couple of days ago: >>> >>> 1 + 4 = 5 >>> 2 + 5 = 12 >>> 3 + 6 = 21 >>> 8 + 11

Re: tictactoe script - commented - may have pedagogical value

2017-09-07 Thread Chris Angelico
On Thu, Sep 7, 2017 at 5:11 PM, Steven D'Aprano wrote: > Thank you for the explanation Stefan, but I do know how to use a browser. > > What I didn't know is how the HTML works. I thought it was actually doing > some computation, but it seems like its just jumping to pre-rendered tic- > tac-toe gri

Re: what is payload

2017-09-07 Thread Frank Millman
"Andrej Viktorovich" wrote in message news:4ad4fa0e-cd61-412d-8c8f-9f5be2bad...@googlegroups.com... Hello, Have working sample with strange property - payload: class ExampleClass(object): def __init__(self,value): print("Initialising instance...") self.payload = value exa

Design: method in class or general function?

2017-09-07 Thread Leam Hall
OOP newbie on Python 2.6. I create instances of Character class with an attribute dict of 'skills'. The 'skills' dict has the name of a skill as the key and an int as a value. The code adds or modifies skills before outputting the Character. Is it better design to have a Character.method tha

Why do we nned both - __init__() and __new__()

2017-09-07 Thread Andrej Viktorovich
Hello For my understanding both - __init__() and __new__() works like constructors. And __new__() looks is closer to constructor. __init__() is more for variable initialization. Why I can't just initialize in __init__() ? class ExampleClass(object): def __new__(cls,value): print("cr

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-07 Thread Ben Bacarisse
Chris Angelico writes: > On Thu, Sep 7, 2017 at 5:59 PM, Marko Rauhamaa wrote: >> Dennis Lee Bieber : >> >>> On Wed, 06 Sep 2017 10:37:42 +0300, Marko Rauhamaa >>> declaimed the following: >>> Which reminds me of this puzzle I saw a couple of days ago: 1 + 4 = 5 2 +

Re: Why do we nned both - __init__() and __new__()

2017-09-07 Thread Rustom Mody
On Thursday, September 7, 2017 at 4:27:48 PM UTC+5:30, Andrej Viktorovich wrote: > Hello > > For my understanding both - __init__() and __new__() works like constructors. > And __new__() looks is closer to constructor. __init__() is more for variable > initialization. Why I can't just initialize

Re: remove path forever

2017-09-07 Thread eryk sun
On Thu, Sep 7, 2017 at 1:39 AM, Andrej Viktorovich wrote: > > I have 64 bit python on my windows 10 machine. Install contains 32 bit python > libs in path > and I would like to remove them. > > I do > imprt sys > sys.path.remove("C:\\Users\\me\\AppData\\Local\\Programs\\Python\\Python36-32") > >

Re: tictactoe script - commented - may have pedagogical value

2017-09-07 Thread Steve D'Aprano
On Thu, 7 Sep 2017 06:05 pm, Chris Angelico wrote: > On Thu, Sep 7, 2017 at 5:11 PM, Steven D'Aprano > wrote: >> Thank you for the explanation Stefan, but I do know how to use a browser. >> >> What I didn't know is how the HTML works. I thought it was actually doing >> some computation, but it se

Re: Design: method in class or general function?

2017-09-07 Thread Steve D'Aprano
On Thu, 7 Sep 2017 07:20 pm, Leam Hall wrote: > OOP newbie on Python 2.6. Python 2.6 is ancient, and is missing many nice features. You should consider using the latest version, 3.6. > I create instances of Character class with an attribute dict of > 'skills'. The 'skills' dict has the name of

Re: Why do we nned both - __init__() and __new__()

2017-09-07 Thread Steve D'Aprano
On Thu, 7 Sep 2017 08:57 pm, Andrej Viktorovich wrote: > Hello > > For my understanding both - __init__() and __new__() works like constructors. > And __new__() looks is closer to constructor. __init__() is more for variable > initialization. Why I can't just initialize in __init__() ? Because i

Re: tictactoe script - commented - may have pedagogical value

2017-09-07 Thread Chris Angelico
On Thu, Sep 7, 2017 at 10:07 PM, Steve D'Aprano wrote: > On Thu, 7 Sep 2017 06:05 pm, Chris Angelico wrote: > >> On Thu, Sep 7, 2017 at 5:11 PM, Steven D'Aprano >> wrote: >>> Thank you for the explanation Stefan, but I do know how to use a browser. >>> >>> What I didn't know is how the HTML works

Re: Why do we nned both - __init__() and __new__()

2017-09-07 Thread Ben Finney
Andrej Viktorovich writes: > For my understanding both - __init__() and __new__() works like > constructors. Not true, they work quite differently and have very different jobs. > And __new__() looks is closer to constructor. __init__() is more for > variable initialization. That's right. The

Re: Design: method in class or general function?

2017-09-07 Thread Ben Finney
Steve D'Aprano writes: > On Thu, 7 Sep 2017 07:20 pm, Leam Hall wrote: > > > OOP newbie on Python 2.6. > > Python 2.6 is ancient, and is missing many nice features. You should > consider using the latest version, 3.6. Another, more compelling, reason to follow that advice: Python 2 is in mainten

Re: Design: method in class or general function?

2017-09-07 Thread Marko Rauhamaa
Ben Finney : > Another, more compelling, reason to follow that advice: Python 2 is in > maintenance-only mode and will receive no support at all in a few > years. It is a dead end. > > Python 3 is actively developed and will be supported indefinitely. This reminds me of the Biblical story of the m

Re: Design: method in class or general function?

2017-09-07 Thread leam hall
On Thu, Sep 7, 2017 at 8:16 AM, Steve D'Aprano wrote: > On Thu, 7 Sep 2017 07:20 pm, Leam Hall wrote: > > > OOP newbie on Python 2.6. > > Python 2.6 is ancient, and is missing many nice features. You should > consider > using the latest version, 3.6. > I've wrestled with that discussion for a wh

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

2017-09-07 Thread Gregory Ewing
Rustom Mody wrote: I said: In that case please restate the definition of 'is' from the manual which invokes the notion of 'memory' without bringing in memory. I don't know whether it's in the manual, but at least for mutable objects, there is a way to define the notion of "same object" that do

In ports of a log file, how to detect if the ports are dangerous using python?

2017-09-07 Thread Rockzers
I know basic python and I have a log file, also I have print the output of ports from the log file which there are so many ports in the output. I want to know how to take only the dangerous ports from the printed ports - Also I need to take the IP addresses from the dangerous ports - Finally how

Re: Design: method in class or general function?

2017-09-07 Thread Ben Finney
leam hall writes: > I've wrestled with that discussion for a while and Python 3 loses every > time. The context of the thread you started was that you are a *newcomer* to Python. Now you say you've considered Python 2 versus Python 3 many times? What explains that apparent contradiction? > The

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

2017-09-07 Thread Gregory Ewing
Steve D'Aprano wrote: I think that these two increment procedures will be (more or less?) equivalent: procedure increment(var n: integer); begin n := n + 1 end; procedure increment2(p: intpointer); begin p^ := p^ + 1 end; They are, with the proviso that, in standard Pascal, in

Re: tictactoe script - commented - may have pedagogical value

2017-09-07 Thread Ian Kelly
On Thu, Sep 7, 2017 at 2:05 AM, Chris Angelico wrote: > On Thu, Sep 7, 2017 at 5:11 PM, Steven D'Aprano >> I don't know why it places *two* pairs of crosses and naughts instead of >> one. Maybe the page is broken. > > I think it is, as part of being on the Internet Archive. To get a > working vers

Re: tictactoe script - commented - may have pedagogical value

2017-09-07 Thread Ian Kelly
On Thu, Sep 7, 2017 at 6:21 AM, Chris Angelico wrote: > On Thu, Sep 7, 2017 at 10:07 PM, Steve D'Aprano > wrote: >> As a practical technique, naturally using a lookup table of pre-computed >> values >> is a good solution to many problems. But you cannot say you are performing >> general computat

Re: tictactoe script - commented - may have pedagogical value

2017-09-07 Thread Grant Edwards
On 2017-09-07, Ian Kelly wrote: > On Thu, Sep 7, 2017 at 2:05 AM, Chris Angelico wrote: >> On Thu, Sep 7, 2017 at 5:11 PM, Steven D'Aprano >>> I don't know why it places *two* pairs of crosses and naughts instead of >>> one. Maybe the page is broken. >> >> I think it is, as part of being on the I

How to create an object in database only if the database is not there?

2017-09-07 Thread Anubhav Yadav
Hi, I am using `pony` orm to write a simple class as my model. Here is the class. ``` from pony.orm import Database from pony.orm import Required, Optional from pony.orm import db_session from pony.orm import select, commit DB_PATH = ‘db.sqlite’ db = Database() class Course(db.Entity): "

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

2017-09-07 Thread Chris Angelico
On Thu, Sep 7, 2017 at 11:21 PM, Gregory Ewing wrote: > Rustom Mody wrote: > >> I said: In that case please restate the definition of 'is' from the manual >> which invokes the notion of 'memory' without bringing in memory. > > > I don't know whether it's in the manual, but at least for > mutable o

Re: remove path forever

2017-09-07 Thread Andrej Viktorovich
On Thursday, 7 September 2017 14:35:58 UTC+3, eryk sun wrote: > On Thu, Sep 7, 2017 at 1:39 AM, Andrej Viktorovich > wrote: > > > > I have 64 bit python on my windows 10 machine. Install contains 32 bit > > python libs in path > > and I would like to remove them. > > > > I do > > imprt sys > > s

Re: non-standard glibc location

2017-09-07 Thread Thomas Jollans
On 2017-09-06 16:14, Fetchinson . via Python-list wrote: > Hi folks, > > I'm trying to install a binary package (tensorflow) which contains > some binary C extensions. Now my system glibc is 2.15 but the binaries > in the C extensions were created (apparently) with glibc 2.17. So I > thought no pr

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

2017-09-07 Thread Steve D'Aprano
On Fri, 8 Sep 2017 12:28 am, Chris Angelico wrote: > languages without mutable objects don't > really care whether they're pass-by-X or pass-by-Y. Only if you don't care about efficiency. Believe me, the first time you pass a five gigabyte array to a function using pass-by-value, on a machine wi

Midi output timing?

2017-09-07 Thread Tobiah
I'd like to use a python program to send out MIDI events to another program. I've done in the past by generating scores for csound which would do the MIDI output. The apparent hurdle is the timing bit. I've seen packages that allow the creation of MIDI events, but given a list of events of arb

Re: remove path forever

2017-09-07 Thread Thomas Jollans
On 2017-09-07 16:25, Andrej Viktorovich wrote: > On Thursday, 7 September 2017 14:35:58 UTC+3, eryk sun wrote: >> On Thu, Sep 7, 2017 at 1:39 AM, Andrej Viktorovich >> wrote: >>> >>> I have 64 bit python on my windows 10 machine. Install contains 32 bit >>> python libs in path >>> and I would li

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

2017-09-07 Thread Chris Angelico
On Fri, Sep 8, 2017 at 1:30 AM, Steve D'Aprano wrote: > On Fri, 8 Sep 2017 12:28 am, Chris Angelico wrote: > >> languages without mutable objects don't >> really care whether they're pass-by-X or pass-by-Y. > > Only if you don't care about efficiency. > > Believe me, the first time you pass a five

Re: remove path forever

2017-09-07 Thread eryk sun
On Thu, Sep 7, 2017 at 9:25 AM, Andrej Viktorovich wrote: > On Thursday, 7 September 2017 14:35:58 UTC+3, eryk sun wrote: >> On Thu, Sep 7, 2017 at 1:39 AM, Andrej Viktorovich >> wrote: >> > >> > I have 64 bit python on my windows 10 machine. Install contains 32 bit >> > python libs in path >>

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

2017-09-07 Thread Steve D'Aprano
On Fri, 8 Sep 2017 02:24 am, Chris Angelico wrote: > On Fri, Sep 8, 2017 at 1:30 AM, Steve D'Aprano > wrote: >> On Fri, 8 Sep 2017 12:28 am, Chris Angelico wrote: >> >>> languages without mutable objects don't >>> really care whether they're pass-by-X or pass-by-Y. >> >> Only if you don't care ab

Re: In ports of a log file, how to detect if the ports are dangerous using python?

2017-09-07 Thread Chris Angelico
On Thu, Sep 7, 2017 at 11:28 PM, Rockzers wrote: > I know basic python and I have a log file, also I have print the output of > ports from the log file which there are so many ports in the output. > I want to know how to take only the dangerous ports from the printed ports - > Also I need to tak

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

2017-09-07 Thread Rustom Mody
On 06/09/17 14:02, Stefan Ram wrote: > Chris Angelico writes: >> The 'is' operator tests if two things are the same thing. > >»Roughly speaking, to say of two things that they are >identical is nonsense, and to say of one thing that it >is identical with itself is to say not

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

2017-09-07 Thread Rustom Mody
On Thursday, September 7, 2017 at 6:52:04 PM UTC+5:30, Gregory Ewing wrote: > Rustom Mody wrote: > > > I said: In that case please restate the definition of 'is' from the manual > > which > > invokes the notion of 'memory' without bringing in memory. > > I don't know whether it's in the manual,

mush 2.7 released! - Type-based dependency injection for scripts

2017-09-07 Thread Chris Withers
Hi All, I'm very happy to announce the a new release of Mush, a light weight dependency injection framework aimed at enabling the easy testing and re-use of chunks of code that make up scripts. This release includes: - Add support for using Python 3 type annotations to specify requirements

Re: Hatch - A modern project, package, and virtual env manager

2017-09-07 Thread ofekmeister
Big quality of life improvements in 0.7.0! https://github.com/ofek/hatch#070 -- https://mail.python.org/mailman/listinfo/python-list

Re: non-standard glibc location

2017-09-07 Thread Fetchinson . via Python-list
On 9/7/17, Thomas Jollans wrote: > On 2017-09-06 16:14, Fetchinson . via Python-list wrote: >> Hi folks, >> >> I'm trying to install a binary package (tensorflow) which contains >> some binary C extensions. Now my system glibc is 2.15 but the binaries >> in the C extensions were created (apparentl

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

2017-09-07 Thread Steve D'Aprano
On Fri, 8 Sep 2017 05:15 am, Stefan Ram wrote: > It computing newsgroups, for example, people > ask about how to compute the number of digits > of a number, when, actually, only numerals > (representations of numbers in a particular > numeral system) have digits. Um, yes? That's implici

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

2017-09-07 Thread Steve D'Aprano
On Fri, 8 Sep 2017 04:24 am, Rustom Mody wrote: > On Thursday, September 7, 2017 at 6:52:04 PM UTC+5:30, Gregory Ewing wrote: >> Rustom Mody wrote: >> >> > I said: In that case please restate the definition of 'is' from the manual >> > which invokes the notion of 'memory' without bringing in memo

Re: Setting property for current class from property in an different class...

2017-09-07 Thread Christopher Reimer via Python-list
On 9/6/2017 9:26 PM, Christopher Reimer wrote: On Sep 6, 2017, at 9:14 PM, Stefan Ram wrote: I can run this (your code) without an error here (Python 3.6.0), from a file named "Scraper1.py": I'll check tomorrow. I recently switched from 3.5.x to 3.6.1 in the PyCharm IDE. It's probably FU

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

2017-09-07 Thread Rustom Mody
On Friday, September 8, 2017 at 7:39:38 AM UTC+5:30, Steve D'Aprano wrote: > On Fri, 8 Sep 2017 04:24 am, Rustom Mody wrote: > > > On Thursday, September 7, 2017 at 6:52:04 PM UTC+5:30, Gregory Ewing wrote: > >> Rustom Mody wrote: > >> > >> > I said: In that case please restate the definition of

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

2017-09-07 Thread Chris Angelico
On Fri, Sep 8, 2017 at 1:01 PM, Rustom Mody wrote: > >> Can you show an actual false positive (two distinct objects for which `is` >> returns True) or false negative (the same object given as both operands for >> `is` nevertheless returns False)? In the absence of any actual bugs in the >> definit

Need to pass a class instance to a gettext fallback

2017-09-07 Thread Josef Meile
Hi I'm working with gettext and need to define a language Fallback. I got this working, but with a global variable. I don't really like this and I would like to pass this variable to the gettext Fallback's contructor, but I don't know how. For simplicity, I won't put the whole code here, just t

async. How to wait for async function to complete

2017-09-07 Thread Andrew Z
Hello, i need to wait for the callback function (contractDetailsEnd) to finish before i can continue with the logic ( in subscribe) further. For that i check the flag (ContractsUpdatedEnd) in the "while" loop. Here is the simplified code: import asyncio import ibapi from tws_async import TWSCl

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

2017-09-07 Thread Marko Rauhamaa
Gregory Ewing : > There is more leeway when it comes to immutable objects; > implementations are free to cache and re-use them, so well-written > code avoids depending on the result of "is" for immutable objects. I definitely trust that: a = b assert a is b even when b holds an immutable o

Re: Need to pass a class instance to a gettext fallback

2017-09-07 Thread Peter Otten
Josef Meile wrote: > Hi > > I'm working with gettext and need to define a language Fallback. I got > this working, but with a global variable. I don't really like this and I > would like to pass this variable to the gettext Fallback's contructor, but > I don't know how. For simplicity, I won't pu