Re: Identifying tkinter version

2020-04-01 Thread Tony van der Hoff
import tkinter >>> tkinter.TkVersion 8.6 -- Tony van der Hoff| mailto:t...@vanderhoff.org Buckinghamshire, England | -- https://mail.python.org/mailman/listinfo/python-list

increment/decrement operators

2015-12-05 Thread Tony van der Hoff
Hi, I'm a relative newbie to python, and this NG, but it's certainly growing on me. One thing I'm missing is the increment/decrement operator from C, ie x++, and its ilk. Likewise x += y. is there any way of doing this in Python? TIA, Tony -- https://mail.python.org/m

Re: increment/decrement operators

2015-12-05 Thread Tony van der Hoff
On 05/12/15 12:56, Robin Koch wrote: Am 05.12.2015 um 13:40 schrieb Tony van der Hoff: Hi, I'm a relative newbie to python, and this NG, but it's certainly growing on me. One thing I'm missing is the increment/decrement operator from C, ie x++, and its ilk. Likewise x += y. i

Accessing container's methods

2015-12-07 Thread Tony van der Hoff
urn txt if __name__ == '__main__': o = Monty( ["Cleese", "Idle", "Palin" ] ) print "number: ",o.count_actors() a = o.list_actors() for l in a: print l Thanks, Tony -- https://mail.python.org/mailman/listinfo/python-list

Re: Accessing container's methods

2015-12-08 Thread Tony van der Hoff
On 07/12/15 23:47, Erik wrote: Hi Tony, On 07/12/15 18:10, Tony van der Hoff wrote: A highly contrived example, where I'm setting up an outer class in a Has-a relationship, containing a number of Actors. The inner class needs to access a method of the outer class; here the method get

Re: Accessing container's methods [solved]

2015-12-08 Thread Tony van der Hoff
perhaps even faster > return self.actors[:] That doesn't seem to work: <__main__.Actor instance at 0x7fc7478ba560> <__main__.Actor instance at 0x7fc7478ba5a8> <__main__.Actor instance at 0x7fc7478ba5f0> Anyway, I'm no longer in a hole; thanks for all the excellent help. I'll certainly review the design of my current project, to see if it can be improved. Cheers, Tony -- https://mail.python.org/mailman/listinfo/python-list

2to3 translation problem

2015-12-12 Thread Tony van der Hoff
Debian Jessie, python 2.7; python 3.4 I have an application, using pygame for graphics, that works fine under python2.7. I have run it through 2to3, but when running the result under python 3.4, I get the error : Traceback (most recent call last): File "ppm304.py", line 9, in import py

Re: 2to3 translation problem

2015-12-12 Thread Tony van der Hoff
On 12/12/15 15:09, Mark Lawrence wrote: On 12/12/2015 14:42, Tony van der Hoff wrote: Debian Jessie, python 2.7; python 3.4 I have an application, using pygame for graphics, that works fine under python2.7. I have run it through 2to3, but when running the result under python 3.4, I get the

Re: 2to3 translation problem

2015-12-12 Thread Tony van der Hoff
On 12/12/15 17:09, Laura Creighton wrote: In a message of Sat, 12 Dec 2015 17:59:52 +0100, Peter Otten writes: Tony van der Hoff wrote: On 12/12/15 15:09, Mark Lawrence wrote: On 12/12/2015 14:42, Tony van der Hoff wrote: Debian Jessie, python 2.7; python 3.4 I have an application, using

Re: 2to3 translation problem

2015-12-12 Thread Tony van der Hoff
On 12/12/15 17:54, Laura Creighton wrote: In a message of Sun, 13 Dec 2015 04:50:43 +1100, Chris Angelico writes: On Sun, Dec 13, 2015 at 4:30 AM, Tony van der Hoff wrote: Thanks, Laura, and others who have replied. You're right; python-3-pygame exists in unstable, but has not yet made

Re: Trailing zeros of 100!

2016-01-02 Thread Tony van der Hoff
On 02/01/16 16:57, Robin Koch wrote: > sum([int(0.2**k*n) for k in range(1, int(log(n, 5))+1)]) But did you actually test it? -- Tony van der Hoff | mailto:t...@vanderhoff.org Ariège, France | -- https://mail.python.org/mailman/listinfo/python-list

Re: Trailing zeros of 100!

2016-01-03 Thread Tony van der Hoff
On 02/01/16 17:56, Robin Koch wrote: > Am 02.01.2016 um 17:09 schrieb Tony van der Hoff: >> On 02/01/16 16:57, Robin Koch wrote: >>> sum([int(0.2**k*n) for k in range(1, int(log(n, 5))+1)]) >> >> But did you actually test it? > > Yes, should work for n >

Re: What is the fastest way to do 400 HTTP requests using requests library?

2016-01-05 Thread Tony van der Hoff
4 or 8, >> and let each thread pop a request from the queue as needed. >> >> Are you experienced with threads? Do you need further information about >> using threads and queues? > > Also see the concurrent.futures module in the standard library, which > makes this sort o

