Re: What is Install-Paths-To in WHEEL file?

2023-12-30 Thread Oscar Benjamin via Python-list
On Sun, 31 Dec 2023 at 00:35, Left Right wrote: > > It's not for you to choose the way I communicate. There are accepted > boundaries, and I'm well within those boundaries. Anything beyond that > is not something I'm even interested in hearing your opinion on. You might not be interested in my

Re: What is Install-Paths-To in WHEEL file?

2023-12-29 Thread Oscar Benjamin via Python-list
On Fri, 29 Dec 2023 at 22:38, Left Right via Python-list wrote: > > > Then your understanding is flat-out wrong. Encouraging participation > > by everyone DOES mean deleting what is unproductive, offensive, and > > likely to discourage participation. > > I haven't written anything unproductive or

Re: What is Install-Paths-To in WHEEL file?

2023-12-29 Thread Oscar Benjamin via Python-list
On Fri, 29 Dec 2023 at 13:04, Left Right via Python-list wrote: > > Wow. That place turned out to be the toxic pit I didn't expect. > > It's a shame that a public discussion of public goods was entrusted to > a bunch of gatekeepers with no sense of responsibility for the thing > they keep the

Re: on writing a number as 2^s * q, where q is odd

2023-12-03 Thread Oscar Benjamin via Python-list
On Sun, 3 Dec 2023 at 10:25, Julieta Shem via Python-list wrote: > > Alan Bawden writes: > > > > def powers_of_2_in(n): > > bc = (n ^ (n - 1)).bit_count() - 1 > > return bc, n >> bc > > That's pretty fancy and likely the fastest. It might be the fastest but it depends how big you expect

Re: Learning tkinter

2023-05-18 Thread Oscar Benjamin
On Thu, 18 May 2023 at 10:16, Rob Cliffe via Python-list wrote: > > I am trying to learn tkinter. > Several examples on the internet refer to a messagebox class > (tkinter.messagebox). > But: > > Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 > bit (Intel)] on win32 >

Re: An "adapter", superset of an iterator

2023-05-03 Thread Oscar Benjamin
On Wed, 3 May 2023 at 18:52, Thomas Passin wrote: > > On 5/3/2023 5:45 AM, fedor tryfanau wrote: > > I've been using python as a tool to solve competitive programming problems > > for a while now and I've noticed a feature, python would benefit from > > having. > > Consider

Re: Christoph Gohlke and compiled packages

2023-04-11 Thread Oscar Benjamin
On Tue, 11 Apr 2023 at 14:55, Mats Wichmann wrote: > > On 4/11/23 06:03, Roel Schroeven wrote: > > Op 11/04/2023 om 12:58 schreef Chris Angelico: > > >> Python itself is fine, but a lot of third-party packages are hard to > >> obtain. So if you need numpy, for instance, or psycopg2, you might >

Re: Christoph Gohlke and compiled packages

2023-04-11 Thread Oscar Benjamin
On Tue, 11 Apr 2023 at 12:01, Chris Angelico wrote: > > On Tue, 11 Apr 2023 at 20:15, Jim Schwartz wrote: > > > > What’s the problem now? Is it with python on windows? I use python on > > windows so I’d like to know. Thanks > > > > Python itself is fine, but a lot of third-party packages are

Re: built-in pow() vs. math.pow()

2023-03-31 Thread Oscar Benjamin
On Fri, 31 Mar 2023 at 20:24, Peter J. Holzer wrote: > > On 2023-03-31 07:39:25 +0100, Barry wrote: > > On 30 Mar 2023, at 22:30, Chris Angelico wrote: > > > It's called math.pow. That on its own should be a strong indication > > > that it's designed to work with floats. > > > > So long as you

Re: built-in pow() vs. math.pow()

2023-03-30 Thread Oscar Benjamin
On Thu, 30 Mar 2023 at 17:31, Andreas Eisele wrote: > > I sometimes make use of the fact that the built-in pow() function has an > optional third argument for modulo calculation, which is handy when dealing > with tasks from number theory, very large numbers, problems from Project > Euler,

Re: Debugging reason for python running unreasonably slow when adding numbers

2023-03-14 Thread Oscar Benjamin
On Tue, 14 Mar 2023 at 16:27, Alexander Nestorov wrote: > > I'm working on an NLP and I got bitten by an unreasonably slow behaviour in > Python while operating with small amounts of numbers. > > I have the following code: > > ```python > import random, time > from functools import reduce > >

Re: Python 3.10 Fizzbuzz

2023-02-28 Thread Oscar Benjamin
On Tue, 28 Feb 2023 at 20:55, Mats Wichmann wrote: > > On 2/27/23 16:42, Oscar Benjamin wrote: > > On Mon, 27 Feb 2023 at 21:06, Ethan Furman wrote: > >> > >> On 2/27/23 12:20, rbowman wrote: > >> > >> > "By using Black, you agree to

