Re: Merge pdf files using information from two files

2017-09-08 Thread dieter
accessnew...@gmail.com writes: > I have two files (right now they are spreadsheets but I can export them to > any format). > > File1 has StoreID (unique) in one column and a pdf map location in the second > column. (Names not really sequenced numerically) > > 1 C:/maps/map1.pdf > 2 C:/ma

Hat difference between "" and '' in string definition

2017-09-08 Thread Andrej Viktorovich
Hello, What is difference between string definitions: s="aaa" and s='bbb' -- https://mail.python.org/mailman/listinfo/python-list

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

2017-09-08 Thread ofekmeister
Temporary venvs support and terminal colors in 0.8.0! https://github.com/ofek/hatch#080 -- https://mail.python.org/mailman/listinfo/python-list

Case Solution: Doing Business in Sierra Leone Graeme Hossie at London Mining (A) by Brian C. Pinkham, Ken Mark

2017-09-08 Thread sonamdemapuku
What priorities should hossie consider? What are some of the concerns around enforcement of the contract? How should hossie carry out negotiations? -- https://mail.python.org/mailman/listinfo/python-list

Re: Key Error: "city"

2017-09-08 Thread Ben Finney
V Vishwanathan writes: > alert = "Today's forecast for {city}: The temperature will range > from{low_temperature} "" to ""{high_temperature}{temperature_unit}Conditions > will be > {weather_conditions}".format(city,low_temperature,high_temperature,temperature_unit,weather_conditions) > print(a

Key Error: "city"

2017-09-08 Thread V Vishwanathan
(1) Trying to convert concatenated string to .format method (2) concatenated string >> [#todo rewrite this line to use the format method rather than string concatenation alert = "Today's forecast for " + city + ": The temperature will range from " + str(low_temperature) + " to " + str(high_temper

Re: Using Python 2

2017-09-08 Thread Terry Reedy
On 9/8/2017 12:27 PM, Steve D'Aprano wrote: On Sat, 9 Sep 2017 12:23 am, Leam Hall wrote: If Python 3 is not a total re-write then why break compatibility? To avoid building up excess cruft in the language. To fix design mistakes which cannot be fixed without a backwards-incompatible change

Re: Not appending ("lib") to sys.path breaks tests.

2017-09-08 Thread Ian Kelly
On Fri, Sep 8, 2017 at 3:54 PM, Leam Hall wrote: > On 09/08/2017 05:41 PM, Ian Kelly wrote: > >> I'm confused about where the character_tools import is made. If that's >> within a module in the lib package, it should be fine. > > >> It looks like it's failing to find the lib package. Since you rem

Re: Questions.

2017-09-08 Thread boB Stepp
On Fri, Sep 8, 2017 at 9:54 PM, Michael Torrie wrote: > On 09/08/2017 08:35 PM, V Vishwanathan wrote: >> Hi, From what I see in the recent 4/5 digests, this forum seems to be for >> advanced >> >> and professional programmers. >> >> So wondering if a newbie can post some questions to understand e

Re: Questions.

2017-09-08 Thread Skip Montanaro
> Hi, From what I see in the recent 4/5 digests, this forum seems to be for > advanced and professional programmers. > > So wondering if a newbie can post some questions to understand errors in his > code or will it look silly? While there are professional programmers here, and some questions ex

Re: Questions.

2017-09-08 Thread Michael Torrie
On 09/08/2017 08:35 PM, V Vishwanathan wrote: > Hi, From what I see in the recent 4/5 digests, this forum seems to be for > advanced > > and professional programmers. > > So wondering if a newbie can post some questions to understand errors in his > code > > or will it look silly? Yes you may

Questions.

2017-09-08 Thread V Vishwanathan
Hi, From what I see in the recent 4/5 digests, this forum seems to be for advanced and professional programmers. So wondering if a newbie can post some questions to understand errors in his code or will it look silly? Thanks, Venkat -- https://mail.python.org/mailman/listinfo/python-list

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

2017-09-08 Thread Steve D'Aprano
On Sat, 9 Sep 2017 10:34 am, Gregory Ewing wrote: > Steve D'Aprano wrote: >> The paradox of the axe is one illustration of the difficulty in defining "the >> same" in full generality. > > The axe situation doesn't arise in Python, because "same > object" in Python is a concept that only applies t

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

2017-09-08 Thread Gregory Ewing
dieter wrote: In the general case, constructing an object can be split into two subtasks: obtain a raw piece of storage able to manage the object's state; initialize the object's state. The first subtask is handled by "__new__", the second by "__init__". Except that's not quite correct, because

Re: class inheritance when not defined

2017-09-08 Thread Ben Finney
Steve D'Aprano writes: > Good way: > > Foreigner speaking English as their second language: > "Who is the father of this class?" > > Native English speaker: > "The father is 'object', but in English we would normally ask > 'what is the parent?' instead." Of the three scenario

Merging pdf files based on a value in a field

2017-09-08 Thread MrJean1
Try PyPDF2, see the merge example. /Jean -- https://mail.python.org/mailman/listinfo/python-list

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

2017-09-08 Thread Gregory Ewing
Steve D'Aprano wrote: The paradox of the axe is one illustration of the difficulty in defining "the same" in full generality. The axe situation doesn't arise in Python, because "same object" in Python is a concept that only applies to objects existing at the same time. There's no way to even a

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

2017-09-08 Thread Gregory Ewing
Steve D'Aprano wrote: I don't think that talking about the average integer is meaningful. We're not averaging the integers, we're averaging their numbers of digits, which are natural numbers. To do this rigorously you could write down an expression for the average length of integers up to som

Re: Merge pdf files using information from two files

2017-09-08 Thread Christopher Reimer
> On Sep 8, 2017, at 1:21 PM, accessnew...@gmail.com wrote: > Ideas as to how to accomplish this? Export your spreadsheets as Comma Separated Values (CSV) files and use the CSV module to read/write those files. https://docs.python.org/3/library/csv.html Chris R. -- https://mail.python.org/m

Re: Using Python 2

2017-09-08 Thread leam hall
On Fri, Sep 8, 2017 at 6:35 PM, Christopher Reimer < christopher_rei...@icloud.com> wrote: > > On Sep 8, 2017, at 6:57 AM, Ned Batchelder > wrote: > > > > What is it that CompSci folks want that developers don't > > want, that ruined Python 3? > > Long-winded debates about obscure language featur

Re: Using Python 2

2017-09-08 Thread Christopher Reimer
> On Sep 8, 2017, at 6:57 AM, Ned Batchelder wrote: > > What is it that CompSci folks want that developers don't > want, that ruined Python 3? Long-winded debates about obscure language features that left the layman programmers in the bit bucket about 50+ comments ago. While some of this can b

Merging pdf files based on a value in a field

2017-09-08 Thread accessnewbie
The StoreID (unique) is in Column1, a pdf map location in Column2, and the file name is "Warehouse1" (this will vary). (names not really sequenced numerically) County1 C:/maps/map1.pdf County1 C:/maps/map2.pdf County2 C:/maps/map1.pdf County2 C:/maps/map3.pdf County3 C:/maps/

Re: Not appending ("lib") to sys.path breaks tests.

2017-09-08 Thread Leam Hall
On 09/08/2017 05:41 PM, Ian Kelly wrote: I'm confused about where the character_tools import is made. If that's within a module in the lib package, it should be fine. It looks like it's failing to find the lib package. Since you removed the "lib" directory from sys.path, does its parent direc

Re: Not appending ("lib") to sys.path breaks tests.

2017-09-08 Thread Ian Kelly
On Fri, Sep 8, 2017 at 3:18 PM, Leam Hall wrote: > A kind soul pointed out that my code uses a sys.path.append("lib") to get > files to be imported: > > sys.path.append("lib") > from character_tools import * > > He noted that having an __init__.py in lib and using: > > from

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

2017-09-08 Thread Pavol Lisy
On 9/8/17, Gregory Ewing wrote: > Steve D'Aprano wrote: >> A harder question is, what if you take a random number from the Integers? >> How >> many digits will it have in (say) base 10? I don't have a good answer to >> that. >> I think it may be ill-defined. > > I think the answer is that on avera

Re: Delay a computation in another thread

2017-09-08 Thread eryk sun
On Fri, Sep 8, 2017 at 10:03 AM, Thomas Jollans wrote: > On 2017-09-08 16:49, Steve D'Aprano wrote: > >> Sorry for the long delay in replying to this, but if I set its daemon >> attribute, >> won't that mean it will live on after the interpreter shuts down? >> >> Also, what happens if it tries to

Not appending ("lib") to sys.path breaks tests.

2017-09-08 Thread Leam Hall
A kind soul pointed out that my code uses a sys.path.append("lib") to get files to be imported: sys.path.append("lib") from character_tools import * He noted that having an __init__.py in lib and using: from .character_tools import * Should be sufficient for "please do

Re: detaching comprehensions

2017-09-08 Thread Ian Kelly
On Fri, Sep 8, 2017 at 3:03 PM, Peter Otten <__pete...@web.de> wrote: *"bar", > ('b', 'a', 'r') Now that just makes my eyes hurt. -- https://mail.python.org/mailman/listinfo/python-list

Re: detaching comprehensions

2017-09-08 Thread bob gailer
I don't know whether you wanted a reply, since you did not ask for one. I am not even sure what your point is. See other comments below. On 9/8/2017 4:24 PM, Stefan Ram wrote: Maybe you all know this, but to me this is something new. I learnt it by trial and error in the Python 3.6.0 cons

Re: detaching comprehensions

2017-09-08 Thread Peter Otten
Stefan Ram wrote: > Maybe you all know this, but to me this is something new. > I learnt it by trial and error in the Python 3.6.0 console. > > Most will know list comprehensions: > > |>>> [ i for i in range( 3, 5 )] > |[3, 4] > > I found out that the comprehension can be detached from

Re: detaching comprehensions

2017-09-08 Thread Ian Kelly
On Fri, Sep 8, 2017 at 2:24 PM, Stefan Ram wrote: > Maybe you all know this, but to me this is something new. > I learnt it by trial and error in the Python 3.6.0 console. > > Most will know list comprehensions: > > |>>> [ i for i in range( 3, 5 )] > |[3, 4] > > I found out that the compre

Merge pdf files using information from two files

2017-09-08 Thread accessnewbie
I have two files (right now they are spreadsheets but I can export them to any format). File1 has StoreID (unique) in one column and a pdf map location in the second column. (Names not really sequenced numerically) 1 C:/maps/map1.pdf 2 C:/maps/map2.pdf 3 C:/maps/map3.pdf 4 C:/m

Re: Using Python 2

2017-09-08 Thread Stephan Houben
Op 2017-09-08, Stefan Ram schreef : > OTOH, there are those killjoys who complain about > "too many parentheses" in programs written in the > "simple language". Which is clearly nonsense since it is easy to show that any working program in said simple language contains *precisely enough* par

Re: Best way to insert sorted in a list

2017-09-08 Thread Stephan Houben
Op 2017-09-08, logonve...@gmail.com schreef : > On Saturday, June 18, 2011 at 2:23:10 AM UTC+5:30, SherjilOzair wrote: >> There are basically two ways to go about this. >> One is, to append the new value, and then sort the list. >> Another is to traverse the list, and insert the new value at the >>

Re: Using Python 2

2017-09-08 Thread breamoreboy
On Friday, September 8, 2017 at 5:19:36 PM UTC+1, Steve D'Aprano wrote: > On Sat, 9 Sep 2017 12:41 am, Chris Angelico wrote: > > >> I ran 2to3 on some code that worked under 2.6.6. and 3.6.2. 2to3 broke it > >> for both versions and it was a fairly trivial script. > > > > Show the code that it br

Re: Using Python 2 (was: Design: method in class or general function?)

2017-09-08 Thread breamoreboy
On Friday, September 8, 2017 at 11:12:50 AM UTC+1, Leam Hall wrote: > > I've read comments about Python 3 moving from the Zen of Python. I'm a > "plain and simple" person myself. Complexity to support what CompSci > folks want, which was used to describe some of the Python 3 changes, > doesn't

Re: Best way to insert sorted in a list

2017-09-08 Thread Steve D'Aprano
On Sat, 9 Sep 2017 04:39 am, logonve...@gmail.com wrote: > On Saturday, June 18, 2011 at 2:23:10 AM UTC+5:30, SherjilOzair wrote: ...^^ You're replying to something six years old. Its doubtful the original poster is still reading. >> What has the community to say about t

Re: Best way to insert sorted in a list

2017-09-08 Thread logonveera
On Saturday, June 18, 2011 at 2:23:10 AM UTC+5:30, SherjilOzair wrote: > There are basically two ways to go about this. > One is, to append the new value, and then sort the list. > Another is to traverse the list, and insert the new value at the > appropriate position. > > The second one's complex

Re: Using Python 2

2017-09-08 Thread Grant Edwards
On 2017-09-08, Steve D'Aprano wrote: > One thing which is notoriously tricky to migrate is mixed > bytes/Latin1 text using Python 2 strings, say you're manipulating > file formats that mix text with binary bytes. These mixed > binary/text files are sometimes badly suited to the new > Unicode/byte

Re: Using Python 2

2017-09-08 Thread Chris Angelico
On Sat, Sep 9, 2017 at 2:19 AM, Steve D'Aprano wrote: > On Sat, 9 Sep 2017 12:41 am, Chris Angelico wrote: > >>> I ran 2to3 on some code that worked under 2.6.6. and 3.6.2. 2to3 broke it >>> for both versions and it was a fairly trivial script. >> >> Show the code that it broke? I've never seen th

Re: Using Python 2

2017-09-08 Thread Steve D'Aprano
On Sat, 9 Sep 2017 12:23 am, Leam Hall wrote: > Various responses in no particular order: > > On 09/08/2017 09:57 AM, Ned Batchelder wrote: >> I've heard a lot of FUD about the Python 3 transition, but this one is >> new to me.  What is it that CompSci folks want that developers don't >> want, th

Re: Using Python 2

2017-09-08 Thread Terry Reedy
On 9/8/2017 6:12 AM, Leam Hall wrote: I've read comments about Python 3 moving from the Zen of Python. Comments about Python 3 range from factual to opinionated to fake. I'm a "plain and simple" person myself. Many of the changes in Python3 were simplifications -- removing a semi-deprecat

Re: Using Python 2

2017-09-08 Thread Steve D'Aprano
On Sat, 9 Sep 2017 12:41 am, Chris Angelico wrote: >> I ran 2to3 on some code that worked under 2.6.6. and 3.6.2. 2to3 broke it >> for both versions and it was a fairly trivial script. > > Show the code that it broke? I've never seen this, unless it's > something like "now you need to install thi

Re: Delay a computation in another thread

2017-09-08 Thread Thomas Jollans
On 2017-09-08 16:49, Steve D'Aprano wrote: > On Sun, 3 Sep 2017 03:03 am, MRAB wrote: > >> On 2017-09-02 11:59, Steve D'Aprano wrote: >>> On Sat, 2 Sep 2017 08:53 pm, Steve D'Aprano wrote: >>> I want to delay a computation and then print it, in the REPL (interactive interpreter). I have

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

2017-09-08 Thread Steve D'Aprano
On Fri, 8 Sep 2017 11:01 pm, Rhodri James wrote: > On 08/09/17 13:45, Stefan Ram wrote: >> Gregory Ewing writes: >> [a random integer will on average have ] >>> infinitely many >>> digits -- despite every actual integer only having finitely >>> many di

Re: Run Windows commands from Python console

2017-09-08 Thread Stephan Houben
Op 2017-09-06, Rick Johnson schreef : > One of the nice (current) features of Tkinter menus (that i > sometimes miss on my windows box!) is the ability to "tear- > off" a menu cascade and use it as a sort of "pseudo tool > bar". I was under the impression that Tk also supported tear-off menus un

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

2017-09-08 Thread Peter Otten
Josef Meile wrote: > language = kwargs['language'] > del kwargs['language'] Not really important, but there's a method for that: language = kwargs.pop("language") > def __init__(self, *args, **kwargs): > language = kwargs['language'] > del kwargs['language'] In Python 3 this can also

Re: Using Python 2

2017-09-08 Thread Chris Angelico
On Sat, Sep 9, 2017 at 1:42 AM, Steve D'Aprano wrote: > ... because this is > really just an excuse to do what they've wanted to do all along: use a > different language. > > Or because somebody in management heard from somebody on LinkedIn that they > heard on Facebook about something they read i

Re: Using Python 2

2017-09-08 Thread Steve D'Aprano
On Fri, 8 Sep 2017 10:51 pm, Chris Angelico wrote: > On Fri, Sep 8, 2017 at 10:42 PM, Marko Rauhamaa wrote: >> Chris Angelico : >>> But as others have said, upgrading to 3.4+ is not as hard as many >>> people fear, and your code generally improves as a result >> >> That's somewhat irrelevant. Poi

Re: Delay a computation in another thread

2017-09-08 Thread Ethan Furman
On 09/08/2017 07:49 AM, Steve D'Aprano wrote: On Sun, 3 Sep 2017 03:03 am, MRAB wrote: Timer is a subclass of Thread, so you can set its .daemon attribute. Sorry for the long delay in replying to this, but if I set its daemon attribute, won't that mean it will live on after the interpreter s

Re: Using Python 2

2017-09-08 Thread Steve D'Aprano
On Fri, 8 Sep 2017 10:50 pm, Larry Martell wrote: > If python 2 ever > is not available I guess then they will have to find the time and > money. Python 2 is open source, it will always be available so long as we still have computers capable of running present day software. (Presumably by the y

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

2017-09-08 Thread Josef Meile
Hi Peter Your code worked, but I did some changes. First of all: I decided that I don't really needed to pass the py_plugin instance. I only needed an attribute called: self._language. Anyway, if I passed it without doing anything else, I got: TypeError: __init__() got an unexpected keyword arg

Re: class inheritance when not defined

2017-09-08 Thread Steve D'Aprano
On Fri, 8 Sep 2017 07:03 pm, Ben Finney wrote: >> Who is the father of ExampleClass1 ? > > No-one, since classes do not have gender. (The convention is to use the > gender-neutral “parent” to refer to that relationship.) Possibly not the case in Russia. Besides, words have gender in many langua

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

2017-09-08 Thread Steve D'Aprano
On Fri, 8 Sep 2017 01:01 pm, Rustom Mody wrote: > On Friday, September 8, 2017 at 7:39:38 AM UTC+5:30, Steve D'Aprano wrote: >> Rustom, I've already given you the definitive answer to your question about >> how to define `is` without talking about memory. You haven't replied or >> acknowledged i

Re: Using Python 2

2017-09-08 Thread Ned Batchelder
On 9/8/17 10:23 AM, Leam Hall wrote: > On 09/08/2017 09:57 AM, Ned Batchelder wrote: >> I've heard a lot of FUD about the Python 3 transition, but this one is >> new to me.  What is it that CompSci folks want that developers don't >> want, that ruined Python 3? > > > It's not FUD if it's true. Cal

asyncio.gather cancellation behaviour

2017-09-08 Thread Stephan Houben
Hi all, I am a bit mystified about the rationale of the cancellation behaviour of asyncio.gather. Case 1: "If the outer Future is cancelled, all children (that have not completed yet) are also cancelled." Case 2: "If any child is cancelled, this is treated as if it raised CancelledE

Re: Delay a computation in another thread

2017-09-08 Thread Steve D'Aprano
On Sun, 3 Sep 2017 03:03 am, MRAB wrote: > On 2017-09-02 11:59, Steve D'Aprano wrote: >> On Sat, 2 Sep 2017 08:53 pm, Steve D'Aprano wrote: >> >>> I want to delay a computation and then print it, in the REPL (interactive >>> interpreter). I have something like this: >> [...] >>> The other problem

Re: Using Python 2

2017-09-08 Thread Steve D'Aprano
On Fri, 8 Sep 2017 08:40 pm, Marko Rauhamaa wrote: > Leam Hall : >> However, those millions of servers are running Python 2.6 and a >> smaller number running 2.7. At least in the US market since Red Hat >> Enterprise Linux and its derivatives run 2.6.6 (RHEL 6) or 2.7.5 (RHEL >> 7). Not sure what

Re: Using Python 2

2017-09-08 Thread Chris Angelico
On Sat, Sep 9, 2017 at 12:23 AM, Leam Hall wrote: > Various responses in no particular order: > > On 09/08/2017 09:57 AM, Ned Batchelder wrote: >> >> I've heard a lot of FUD about the Python 3 transition, but this one is >> new to me. What is it that CompSci folks want that developers don't >> wa

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

2017-09-08 Thread Steve D'Aprano
On Fri, 8 Sep 2017 08:20 pm, Ben Bacarisse wrote: > Steve D'Aprano writes: > >> 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 m

Re: Using Python 2

2017-09-08 Thread Leam Hall
Various responses in no particular order: On 09/08/2017 09:57 AM, Ned Batchelder wrote: I've heard a lot of FUD about the Python 3 transition, but this one is new to me.  What is it that CompSci folks want that developers don't want, that ruined Python 3? It's not FUD if it's true. Calling it

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

2017-09-08 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): > Marko Rauhamaa writes: >>I definitely trust that: >>a = b >>assert a is b >>even when b holds an immutable object. > > |Python 3.6.0 ... > |>>> x = 21568 > |>>> x is 21568 > |False I wasn't talking about x or 21568. I was talking about a and b. Marko --

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

2017-09-08 Thread Antoon Pardon
Op 08-09-17 om 04:09 schreef 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 invok

Re: Using Python 2

2017-09-08 Thread Ned Batchelder
On 9/8/17 6:12 AM, Leam Hall wrote: > I've read comments about Python 3 moving from the Zen of Python. I'm a > "plain and simple" person myself. Complexity to support what CompSci > folks want, which was used to describe some of the Python 3 changes, > doesn't help me get work done. I've heard a

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

2017-09-08 Thread Steve D'Aprano
On Fri, 8 Sep 2017 05:54 pm, Gregory Ewing wrote: > Steve D'Aprano wrote: >> py> class K: # defines an object >> ... def __init__(self, x): >> ... self.x = x >> ... def append(self, value): >> ... self.x.append(value) >> ... >> py> a = [] >> py> b = K(a) >> py> a is

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

2017-09-08 Thread Rhodri James
On 08/09/17 13:45, Stefan Ram wrote: Gregory Ewing writes: [a random integer will on average have ] infinitely many digits -- despite every actual integer only having finitely many digits! This is not possible because every integer has a finit

Re: Using Python 2

2017-09-08 Thread Chris Angelico
On Fri, Sep 8, 2017 at 10:42 PM, Marko Rauhamaa wrote: > Chris Angelico : >> But as others have said, upgrading to 3.4+ is not as hard as many >> people fear, and your code generally improves as a result > > That's somewhat irrelevant. Point is, Python 2 will quickly become a > pariah in many corp

Re: Using Python 2

2017-09-08 Thread Larry Martell
On Fri, Sep 8, 2017 at 8:42 AM, Marko Rauhamaa wrote: > Chris Angelico : >> But as others have said, upgrading to 3.4+ is not as hard as many >> people fear, and your code generally improves as a result > > That's somewhat irrelevant. Point is, Python 2 will quickly become a > pariah in many corpo

Re: Using Python 2

2017-09-08 Thread Marko Rauhamaa
Chris Angelico : > But as others have said, upgrading to 3.4+ is not as hard as many > people fear, and your code generally improves as a result That's somewhat irrelevant. Point is, Python 2 will quickly become a pariah in many corporations during or after 2018, and we are going to see emergency

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

2017-09-08 Thread Chris Angelico
On Fri, Sep 8, 2017 at 10:05 PM, Steve D'Aprano wrote: > On Fri, 8 Sep 2017 05:48 pm, Gregory Ewing wrote: > >> Steve D'Aprano wrote: >>> A harder question is, what if you take a random number from the Integers? >>> How >>> many digits will it have in (say) base 10? I don't have a good answer to

python gdal error

2017-09-08 Thread falcone . giuseppe
Hi to all, I'm new to python program and I have a problem with the following code. I'm unable to read field_data variable in retrieve_model_params function. In debug, execution ends immediately without a message. Anyone have some idea about that? If the for cycle in retrieve_model_params is moved

Re: Using Python 2 (was: Design: method in class or general function?)

2017-09-08 Thread Chris Angelico
On Fri, Sep 8, 2017 at 8:12 PM, Leam Hall wrote: > However, those millions of servers are running Python 2.6 and a smaller > number running 2.7. At least in the US market since Red Hat Enterprise Linux > and its derivatives run 2.6.6 (RHEL 6) or 2.7.5 (RHEL 7). Not sure what > Python SuSE uses but

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

2017-09-08 Thread Steve D'Aprano
On Fri, 8 Sep 2017 05:48 pm, Gregory Ewing wrote: > Steve D'Aprano wrote: >> A harder question is, what if you take a random number from the Integers? How >> many digits will it have in (say) base 10? I don't have a good answer to >> that. I think it may be ill-defined. > > I think the answer is

Re: Using Python 2

2017-09-08 Thread Leam Hall
On 09/08/2017 06:40 AM, Marko Rauhamaa wrote: Leam Hall : However, those millions of servers are running Python 2.6 and a smaller number running 2.7. At least in the US market since Red Hat Enterprise Linux and its derivatives run 2.6.6 (RHEL 6) or 2.7.5 (RHEL 7). Not sure what Python SuSE uses

Re: Using Python 2

2017-09-08 Thread Marko Rauhamaa
Leam Hall : > However, those millions of servers are running Python 2.6 and a > smaller number running 2.7. At least in the US market since Red Hat > Enterprise Linux and its derivatives run 2.6.6 (RHEL 6) or 2.7.5 (RHEL > 7). Not sure what Python SuSE uses but they seem to have a fairly > large Eu

Re: Using Python 2

2017-09-08 Thread Ben Finney
Leam Hall writes: > I've read comments about Python 3 moving from the Zen of Python. For what it's worth: I have done successful conversions of numerous code bases from Python 2 to Python 3, and that characterisation does not fit at all. The resulting code base is much more Pythonic. > I'm a "p

Re: tictactoe script - commented - may have pedagogical value

2017-09-08 Thread Gregory Ewing
Steven D'Aprano wrote: But anyway... it doesn't seem to me that the page is doing any computation using HTML. It's more like a book listing a table of primes. It's a "Choose Your Own Game Of Tic-Tac-Toe" book! -- Greg -- https://mail.python.org/mailman/listinfo/python-list

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

2017-09-08 Thread Ben Bacarisse
Steve D'Aprano writes: > 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 Python 2 (was: Design: method in class or general function?)

2017-09-08 Thread Leam Hall
On 09/08/2017 05:45 AM, Chris Angelico wrote: On Thu, Sep 7, 2017 at 11:31 PM, Ben Finney wrote: 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'v

Re: Design: method in class or general function?

2017-09-08 Thread Leam Hall
On 09/08/2017 03:06 AM, Peter Otten wrote: I'm pleading "method" as it allows per-class implementation. Peter, as always you are a wealth of information! I have some extra time today to digest your notes and visualize tap dancing Marines. Thank you! -- https://mail.python.org/mailman/listin

Re: Design: method in class or general function?

2017-09-08 Thread Chris Angelico
On Thu, Sep 7, 2017 at 11:31 PM, Ben Finney wrote: > 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

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

2017-09-08 Thread Marko Rauhamaa
Gregory Ewing : > Marko Rauhamaa wrote: >> I definitely trust that: >> >>a = b >>assert a is b >> >> even when b holds an immutable object. > > That's true, but there's rarely a good use case for that > fact that isn't better addressed with an equality comparison > rather than an 'is' test

Re: class inheritance when not defined

2017-09-08 Thread Ben Finney
Andrej Viktorovich writes: > I found several class creation samples: > > class ExampleClass1: > > class ExampleClass2(object): > > > What is difference between them? Very little difference. In Python 3, both create classes that inherit from one other class, ‘object’. In Python 2, the first cre

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

2017-09-08 Thread Gregory Ewing
Marko Rauhamaa wrote: I definitely trust that: a = b assert a is b even when b holds an immutable object. That's true, but there's rarely a good use case for that fact that isn't better addressed with an equality comparison rather than an 'is' test. As an example, back in the days of s

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

2017-09-08 Thread Gregory Ewing
Rustom Mody wrote: Models are needed Math is one possible model Machines are another I'm not sure there's any real distinction between "math" and "machines". A Turing machine, for example, is an idealised mathematical model of computation. Maybe the distiction you're trying to get at is "stat

Re: class inheritance when not defined

2017-09-08 Thread Thomas Jollans
On 2017-09-08 10:17, Andrej Viktorovich wrote: > Hello > > I found several class creation samples: > > class ExampleClass1: > > class ExampleClass2(object): > > > What is difference between them? Who is the father of ExampleClass1 ? > In Python 3, unless you've redefined "object", these are

class inheritance when not defined

2017-09-08 Thread Andrej Viktorovich
Hello I found several class creation samples: class ExampleClass1: class ExampleClass2(object): What is difference between them? Who is the father of ExampleClass1 ? -- https://mail.python.org/mailman/listinfo/python-list

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

2017-09-08 Thread Gregory Ewing
Rustom Mody wrote: I'd like to know what these rules are I can't give you a complete list of them off the top of my head, but some examples of the kind of rules I have in mind are: * After the assigment a = b a and b refer to the same object. * After x = [e1, e2, e3, ...] x refers

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

2017-09-08 Thread Gregory Ewing
Steve D'Aprano wrote: py> class K: # defines an object ... def __init__(self, x): ... self.x = x ... def append(self, value): ... self.x.append(value) ... py> a = [] py> b = K(a) py> a is b # these are not the same object (they're different types) False py> b.appe

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

2017-09-08 Thread Gregory Ewing
Steve D'Aprano wrote: A harder question is, what if you take a random number from the Integers? How many digits will it have in (say) base 10? I don't have a good answer to that. I think it may be ill-defined. I think the answer is that on average it has infinitely many digits -- despite every

My Issues

2017-09-08 Thread Carson McDaniel via Python-list
Hello, I am an extreme beginner at this so forgive me if I've done something simple wrong, but every time I try to open Python (3.6.2), I get an error message that says the program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing from my computer. It says to try reinstalling the

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

2017-09-08 Thread dieter
Andrej Viktorovich writes: > 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 __ne

Re: Design: method in class or general function?

2017-09-08 Thread Peter Otten
leam hall wrote: > 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 wr

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

2017-09-08 Thread Gregory Ewing
Rustom Mody wrote: 2. is — machine representation, too fine to be useful No, it's *not* machine representation. As I pointed out before, it's part of the abstract semantics of Python. And it's not "too fine to be useful". On the contrary, being aware of which objects are the same and which are