Re: Reg: Data frame conversion

2016-02-17 Thread Tony van der Hoff
On 17/02/16 18:00, Sushanth wrote: ​i need to convert r data fr​ame to pandas dataframe and vise versa Wow! How do you plan to do that? -- Tony van der Hoff| mailto:t...@vanderhoff.org Buckinghamshire, England | -- https://mail.python.org/mailman/listinfo/python-list

Re: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-19 Thread Tony van der Hoff
python.org/pypi/regex. Am I alone in thinking that this wrongaddress character is trolling? How much effort can it be to just install python, and try out these simple things *before* asking trivia here? -- Tony van der Hoff| mailto:t...@vanderhoff.org Buckinghamshire, England

Pyhon 2.x or 3.x, which is faster?

2016-03-06 Thread Tony van der Hoff
pport this? Thanks, -- Tony van der Hoff| mailto:t...@vanderhoff.org Buckinghamshire, England | -- https://mail.python.org/mailman/listinfo/python-list

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Tony van der Hoff
On 06/03/16 14:41, Steven D'Aprano wrote: On Sun, 6 Mar 2016 10:34 pm, Tony van der Hoff wrote: Hi, I've been experimenting with a short test program under python 2.7 and python 3.4.2. It's a simple read from file, and locate a word therein. I get the (subjective) impression t

importing

2016-03-07 Thread Tony van der Hoff
ing() still errors. 3. in either of the above cases, if I add "from tkinter import messagebox, the attribute resolves correctly. I imagined that the "*" form implied "load the lot". Evidently, my understanding is lacking. Will somebody please put me straight, or give me a r

Re: importing

2016-03-07 Thread Tony van der Hoff
m I supposed to know that a module is part of a package, and needs a "magic" stanza to get a module loaded? Cheers, -- Tony van der Hoff| mailto:t...@vanderhoff.org Buckinghamshire, England | -- https://mail.python.org/mailman/listinfo/python-list

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Tony van der Hoff
s or wings It didn't so much fly, as plummet. -- Tony van der Hoff| mailto:t...@vanderhoff.org Buckinghamshire, England | -- https://mail.python.org/mailman/listinfo/python-list

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-17 Thread Tony van der Hoff
ied to anything that is moving while not contacting the ground. Yep, like a Ferrari on a motorway -- Tony van der Hoff| mailto:t...@vanderhoff.org Buckinghamshire, England | -- https://mail.python.org/mailman/listinfo/python-list

Re: Python-pickle error

2023-05-09 Thread Tony Flury via Python-list
Charles, by your own admission, you deleted your pkl file, And your code doesn't write that pkl file (pickle.dumps(...) doesn't write a file it creates a new string and at no point will it write to the file : What you need is this : import pickle number=2 my_pickled_

Re: pyinstaller wrong classified as Windows virus

2021-11-28 Thread Tony Flury via Python-list
Have you tried using Nuitka - rather than pyInstalller - it means you distribute a single executable and the Python run time library (which they probably have already), and it has the advantage that it is a bit quicker than standard python. Rather than bundle the source code and interpreter in

Puzzling behaviour of Py_IncRef