Re: Python 3.10 Fizzbuzz

2023-02-27 Thread Oscar Benjamin
On Mon, 27 Feb 2023 at 21:06, Ethan Furman wrote: > > On 2/27/23 12:20, rbowman wrote: > > > "By using Black, you agree to cede control over minutiae of hand- > > formatting. In return, Black gives you speed, determinism, and freedom > > from pycodestyle nagging about formatting. You will save

Re: Precision Tail-off?

2023-02-18 Thread Oscar Benjamin
On Sat, 18 Feb 2023 at 11:19, Peter J. Holzer wrote: > > On 2023-02-18 03:52:51 +, Oscar Benjamin wrote: > > On Sat, 18 Feb 2023 at 01:47, Chris Angelico wrote: > > > On Sat, 18 Feb 2023 at 12:41, Greg Ewing via Python-list > > > > To avoid it you would need

Re: Precision Tail-off?

2023-02-17 Thread Oscar Benjamin
On Sat, 18 Feb 2023 at 01:47, Chris Angelico wrote: > > On Sat, 18 Feb 2023 at 12:41, Greg Ewing via Python-list > wrote: > > > > On 18/02/23 7:42 am, Richard Damon wrote: > > > On 2/17/23 5:27 AM, Stephen Tucker wrote: > > >> None of the digits in RootNZZZ's string should be different from the

Re: Precision Tail-off?

2023-02-17 Thread Oscar Benjamin
On Fri, 17 Feb 2023 at 10:29, Stephen Tucker wrote: > > Thanks, one and all, for your reponses. > > This is a hugely controversial claim, I know, but I would consider this > behaviour to be a serious deficiency in the IEEE standard. [snip] > > Perhaps this observation should be brought to the

Re: Precision Tail-off?

2023-02-14 Thread Oscar Benjamin
On Tue, 14 Feb 2023 at 07:12, Stephen Tucker wrote: > > Hi, > > I have just produced the following log in IDLE (admittedly, in Python > 2.7.10 and, yes I know that it has been superseded). > > It appears to show a precision tail-off as the supplied float gets bigger. > > I have two questions: >

Re: ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

2023-01-20 Thread Oscar Benjamin
On Fri, 20 Jan 2023 at 17:30, Dino wrote: > > let's say I have this list of nested dicts: > > [ >{ "some_key": {'a':1, 'b':2}}, >{ "some_other_key": {'a':3, 'b':4}} > ] > > I need to turn this into: > > [ >{ "value": "some_key", 'a':1, 'b':2}, >{ "value": "some_other_key", 'a':3,

Re: Does one have to use curses to read single characters from keyboard?

2022-12-11 Thread Oscar Benjamin
On Sun, 11 Dec 2022 at 15:55, Chris Green wrote: > > Is the only way to read single characters from the keyboard to use > curses.cbreak() or curses.raw()? If so how do I then read characters, > it's not at all obvious from the curses documentation as that seems to > think I'm using a GUI in some

Re: Parallel(?) programming with python

2022-08-08 Thread Oscar Benjamin
On Mon, 8 Aug 2022 at 19:01, Andreas Croci wrote: > > tI would like to write a program, that reads from the network a fixed > amount of bytes and appends them to a list. This should happen once a > second. > > Another part of the program should take the list, as it has been filled > so far, every

Re: Why isn't there a built-in product()?

2022-07-07 Thread Oscar Benjamin
On Thu, 7 Jul 2022 at 22:55, Michael F. Stemper wrote: > > sum() is wonderful. > > >>> nums = [1,2,3] > >>> sum(nums) > 6 > >>> product(nums) > Traceback (most recent call last): > File "", line 1, in > NameError: name 'product' is not defined > >>> > > I understand that there

Re: C is it always faster than nump?

2022-02-25 Thread Oscar Benjamin
On Sat, 26 Feb 2022 at 03:10, Dennis Lee Bieber wrote: > > On Fri, 25 Feb 2022 23:06:57 + (UTC), Avi Gross > declaimed the following: > > >I do have to wonder if anyone ever considered adding back enough > >functionality into base Python to make some additions less needed. Is there > >any

Re: C is it always faster than nump?

2022-02-25 Thread Oscar Benjamin
On Fri, 25 Feb 2022 at 23:13, Barry wrote: > > > On 25 Feb 2022, at 23:00, Richard Damon wrote: > > > > On 2/25/22 2:47 PM, Chris Angelico wrote: > >>> On Sat, 26 Feb 2022 at 05:49, Richard Damon > >>> wrote: > >>> On 2/25/22 4:12 AM, BELAHCENE Abdelkader wrote: > Hi, > a lot of

Re: Pypy with Cython

2022-02-03 Thread Oscar Benjamin
On Thu, 3 Feb 2022 at 23:16, Greg Ewing wrote: > > On 4/02/22 5:07 am, Albert-Jan Roskam wrote: > > On Feb 3, 2022 17:01, Dan Stromberg wrote: > > > > What profiler do you recommend > > If it runs for that long, just measuring execution time should > be enough. Python comes with a

Re: Call julia from Python: which package?

2021-12-17 Thread Oscar Benjamin
On Fri, 17 Dec 2021 at 23:11, Chris Angelico wrote: > > On Sat, Dec 18, 2021 at 10:01 AM Oscar Benjamin > wrote: > > > > On Fri, 17 Dec 2021 at 22:40, Chris Angelico wrote: > > > > > > On Sat, Dec 18, 2021 at 9:24 AM Oscar Benjamin > > >

Re: Call julia from Python: which package?

2021-12-17 Thread Oscar Benjamin
On Fri, 17 Dec 2021 at 22:40, Chris Angelico wrote: > > On Sat, Dec 18, 2021 at 9:24 AM Oscar Benjamin > wrote: > > When I timed the result in Julia and in Python I found that the Julia > > code was slower than the Python code. Of course I don't know how to > > optimis

Re: Call julia from Python: which package?

2021-12-17 Thread Oscar Benjamin
On Fri, 17 Dec 2021 at 15:04, Albert-Jan Roskam wrote: > > Hi, > > I have a Python program that uses Tkinter for its GUI. It's rather slow so I > hope to replace many or all of the non-GUI parts by Julia code. Has anybody > experience with this? Any packages you can recommend? I found three >

Re: sum() vs. loop

2021-10-13 Thread Oscar Benjamin
On Mon, 11 Oct 2021 at 23:00, Christian Gollwitzer wrote: > > Am 10.10.21 um 10:49 schrieb Steve Keller: > > I have found the sum() function to be much slower than to loop over the > > operands myself: > > > > def sum_products(seq1, seq2): > > return sum([a * b for a, b in zip(seq1, seq2)])

Re: Different "look and feel" of some built-in functions

2021-10-02 Thread Oscar Benjamin
On Sat, 25 Sept 2021 at 02:11, Oscar Benjamin wrote: > On Sat, 25 Sept 2021 at 02:01, Chris Angelico wrote: > >> On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin >> wrote: >> > >> > On Sat, 25 Sept 2021 at 00:37, Greg Ewing >> > wrote: >>

Re: Different "look and feel" of some built-in functions

2021-09-25 Thread Oscar Benjamin
On Sat, 25 Sept 2021 at 02:16, Chris Angelico wrote: > On Sat, Sep 25, 2021 at 11:11 AM Oscar Benjamin > wrote: > > > > On Sat, 25 Sept 2021 at 02:01, Chris Angelico wrote: > >> > >> On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin > >> wrote: >

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Oscar Benjamin
On Sat, 25 Sept 2021 at 02:01, Chris Angelico wrote: > On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin > wrote: > > > > On Sat, 25 Sept 2021 at 00:37, Greg Ewing > > wrote: > > > I suppose they could be fiddled somehow to make it possible, but > > &g

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Oscar Benjamin
On Sat, 25 Sept 2021 at 00:37, Greg Ewing wrote: > On 25/09/21 10:15 am, Steve Keller wrote: > > BTW, I like how the min() and max() functions allow both ways of being > > called. > > That wouldn't work for set.union and set.intersection, because as > was pointed out, they're actually methods,

Re: on floating-point numbers

2021-09-03 Thread Oscar Benjamin
On Fri, 3 Sept 2021 at 13:48, Chris Angelico wrote: > > On Fri, Sep 3, 2021 at 10:42 PM jak wrote: > > > > Il 03/09/2021 09:07, Julio Di Egidio ha scritto: > > > On Friday, 3 September 2021 at 01:22:28 UTC+2, Chris Angelico wrote: > > >> On Fri, Sep 3, 2021 at 8:15 AM Dennis Lee Bieber > > >>