2022-01-19 Thread Tony Flury via Python-list
IL: test_000_009_test_ref_count (__main__.TestNode) -- Traceback (most recent call last):   File "/home/tony/Development/python/orderedtree/tests/test_orderedtree.py", line 62, in test_000_009_test_ref_count     self.assertEqual(sys.getrefcount(nod

Re: Puzzling behaviour of Py_IncRef

2022-01-19 Thread Tony Flury via Python-list
On 19/01/2022 11:09, Chris Angelico wrote: On Wed, Jan 19, 2022 at 10:00 PM Tony Flury via Python-list wrote: Extension function : static PyObject *_Node_test_ref_count(PyObject *self) { printf("\nIncrementing ref count for self - just for the hell of

Re: Puzzling behaviour of Py_IncRef

2022-01-25 Thread Tony Flury via Python-list
On 20/01/2022 23:12, Chris Angelico wrote: On Fri, 21 Jan 2022 at 10:10, Greg Ewing wrote: On 20/01/22 12:09 am, Chris Angelico wrote: At this point, the refcount has indeed been increased. return self; } And then you say "my return value is this object". So you're incre

Re: Puzzling behaviour of Py_IncRef

2022-01-25 Thread Tony Flury via Python-list
On 25/01/2022 22:28, Barry wrote: On 25 Jan 2022, at 14:50, Tony Flury via Python-list wrote:  On 20/01/2022 23:12, Chris Angelico wrote: On Fri, 21 Jan 2022 at 10:10, Greg Ewing wrote: On 20/01/22 12:09 am, Chris Angelico wrote: At this point, the refcount has indeed been increased

Re: Puzzling behaviour of Py_IncRef

2022-01-26 Thread Tony Flury via Python-list
On 26/01/2022 01:29, MRAB wrote: On 2022-01-25 23:50, Tony Flury via Python-list wrote: On 25/01/2022 22:28, Barry wrote: On 25 Jan 2022, at 14:50, Tony Flury via Python-list  wrote:  On 20/01/2022 23:12, Chris Angelico wrote: On Fri, 21 Jan 2022 at 10:10, Greg Ewing  wrote: On 20/01

Re: Puzzling behaviour of Py_IncRef

2022-01-26 Thread Tony Flury via Python-list
On 26/01/2022 08:20, Chris Angelico wrote: On Wed, 26 Jan 2022 at 19:04, Tony Flury via Python-list wrote: So according to that I should increment twice if and only if the calling code is using the result - which you can't tell in the C code - which is very odd behaviour. No, the r

Re: Puzzling behaviour of Py_IncRef

2022-01-26 Thread Tony Flury via Python-list
On 26/01/2022 22:41, Barry wrote: Run python and your code under a debugger and check the ref count of the object as you step through the code. Don’t just step through your code but also step through the C python code. That will allow you to see how this works at a low level. Setting a watc

Re: Starting using Python

2022-01-27 Thread Tony Flury via Python-list
On 03/01/2022 12:45, Joao Marques wrote: Good morning: I have a very simple question: I want to start writing programs in Python so I went to the Microsoft Store and installed Python3.9. No problem so far. I would prefer to have a gui interface, an interface that I can use file-->Open and File-

Re: on sorting things

2020-01-28 Thread Tony Flury via Python-list
On 20/12/2019 18:59, Peter Otten wrote: Chris Angelico wrote: On Sat, Dec 21, 2019 at 5:03 AM Peter Otten <__pete...@web.de> wrote: PS: If you are sorting files by size and checksum as part of a deduplication effort consider using dict-s instead: Yeah, I'd agree if that's the purpose. But l

Re: RFC: For Loop Invariants

2020-04-20 Thread Tony Flury via Python-list
On 10/04/2020 21:44, Elliott Dehnbostel wrote: *We could do this:* chars = "abcaaabkjzhbjacvb" seek = {'a','b','c'} count = sum([1 for a in chars if a in seek]) However, this changes important semantics by creating an entire new list before summing. Creating the list is pointless in this ca

Re: Function to avoid a global variable

2020-04-29 Thread Tony Flury via Python-list
def foo(i): foo.bar += i foo.bar = 5 --Jach And as you have shown - foo.bar is effectively a global variable - just one with a qualified name :-) -- Tony Flury -- https://mail.python.org/mailman/listinfo/python-list

Re: How to test?

2020-06-19 Thread Tony Flury via Python-list
On 24/04/2020 19:40, Manfred Lotz wrote: I have a command like application which checks a directory tree for certain things. If there are errors then messages will be written to stdout. How to test this in the best way? One idea was for the error situations to write messages to files and then

Re: Floating point problem

2020-06-23 Thread Tony Flury via Python-list
On 18/04/2020 15:29, Grant Edwards wrote: On 2020-04-18, Souvik Dutta wrote: I literally tried it!!! And it did not stop because I did not get any 1.0 rather I got 0.999 But why does this happen. This is a simple math which according to normal human logic should give perfect numbers w

Re: Solved: Re: Missing python curses functions?

2020-06-29 Thread Tony Flury via Python-list
Maybe you should raise a bug (bugs.python.org) and flag that this function is missing. It could be that it can be introduced by whoever is maintaining the existing code. On 20/05/2020 08:31, Alan Gauld via Python-list wrote: On 19/05/2020 20:53, Alan Gauld via Python-list wrote: One of the

Re: Any ideas for a new language inspired to Python?

2020-09-05 Thread Tony Flury via Python-list
C/machine code. -- Tony Flury -- https://mail.python.org/mailman/listinfo/python-list

Simple question - end a raw string with a single backslash ?

2020-10-13 Thread Tony Flury via Python-list
I am trying to write a simple expression to build a raw string that ends in a single backslash. My understanding is that a raw string should ignore attempts at escaping characters but I get this : >>> a = r'end\'   File "", line 1     a = r'end\'   ^ SyntaxError:

Re: Embedding version in command-line program

2020-10-17 Thread Tony Flury via Python-list
On 07/10/2020 12:06, Loris Bennett wrote: Hi, I have written a program, which I can run on the command-line thus mypyprog --version and the get the version, which is currently derived from a variable in the main module file. However, I also have the version in an __init__.py file and in

Is there a way to implement the ** operator on a custom object

2024-02-08 Thread Tony Flury via Python-list
I know that mappings by default support the ** operator, to unpack the mapping into key word arguments. Has it been considered implementing a dunder method for the ** operator so you could unpack an object into a key word argument, and the developer could choose which keywords would be generat

Re: test-ignore

2024-02-15 Thread Tony Oliver via Python-list
On Thursday 15 February 2024 at 21:16:22 UTC, E.D.G. wrote: > Test - ignore February 15, 2024 > > Test post to see if my Newsgroup post program is working. Aim your test messages at alt.test, please. -- https://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4