[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2021-07-02 Thread Oscar Benjamin
Oscar Benjamin added the comment: I was contacted by someone interested in this so I've posted the last version above as a GitHub gist under the MIT license: https://gist.github.com/oscarbenjamin/4c1b977181f34414a425f68589e895d1 -- ___ Python

Re: How Do I Get A Bug In Multiprocessing Fixed?

2021-06-18 Thread Oscar Benjamin
On Fri, 18 Jun 2021 at 15:27, Michael Boom wrote: > The below issue is pretty serious and it is preventing me from using a > system I wrote on a larger scale. How do I get this bug fixed? Thanks. > https://bugs.python.org/issue43329 On Fri, 18 Jun 2021 at 06:07, Alexander Neilson wrote: > >

[issue43602] Include Decimal's in numbers.Real

2021-04-16 Thread Oscar Benjamin
Oscar Benjamin added the comment: I've never found numbers.Real/Complex to be useful. The purpose of the ABCs should be that they enable you to write code that works for instances of any subclass but in practice writing good floating point code requires knowing something e.g. the base

Re: True is True / False is False?

2020-07-22 Thread Oscar Benjamin
On Wed, 22 Jul 2020 at 02:12, Chris Angelico wrote: > > On Wed, Jul 22, 2020 at 11:04 AM Tim Chase > wrote: > > > > I know for ints, cpython caches something like -127 to 255 where `is` > > works by happenstance based on the implementation but not the spec > > (so I don't use `is` for comparison

[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-19 Thread Oscar Benjamin
Oscar Benjamin added the comment: Yeah, I guess it's a YAGNI. Thanks Raymond and Tim for looking at this! -- ___ Python tracker <https://bugs.python.org/issue41

Re: A Python installation help doc much more friendly to newcomers? [Was Re: help]

2020-07-18 Thread Oscar Benjamin
On Sat, 18 Jul 2020 at 05:39, dn via Python-list wrote: > > On 18/07/20 3:29 PM, boB Stepp wrote: > > On Fri, Jul 17, 2020 at 9:48 PM dn via Python-list > > wrote: > >> > >> On 18/07/20 1:53 PM, Castillo, Herbert S wrote: > >>> I downloaded python not to long ago, and today when I opened Python

[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-18 Thread Oscar Benjamin
Oscar Benjamin added the comment: > Please don't get personal. Sorry, that didn't come across with the intended tone :) I agree that this could be out of scope for the random module but I wanted to make sure the reasons were considered. Reading between the lines I get the impress

[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-17 Thread Oscar Benjamin
Oscar Benjamin added the comment: > At its heart, this a CPython optimization to take advantage of list() being > slower than a handful of islice() calls. This comment suggest that you have missed the general motivation for reservoir sampling. Of course the stdlib can not satisfy a

[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-17 Thread Oscar Benjamin
Oscar Benjamin added the comment: All good points :) Here's an implementation with those changes and that shuffles but gives the option to preserve order. It also handles the case W=1.0 which can happen at the first step with probability 1 - (1 - 2**53)**k. Attempting to preserve order

[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-16 Thread Oscar Benjamin
Oscar Benjamin added the comment: To be clear I suggest that this could be a separate function from the existing sample rather than a replacement or a routine used internally. The intended use-cases for the separate function are: 1. Select from something where you really do not want

[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-15 Thread Oscar Benjamin
New submission from Oscar Benjamin : The random.choice/random.sample functions will only accept a sequence to select from. Can there be a function in the random module for selecting from an arbitrary iterable? It is possible to make an efficient function that can make random selections from

Re: Help with installation please

2020-05-17 Thread Oscar Benjamin
On Sun, 17 May 2020 at 15:21, Mats Wichmann wrote: > > On 5/15/20 9:47 PM, Souvik Dutta wrote: > > I dont know if you should shift from powershell to cmd. Python kinda does > > not work in powershell. > > Powershell has a funky way of looking up programs, with the result that > you have to type

Re: To apply pca for a large csv

2020-04-14 Thread Oscar Benjamin
On Tue, 14 Apr 2020 at 12:42, Rahul Gupta wrote: > > Hello all, i have a csv of 1 gb which consists of 25000 columns and 2 > rows. I want to apply pca so i have seen sciki-learn had inbuilt > fucntionality to use that. But i have seen to do eo you have to load data in > data frame. But my

Re: on sorting things

2019-12-18 Thread Oscar Benjamin
On Thu, 19 Dec 2019 at 07:37, Eli the Bearded <*@eli.users.panix.com> wrote: > ... > But what caught my eye most, as someone relatively new to Python but > with long experience in C in Perl, is sorting doesn't take a > *comparison* function, it takes a *key generator* function, and that > function

Re: OOP - how to abort an __init__ when the initialisation code fails ?

2019-11-06 Thread Oscar Benjamin
On Tue, 5 Nov 2019 at 21:52, Gregory Ewing wrote: > > Peter J. Holzer wrote: > > On 2019-11-04 18:18:39 -0300, Luciano Ramalho wrote: > > > > Or maybe don't catch it here at all but just let it bubble up until it > > hits a level where dealing with it makes sense from the user's point of > > view

Re: __init__ is not invoked

2019-09-26 Thread Oscar Benjamin
On Thu, 26 Sep 2019 at 13:39, Rhodri James wrote: > > On 26/09/2019 13:20, ast wrote: > > > > >>> class ClassB(object): > > ... def __new__(cls, arg): > > ... print('__new__ ' + arg) > > ... return object > > ... def __init__(self, arg): > > ... print('__init__ '

Re: __init__ is not invoked

2019-09-26 Thread Oscar Benjamin
On Thu, 26 Sep 2019 at 14:19, Peter Otten <__pete...@web.de> wrote: > > __init__ is called only if __new__ returns an instance of ClassB: > > """ > /* If the returned object is not an instance of type, >it won't be initialized. */ > if (!PyType_IsSubtype(Py_TYPE(obj), type)) >

Re: itertools product(infinite iterator) hangs

2019-09-15 Thread Oscar Benjamin
On Sat, 14 Sep 2019 at 07:22, ast wrote: > > Le 14/09/2019 à 04:26, Oscar Benjamin a écrit : > > > > What am I missing? > > here is a pseudo code for product: > > def product(*args, repeat=1): > # product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy >

Re: itertools product(infinite iterator) hangs

2019-09-15 Thread Oscar Benjamin
On Sat, 14 Sep 2019 at 03:26, Oscar Benjamin wrote: > > I've been staring at this for a little while: > > from itertools import product > > class Naturals: > def __iter__(self): > i = 1 > while True: > yield i > i += 1

itertools product(infinite iterator) hangs

2019-09-13 Thread Oscar Benjamin
I've been staring at this for a little while: from itertools import product class Naturals: def __iter__(self): i = 1 while True: yield i i += 1 N = Naturals() print(iter(N)) print(product(N)) # <--- hangs When I run the above the call to product

Re: python package management confusion

2019-01-20 Thread Oscar Benjamin
On Sun, 20 Jan 2019 at 21:12, dcs3spp via Python-list wrote: > > Pip 18.1 supports reading pep508 direct urls from install_requires. In future > release there are plans to deprecate the --process-dependency-links pip > install option: > - https://github.com/pypa/pip/issues/4187 > -

[issue20479] Efficiently support weight/frequency mappings in the statistics module

2019-01-20 Thread Oscar Benjamin
Oscar Benjamin added the comment: Sorry, sent too soon... > Matlab doesn't support even weighted mean as far as I can tell. There > is wmean on the matlab file exchange: https://stackoverflow.com/a/36464881/9450991 This is a separate function `wmean(data, weights)`. It has to be a se

[issue20479] Efficiently support weight/frequency mappings in the statistics module

2019-01-20 Thread Oscar Benjamin
Oscar Benjamin added the comment: > I would find it very helpful if somebody has time to do a survey of > other statistics libraries or languages (e.g. numpy, R, Octave, Matlab, > SAS etc) and see how they handle data with weights. Numpy has only sporadic support for this. The stan

Re: python package management confusion

2019-01-20 Thread Oscar Benjamin
On Sun, 20 Jan 2019 at 16:22, dcs3spp via Python-list wrote: > > On Saturday, 19 January 2019 11:17:19 UTC, dcs3spp wrote: > > > > My question is, can setuptools be configured to pull in child from a > > separate git repository when running python setup.py develop from parent > > folder? I

Re: Mask two images with python

2018-12-21 Thread Oscar Benjamin
On Fri, 21 Dec 2018 at 09:32, Umar Yusuf wrote: > > On Wednesday, 19 December 2018 19:22:51 UTC+1, Oscar Benjamin wrote: > > On Wed, 19 Dec 2018 at 05:42, Umar Yusuf wrote: > > > > > > Hello there, > > > How do I supper impose an image design on a transpar

Re: Mask two images with python

2018-12-19 Thread Oscar Benjamin
On Wed, 19 Dec 2018 at 05:42, Umar Yusuf wrote: > > Hello there, > How do I supper impose an image design on a transparent png image? > > I have tried to use OpenCV's "cv2.bitwise_and" function to no success. I > posted the detail question here: >

Re: clusters of numbers

2018-12-15 Thread Oscar Benjamin
On Sun, 16 Dec 2018 at 01:47, Marc Lucke wrote: > > hey guys, > > I have a hobby project that sorts my email automatically for me & I want > to improve it. There's data science and statistical info that I'm > missing, & I always enjoy reading about the pythonic way to do things too. > > I have a

Re: polar coordinates?

2018-12-09 Thread Oscar Benjamin
On Sun, 9 Dec 2018 at 16:37, Brian Christiansen wrote: > > I have been messing with a program that is inspried by a video on > youtube that is about the vizualization of pi. I might make a post > about that program someday, but I want to talk about something else. > One of the ways of

Re: Import module from file path

2018-12-05 Thread Oscar Benjamin
On Wed, 5 Dec 2018 at 07:57, Peter Otten <__pete...@web.de> wrote: > > Oscar Benjamin wrote: > > > > I'm looking to import a module given a string representing the path to > > the .py file defining the module. > > I am not aware of a clean way. I have us

Import module from file path

2018-12-04 Thread Oscar Benjamin
Hi all, I'm looking to import a module given a string representing the path to the .py file defining the module. For example given this setup mkdir -p a/b/c touch a/__init__.py touch a/b/__init__.py touch a/b/c/__init__.py touch a/b/c/stuff.py I have a module a.b.c.stuff which is defined in the

Re: Need to find the centroid of a circular camera image

2018-09-23 Thread Oscar Benjamin
On Sun, 23 Sep 2018 at 20:45, Gene Heskett wrote: > > save the image and locate the centroid of that saved image. > > Is there code to do that centroid math in somebodies "bottom desk > drawer"? Something I could download and control with a bash script which > I'm fair at? This is easy enough to

Re: Why emumerated list is empty on 2nd round of print?

2018-09-07 Thread Oscar Benjamin
On Fri, 7 Sep 2018 at 16:25, Schachner, Joseph wrote: >... > Now, on to the second part: the problem you showed - that you can only loop > through aList:print(i,j) once - is BECAUSE you hung onto it from one loop to > another. Once the iterator is exhausted, it's exhausted. > > Think of

Re: Debug script under pdb, how to avoid a bunch of errors caused by the exit()?

2018-09-06 Thread Oscar Benjamin
On Thu, 6 Sep 2018 at 10:59, Jach Fong wrote: > > Here the script file, test0.py: > -- > password = 'bad' > if password == 'bad': > print('bad password') > exit() > else: > print('good password') > > print('something else to do') >

Re: Question about floating point

2018-08-29 Thread Oscar Benjamin
On Tue, 28 Aug 2018 at 15:50, Frank Millman wrote: > > "Frank Millman" wrote in message news:pm3l2m$kv4$1...@blaine.gmane.org... > > > > I know about this gotcha - > > > > >>> x = 1.1 + 2.2 > > >>> x > > 3.3003 > > > [...] > > > > >>> y = 3.3 > > >>> y > > 3.3 > > > [...] > > > > >>>

Re: Writing a program to illustrate a fractal

2018-08-26 Thread Oscar Benjamin
On Sun, 26 Aug 2018 at 20:52, Musatov wrote: > > Thank you, Richard. If anyone is interested further, even in writing a Python > code to generate the sequence or further preparing of an animation I would be > delighted. It would not take long to write code to plot your sequence if you first

Re: Generating a specific list of intsgers

2018-08-26 Thread Oscar Benjamin
On Sun, 26 Aug 2018 at 20:32, Musatov wrote: > > On Sunday, August 26, 2018 at 2:14:29 PM UTC-5, Oscar Benjamin wrote: > > > > > > > >> On Fri, 24 Aug 2018 14:40:00 -0700, tomusatov wrote: > > > > > > > >> > > > &g

Re: Generating a specific list of intsgers

2018-08-26 Thread Oscar Benjamin
On Sat, 25 Aug 2018 at 20:27, Musatov wrote: > > On Saturday, August 25, 2018 at 2:18:09 PM UTC-5, Musatov wrote: > > On Saturday, August 25, 2018 at 1:52:17 PM UTC-5, Oscar Benjamin wrote: > > > > > > > > > > > >> On Fri, 24 Aug 2018 14:40:00 -

Re: Generating a specific list of intsgers

2018-08-25 Thread Oscar Benjamin
On Sat, 25 Aug 2018 at 18:12, wrote: > > On Saturday, August 25, 2018 at 9:46:21 AM UTC-5, Richard Damon wrote: > > On 8/25/18 10:27 AM, Dennis Lee Bieber wrote: > > > On Sat, 25 Aug 2018 03:56:28 + (UTC), Steven D'Aprano > > > declaimed the following: > > > > > >> On Fri, 24 Aug 2018

Re: Partitioning a list

2018-08-23 Thread Oscar Benjamin
On Thu, 23 Aug 2018 at 15:32, Sibylle Koczian wrote: > > Am 21.08.2018 um 23:36 schrieb Poul Riis: > > I would like to list all possible ways to put N students in groups of k > > students (suppose that k divides N) with the restriction that no two > > students should ever meet each other in

Re: Dealing with errors in interactive subprocess running python interpreter that freeze the process

2018-08-03 Thread Oscar Benjamin
On 2 August 2018 at 20:54, wrote: > >> As others have mentioned, separate threads for the individual pipes >> may help, or if you need to go that far there are specialised >> libraries, I believe (pexpect is one, but from what I know it's fairly >> Unix-specific, so I'm not very familiar with

Re: Obtain the raw line of text read by CSVDictReader when reporting errors?

2016-09-21 Thread Oscar Benjamin
On 21 September 2016 at 21:28, Malcolm Greene wrote: > Looking for ideas on how I can obtain the raw line of text read by a > CSVDictReader. I've reviewed the CSV DictReader documentation and there > are no public attributes that expose this type of data. > > My use case is

Re: Why doesn't my finaliser run here?

2016-09-04 Thread Oscar Benjamin
On 4 Sep 2016 13:27, "Steve D'Aprano" wrote: > > Why doesn't __del__ run here? > > > class Eggs(object): > def __new__(cls): > instance = object.__new__(cls) > print("instance created successfully") > return instance > def

Re: Unexpected NANs in complex arithmetic

2016-06-22 Thread Oscar Benjamin
On 22 June 2016 at 08:14, Antoon Pardon wrote: > Op 22-06-16 om 04:48 schreef Steven D'Aprano: >> I'm doing some arithmetic on complex numbers involving INFs, and getting >> unexpected NANs. >> >> py> INF = float('inf') >> py> z = INF + 3j >> py> z >> (inf+3j) >> py>

Re: Python on Windows with linux environment

2016-06-02 Thread Oscar Benjamin
On 2 June 2016 at 12:22, Muhammad Ali wrote: > I use windows regularly, however, I use linux for only my research work at > supercomputer. In my research field (materials science) most of the scripts > are being written in python with linux based system. Could I

Re: setrecursionlimit

2016-05-19 Thread Oscar Benjamin
On 18 May 2016 at 17:11, Steven D'Aprano wrote: > The documentation for setrecursion limit warns against setting the limit too > high: > > [quote] > The highest possible limit is platform-dependent. A user may need to > set the limit higher when they have a

Re: Optimizing Memory Allocation in a Simple, but Long Function

2016-04-26 Thread Oscar Benjamin
On 25 April 2016 at 15:35, Derek Klinge wrote: > > Although I see the value of relative error, I am just as interested in > absolute error (though admittedly they are directly related values). I was referring to relative error because the relative error is the same at each

Re: Optimizing Memory Allocation in a Simple, but Long Function

2016-04-25 Thread Oscar Benjamin
On 25 April 2016 at 08:39, Gregory Ewing wrote: > Derek Klinge wrote: >> >> Also, it seems to me if the goal is to use the smallest value of n to get >> a >> particular level of accuracy, changing your guess of N by doubling seems >> to >> have a high chance of

Re: Optimizing Memory Allocation in a Simple, but Long Function

2016-04-24 Thread Oscar Benjamin
On 24 April 2016 at 19:21, Chris Angelico wrote: > On Mon, Apr 25, 2016 at 4:03 AM, Derek Klinge wrote: >> Ok, from the gmail web client: > > Bouncing this back to the list, and removing quote markers for other > people's copy/paste convenience. > > ##

Re: Detecting repeated subsequences of identical items

2016-04-21 Thread Oscar Benjamin
On 21 April 2016 at 15:12, Chris Angelico <ros...@gmail.com> wrote: > On Fri, Apr 22, 2016 at 12:01 AM, Oscar Benjamin > <oscar.j.benja...@gmail.com> wrote: >> In the recursive stack overflow case what you'll usually have is >> >> 1) A few frames leading up to

Re: Detecting repeated subsequences of identical items

2016-04-21 Thread Oscar Benjamin
On 21 April 2016 at 13:15, Steven D'Aprano <st...@pearwood.info> wrote: > On Thu, 21 Apr 2016 06:53 pm, Oscar Benjamin wrote: > >> On 21 April 2016 at 04:07, Steven D'Aprano <st...@pearwood.info> wrote: >>> I want to group repeated items in a sequence. For

Re: Detecting repeated subsequences of identical items

2016-04-21 Thread Oscar Benjamin
On 21 April 2016 at 04:07, Steven D'Aprano wrote: > I want to group repeated items in a sequence. For example, I can group > repeated sequences of a single item at a time using groupby: > > > from itertools import groupby > for key, group in groupby("BBCDDEEE"): >

Re: Failed install scipy lib

2016-04-20 Thread Oscar Benjamin
On 20 April 2016 at 12:30, <liran.maym...@gmail.com> wrote: > On Wednesday, April 20, 2016 at 2:09:10 PM UTC+3, liran@gmail.com wrote: >> On Tuesday, April 19, 2016 at 9:21:42 PM UTC+3, eryk sun wrote: >> > On Tue, Apr 19, 2016 at 12:05 PM, Oscar Benjamin >>

Re: Guido sees the light: PEP 8 updated

2016-04-20 Thread Oscar Benjamin
On 20 April 2016 at 02:38, Steven D'Aprano wrote: > > "Oh no! We're having trouble displaying this Scratch project. > > If you are on a mobile phone or tablet, try visiting this project on a > computer. > > If you're on a computer, your Flash player might be disabled,

Re: Guido sees the light: PEP 8 updated

2016-04-20 Thread Oscar Benjamin
On 20 April 2016 at 07:08, Terry Reedy wrote: > On 4/19/2016 11:41 PM, Chris Angelico wrote: >> >> On Wed, Apr 20, 2016 at 1:23 PM, Terry Reedy wrote: It kinda looks like Hypertalk syntax, which some of you may remember I'm exceedingly fond of.

Re: Failed install scipy lib

2016-04-19 Thread Oscar Benjamin
On 19 Apr 2016 17:01, wrote: > > Hello, > i'm trying to use: > "py -m pip install scipy" > and after couple of lines a get an error saying: I thought that binary wheels for scipy would be available on pypi for each OS now. Try updating pip and then using it to install

Re: Python2.7 win64 --- cannot install the package of scipy

2016-04-18 Thread Oscar Benjamin
On 16 April 2016 at 22:53, wrote: > I failed to install the package of scipy on Python2.7(win64). > > 1. I tried the direct way that use cmd--pip install scripy. The result shows > that it failed with error code 1 in > c:\tyk\appdata\local\temp\pip-build-an9fye\scipy\.

Re: scipy install error,need help its important

2016-04-18 Thread Oscar Benjamin
On 18 April 2016 at 08:38, Xristos Xristoou wrote: > Τη Δευτέρα, 18 Απριλίου 2016 - 6:53:30 π.μ. UTC+3, ο χρήστης Xristos Xristoou > έγραψε: >> guys i have big proplem i want to install scipy >> but all time show me error >> i have python 2.7 and windows 10 >> i try to use pip

Re: help install numpy and scipy in window 7 and 3.5.0 shell

2016-04-15 Thread Oscar Benjamin
On 15 April 2016 at 17:29, wrote: >> On Apr 15, 2016 10:40 AM, wrote: >> > >> > I have downloaded the numpy-1.11.01 and scipy-0.17.0 but after running >> setup files over IDLE in numpy and scipy, it still can not get through. Can >> someone give me a hand?

Re: sum accuracy

2016-04-15 Thread Oscar Benjamin
On 15 April 2016 at 11:10, Ben Bacarisse <ben.use...@bsb.me.uk> wrote: > Oscar Benjamin <oscar.j.benja...@gmail.com> writes: > >> On 15 April 2016 at 10:24, Robin Becker <ro...@reportlab.com> wrote: > >>> yes indeed summation is hard :( >> >

Re: Python garbage collection: not releasing memory to OS!

2016-04-15 Thread Oscar Benjamin
On 15 April 2016 at 11:25, wrote: > The input was a 4MB file. Even after returning from the 'fileopen' function > the 4MB memory was not released. I checked htop output while the loop was > running, the resident memory stays at 14MB. So unless the process is stopped > the

Re: sum accuracy

2016-04-15 Thread Oscar Benjamin
On 15 April 2016 at 10:24, Robin Becker wrote: > On 13/04/2016 18:05, Random832 wrote: > . >> >> >> No, it doesn't. Sum works on any type that can be added (except >> strings), it can't make any assumptions about the characteristics of >> floating point types. For

Re: numpy arrays

2016-04-07 Thread Oscar Benjamin
On 7 April 2016 at 15:31, Heli wrote: > > Thanks a lot Oscar, > > The lexsort you suggested was the way to go. Glad to hear it. > import h5py > import numpy as np > f=np.loadtxt(inputFile,delimiter=None) > xcoord=np.sort(np.unique(f[:,0])) > ycoord=np.sort(np.unique(f[:,1]))

Re: Install request

2016-04-07 Thread Oscar Benjamin
On 6 April 2016 at 05:08, Rustom Mody <rustompm...@gmail.com> wrote: > On Wednesday, April 6, 2016 at 4:34:11 AM UTC+5:30, Steven D'Aprano wrote: >> On Wed, 6 Apr 2016 02:52 am, Rustom Mody wrote: >> >> > On Tuesday, April 5, 2016 at 9:49:58 PM UTC+5:30, Oscar

Re: numpy arrays

2016-04-07 Thread Oscar Benjamin
On 6 April 2016 at 17:26, Heli wrote: > > Thanks for your replies. I have a question in regard with my previous > question. I have a file that contains x,y,z and a value for that coordinate > on each line. Here I am giving an example of the file using a numpy array > called

Re: Install request

2016-04-05 Thread Oscar Benjamin
On 5 April 2016 at 16:56, Igor Korot wrote: > > So, here is my request: if its not possible to include the DLL in > question in the installer, > can the installer check for the OS version and ask the user to go to > Microsoft.com, > download and install the library? That's a

Re: python script for .dat file

2016-04-05 Thread Oscar Benjamin
On 5 April 2016 at 16:44, Muhammad Ali wrote: > On Tuesday, April 5, 2016 at 8:30:27 AM UTC-7, Joel Goldstick wrote: >> On Tue, Apr 5, 2016 at 11:23 AM, Muhammad Ali >> wrote: >> > >> > Could any body tell me a general python script to

Re: Request to mailing list Python-list rejected

2016-04-05 Thread Oscar Benjamin
On 5 Apr 2016 03:50, wrote: > > Your request to the Python-list mailing list > > Posting of your message titled "Re: Plot/Graph" > > has been rejected by the list moderator. The moderator gave the > following reason for rejecting your request: > > "Your message

  1   2   3   4   5   6   7   >