Re: Friday Finking: Contorted loops

2021-09-10 Thread Alan Gauld via Python-list
e with a loop. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos -- https://mail.python.org/mailman/listinfo/python-list

Re: Change the display style of the text on the STACKLINE.

2021-09-10 Thread Roland Mueller via Python-list
inal understands unicode, Combining Low Line: U+0332 > might help > > > The problem was to get the string to this mail. In my terminal it was OK. -- https://mail.python.org/mailman/listinfo/python-list

RE: Friday Finking: Contorted loops

2021-09-10 Thread Avi Gross via Python-list
over and over for "if" statements and perhaps some kind of case/switch statement and while loops and so on, may be parsimonious but ... -Original Message- From: Python-list On Behalf Of Alan Gauld via Python-list Sent: Friday, September 10, 2021 11:58 AM To: python-list@pytho

RE: Friday Finking: Contorted loops

2021-09-10 Thread Avi Gross via Python-list
age and still fail. Throw in the reality that your loop may use variable manipulated in parallel by other threads and that your thread may be killed as it runs and I wonder. -Original Message- From: Python-list On Behalf Of Greg Ewing Sent: Friday, September 10, 2021 2:40 AM To: py

ANN: Version 0.5.1 of the Python config module has been released.

2021-09-11 Thread Vinay Sajip via Python-list
doesn’t allow trailing commas in lists and mappings. * JSON doesn’t provide easy cross-referencing, interpolation, or composition. The Python config module provides an interface to work with configuration files written in the CFG format. Comprehensive documentation is available at https://docs.red

Re: Friday Finking: Contorted loops

2021-09-11 Thread Alan Gauld via Python-list
cher. I'm not sure that's true. Most beginners, in my experience, learn the syntax from their teachers and then go off and play. What they observe happening is what sticks. And python loop 'else' constructs appear inconsistent to them. As teachers we like to think we are pass

RE: Friday Finking: Contorted loops

2021-09-11 Thread Avi Gross via Python-list
imply that ELSE is a grab bag case that can mean many things to many people. But if the specific meaning is clearly documented, use it. Lots of people who program in languages like Python do not necessarily even speak much English and just memorize the keywords. We can come up with ever more inter

RE: Friday Finking: Contorted loops

2021-09-11 Thread Avi Gross via Python-list
often an example of this happening. So if you looked at your own code now, in the context of the rest of your code, would you change things? in python, I suspect I would seriously change an amazing number of things for older code including code being ported. It supports quite a few programming

Re: Friday Finking: Contorted loops

2021-09-12 Thread Alan Gauld via Python-list
f times. But in Pascal I use it regularly. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos -- https://mail.python.org/mailman/listinfo/python-list

RE: Friday Finking: Contorted loops

2021-09-12 Thread Avi Gross via Python-list
stored in a null-terminated array and the accepted way to copy it might be to use pointers called p (the source) and q(the destination) in weird and compact code like: while (*q++ = *p++); Now Python does not have some of those operators but copying strings is fairly trivial with no visible

RE: Friday Finking: Contorted loops

2021-09-12 Thread Avi Gross via Python-list
needs to do things in the current environment and thus only part of the functionality can be moved away. -Original Message- From: Python-list On Behalf Of Stefan Ram Sent: Saturday, September 11, 2021 10:56 PM To: [email protected] Subject: Re: Friday Finking: Contorted loops &quo

Re: ANN: Version 0.5.1 of the Python config module has been released.

2021-09-12 Thread Vinay Sajip via Python-list
hat's good enough for me :-) On Sunday, 12 September 2021, 18:11:21 BST, Abdur-Rahmaan Janhangeer wrote: Used by 4.8k but only ... 4 stars -- https://mail.python.org/mailman/listinfo/python-list

RE: Friday Finking: Contorted loops

2021-09-12 Thread Avi Gross via Python-list
power can come great responsibility to use it well and make sure others can figure it out. -Original Message----- From: Python-list On Behalf Of Peter J. Holzer Sent: Sunday, September 12, 2021 4:49 PM To: [email protected] Subject: Re: Friday Finking: Contorted loops On 2021-09-12 10:2

Re: Friday Finking: Contorted loops

2021-09-12 Thread Alan Gauld via Python-list
dead code (possibly emitting a warning in the process?). A linter likewise might identify the redundant code. I don't use any python linters, does anyone know if they do detect such dead spots? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/au

RE: Friday Finking: Contorted loops

2021-09-13 Thread Avi Gross via Python-list
ething, such as an object like a deque, you get to know it so well that you may stop commenting on how you are using some built-in feature as it seems routine. -Original Message- From: Python-list On Behalf Of Peter J. Holzer Sent: Monday, September 13, 2021 3:28 PM To: python-list@pyth

RE: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-16 Thread Avi Gross via Python-list
programming languages. They are not sentient and cannot be asked to solve much of anything. So is the question whether someone can program using only Python to solve an arbitrary sudoku problem? Short answer is you can do that in just about ANY language. I mean by brute force, if you have a 9 by 9 matrix

Re: Question again

2021-09-16 Thread Alan Gauld via Python-list
On 16/09/2021 06:50, af kh wrote: > Hello, > I was doing some coding on a website called replit I have no idea what that is but... > after answering 'no' or 'yes' after the last sentence I wrote, > the Python window shut off, That's what you told it t

RE: Question again

2021-09-16 Thread Avi Gross via Python-list
- From: Python-list On Behalf Of Alan Gauld via Python-list Sent: Thursday, September 16, 2021 8:11 PM To: [email protected] Subject: Re: Question again On 16/09/2021 06:50, af kh wrote: > Hello, > I was doing some coding on a website called replit I have no idea what that

How to "cast" an object to a derived class?

2021-09-18 Thread Robert Latest via Python-list
at # class def __init__(self, *a, **k): super().__init__(*a, *k) self.__something = 0 def get_something(self): return self.something op = opaque.make_opaque() # But I want to have this as type MyClass. This obviously doesn't work: my_object = MyClass(op) # But what does? -- https://mail.python.org/mailman/listinfo/python-list

Re: How to "cast" an object to a derived class?

2021-09-18 Thread Robert Latest via Python-list
l.etree.ElemenTree and .Element to circumvent its idiotic namespace handling. For that I need inheritance since I want to override the find..() functions to return my derived MyElement classes. I think it could work but I somehow need to convert the root Element to a MyElement. -- https://mail.python.org/mailman/listinfo/python-list

Re: Inheriting from str

2021-09-20 Thread Jon Ribbens via Python-list
st): File "", line 1, in AttributeError: 'str' object has no attribute 'jam' >>> class foo(str): pass ... >>> s = foo('hello') >>> s.jam = 3 >>> s.jam 3 There's a lot of places in Python where you can break sta

Re: XML Considered Harmful

2021-09-21 Thread Jon Ribbens via Python-list
On 2021-09-21, Michael F. Stemper wrote: > On the prolog thread, somebody posted a link to: ><https://dirtsimple.org/2004/12/python-is-not-java.html> > > One thing that it tangentially says is "XML is not the answer." > > I read this page right when I was abo

Re: XML Considered Harmful

2021-09-21 Thread Jon Ribbens via Python-list
tools. In JSON all that checking is entirely > handled by the consuming program(s). That's not true. You can use "JSON Schema" to create a schema for validating JSON files, and there appear to be at least four implementations in Python. -- https://mail.python.org/mailman/listinfo/python-list

Re: Free OCR package in Python and selecting appropriate widget for the GUI

2021-09-22 Thread Roland Mueller via Python-list
Hello, ti 21. syysk. 2021 klo 16.53 Mohsen Owzar ([email protected]) kirjoitti: > Hi Guys > Long time ago I've written a program in Malab a GUI for solving Sudoku > puzzles, which worked not so bad. > Now I try to write this GUI with Python with PyQt5 or TKinter. > Fir

ANN: distlib 0.3.3 released on PyPI

2021-09-22 Thread Vinay Sajip via Python-list
a version. Thanks to Blazej   Floch for the report and suggested fix. * Fixed #150: Fix incorrect handling of epochs. * Reverted handling of tags for Python >= 3.10 (use 310 rather than 3_10). This is   because PEP 641 was rejected. * Added a GitHub Actions workflow to perform tests. A more de

RE: XML Considered Harmful

2021-09-23 Thread Avi Gross via Python-list
well be a fairly slow and even error-prone way to solve a problem. -Original Message----- From: Python-list On Behalf Of Chris Angelico Sent: Thursday, September 23, 2021 9:27 AM To: Python Subject: Re: XML Considered Harmful On Thu, Sep 23, 2021 at 10:55 PM Mats Wichmann wrote: > >

RE: XML Considered Harmful

2021-09-23 Thread Avi Gross via Python-list
more like that? -Original Message- From: Python-list On Behalf Of Stefan Ram Sent: Thursday, September 23, 2021 5:43 PM To: [email protected] Subject: Re: XML Considered Harmful "Avi Gross" writes: >But scientific papers seemingly allow oodles of authors and any time

Re: XML Considered Harmful

2021-09-23 Thread Jon Ribbens via Python-list
rmats are also available ;-) -- https://mail.python.org/mailman/listinfo/python-list

Type annotation pitfall

2021-09-23 Thread Robert Latest via Python-list
= Foo('abc') print(foo.x) # prints '{'abc'} -- https://mail.python.org/mailman/listinfo/python-list

Re: XML Considered Harmful

2021-09-23 Thread Mike Dewhirst via Python-list
efore pontificating.Then I would ignore any potential future enhancements and choose the easiest possible mechanism. I have used json with python and been delighted at the ease of converting data into dicts and even arbitrary nesting where data values can also be dicts etc.Good luck--(Unsigned mail from my

Re: XML Considered Harmful

2021-09-24 Thread Jon Ribbens via Python-list
On 2021-09-24, Chris Angelico wrote: > On Sat, Sep 25, 2021 at 8:53 AM dn via Python-list > wrote: >> On 25/09/2021 06.59, Peter J. Holzer wrote: >> > CSV: Good for tabular data of a single data type (strings). As soon as >> > there's a second data type (numb

Re: XML Considered Harmful

2021-09-25 Thread Jon Ribbens via Python-list
On 2021-09-25, Peter J. Holzer wrote: > On 2021-09-24 23:32:47 -, Jon Ribbens via Python-list wrote: >> JSON Schema provides a way to denote composite types. > > I probably wasn't clear what I meant. In XML, every element has a tag, > which is basically its type. So by

Could not initilalize crash reporting DB

2021-09-25 Thread Sir Real via Python-list
https://mail.python.org/mailman/listinfo/python-list

RE: XML Considered Harmful

2021-09-25 Thread Avi Gross via Python-list
thers have already produced the data using other tools, in which case you have to read it in at least once/ -Original Message- From: Python-list On Behalf Of Michael F. Stemper Sent: Saturday, September 25, 2021 4:20 PM To: [email protected] Subject: Re: XML Considered Harmful O

RE: XML Considered Harmful

2021-09-27 Thread Avi Gross via Python-list
re typical use of "generator" as used in python in which some code sort of runs as needed to keep generating the next item to work on. Do you mean something that creates realistic test cases to simulate a real-word scenario? These often can create everything at once and often based on rando

RE: XML Considered Harmful

2021-09-28 Thread Avi Gross via Python-list
I replied to Michael privately but am intrigued by his words here: "The thing that creates realistic test cases is my brain." I consider extensions to my brain to include using a language like Python on my computer and in particular, to take a model I think of and instantiate it. Lots

RE: XML Considered Harmful

2021-09-28 Thread Avi Gross via Python-list
Well, Michael, if you want to go back to the eighties, and people you worked with, I did my Thesis with a professor who later had an Erdős number of 1! Too bad I never got around to publishing something with him or I could have been a 2! But that work, being so long ago, was not in Python but

RE: XML Considered Harmful

2021-09-28 Thread Avi Gross via Python-list
spoke including Hungarian and Math. Well, time to get back to something remotely about Python. Is there any concept of a Rossum Number where anyone who worked directly with Guido Van Rossum is a 1 (or True or truthy) and ... Hey I just realized my Berners-Lee number might be 1 but it was so long ago

RE: XML Considered Harmful

2021-09-29 Thread Avi Gross via Python-list
does Python have? [] - list comprehension {} - dictionary OR set comprehension () - generator expression Tuples are incomprehensible and I wonder if any other comprehensions might make sense to add, albeit we may need new symbols. -Original Message- From: Python-list On Behalf Of Michael

Re: OT: AttributeError

2021-09-29 Thread Rob Cliffe via Python-list
+1000, Chris Angelico wrote: On Wed, Sep 29, 2021 at 9:10 AM <[email protected]> wrote: On 2021-09-29 at 11:38:22 +1300, dn via Python-list wrote: For those of us who remember/can compute in binary, octal, hex, or decimal as-needed: Why do programmers confuse

RE: How to pass a method as argument?

2021-09-30 Thread Avi Gross via Python-list
Sounds like an excellent homework question. But your method of using an object is not what first comes to mind based on your cursory description. There is a python idiom using functional programming that looks like this: def doit(a, b, fun): return(fun(a,b)) So make up your own

pythonpapers.org domain name to lapse in November

2021-10-04 Thread Mike Dewhirst via Python-list
The board of editors of the Python Papers has decided to let the pythonpapers.org domain name to lapse. It will not be renewed in November. Anyone interested in it can get in touch. Cheers Mike -- Signed email is an absolute defence against phishing. This email has been signed with my

Big jump in version

2021-10-05 Thread Cecil Westerhof via Python-list
updated pyzstd for a long time, because that breaks py7zr which needs a version lower as 0.15.0. Any chance that py7zr is going to be updated? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

RE: Understanding the working mechanis of python unary arithmetic operators.

2021-10-05 Thread Avi Gross via Python-list
another. Here are examples I just typed: +1 1 +1 1 +-+-+-1 -1 ---1 -1 --1 1 Luckily since Python has no ++ or -- pre or post operators, these are legal, albeit a tad weird. -Original Message- From: Python-list On Behalf Of dn via Python-list Sent: Tuesday, October 5, 2021 7:11 PM To

Re: Big jump in version

2021-10-07 Thread Cecil Westerhof via Python-list
Grant Edwards writes: > On 2021-10-04, Cecil Westerhof via Python-list wrote: >> When I run: >> pip3 list --outdated >> >> I get: >> Package Version Latest Type >> --- -- - >> cryptography 3.4.8 35.0.0

RE: Re: sum() vs. loop

2021-10-12 Thread Avi Gross via Python-list
. -Original Message- From: Python-list On Behalf Of Alan Gauld Sent: Tuesday, October 12, 2021 6:56 PM To: [email protected] Subject: Fwd: Re: sum() vs. loop On 10/10/2021 09:49, Steve Keller wrote: > I have found the sum() function to be much slower than to loop over > the op

RE: sum() vs. loop

2021-10-13 Thread Avi Gross via Python-list
worry the original might be changed out from under. My apologies if it was understood to mean I had shown it was copied. -Original Message- From: Python-list On Behalf Of Stefan Ram Sent: Tuesday, October 12, 2021 9:49 PM To: [email protected] Subject: Re: sum() vs. loop &quo

Re: importing a module from a file without the '.py' suffix

2021-10-22 Thread Rob Cliffe via Python-list
ion? Best wishes Rob Cliffe On 22/10/2021 12:19, Antoon Pardon wrote: I have a file with python code but the name doesn't end with the '.py' suffix. What is the easiest way to import this code as a module without changing its name? -- https://mail.python.org/mailman/listinfo/python-list

Re: New assignmens ...

2021-10-22 Thread Jon Ribbens via Python-list
but the attribute references "self.ctr" is no identifier! This seems a surprising omission. You'd expect at least 'attributeref' and 'subscription' to be allowed, if not the whole of 'target'. -- https://mail.python.org/mailman/listinfo/python-list

Re: New assignmens ...

2021-10-23 Thread Jon Ribbens via Python-list
to show that this special case is special enough to be given its own unique existence. It's a bit surprising that the PEP doesn't discuss this decision at all. -- https://mail.python.org/mailman/listinfo/python-list

Re: New assignmens ...

2021-10-23 Thread Jon Ribbens via Python-list
On 2021-10-23, Chris Angelico wrote: > On Sun, Oct 24, 2021 at 4:39 AM Jon Ribbens via Python-list > wrote: >> On 2021-10-23, Chris Angelico wrote: >> > In what situations do you need to mutate an attribute and also test >> > it, and how much hassle is it to simp

RE: New assignmens ...

2021-10-24 Thread Avi Gross via Python-list
messed up if evaluated as a regular expression. So is it any wonder NOBODY suggests the above be done? As Chris has said, something was added to Python that is a partial implementation. There are fairly reasonable ways to do additional things and until recently, those were the proper and only way. But

Re: [tkinter][Windows]Unexpected state report for the tab key

2021-10-25 Thread Rob Cliffe via Python-list
) events? (I'm not familiar with tkinter, but in wxpython you can.) And if so, does trapping KeyUp solve the problem? Best wishes Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

RE: New assignmens ...

2021-10-25 Thread Avi Gross via Python-list
he topic here is the Python run-time parser though. It is reading your code and doing whatever complex set of things it has to do to parse from a fairly large set of possible valid programs as well as invalid ones. I have never looked deeply at how it works but my guess is that somewhere in the

RE: New assignmens ...

2021-10-25 Thread Avi Gross via Python-list
We have had discussions debating if Python is a good language for teaching. The short answer is NO unless you only teach a small subset and the students know there is more they can learn as needed. The language is too rich and has too many ways to do seemingly anything and that is before you add

RE: Beginner in python

2021-10-25 Thread Avi Gross via Python-list
. Avi -Original Message- From: Python-list On Behalf Of Chris Angelico Sent: Monday, October 25, 2021 6:25 PM To: Python Subject: Re: Beginner in python On Tue, Oct 26, 2021 at 9:23 AM Kian Kwame wrote: > > hi buddie > am new to python somebody kindly advice the coding which w

RE: New assignmens ...

2021-10-25 Thread Avi Gross via Python-list
d not be a souped-up generalized_sum() function when a simple one will do and be faster when invoked so many times. And note often what is used is a temporary lambda anonymous function that may look like \(x,y) x+y ... or whatever syntax your language uses. -Original Message- From: Pytho

RE: Create a contact book

2021-10-26 Thread Avi Gross via Python-list
in contact and lets you add friends and view them -Original Message- From: Python-list On Behalf Of Chris Angelico Sent: Tuesday, October 26, 2021 2:36 AM To: Python Subject: Re: Create a contact book On Tue, Oct 26, 2021 at 5:30 PM anders Limpan wrote: > > i would like to

RE: New assignmens ...

2021-10-27 Thread Avi Gross via Python-list
I think anyone who suggests we should separate costs from benefits belongs securely within the academic world and should remain there. Practical things need to be built considering costs. Theoretical things, sure, cost is not an issue. Python is not only a real-world set of applications but an

RE: Create a contact book

2021-10-27 Thread Avi Gross via Python-list
I used to be on the Tutor list for python and found it was not for me. Yes, we should refer people there especially those who seem to have HW and would like some gentle coaching but not outright answers. What frustrated me is that rarely would we be told by people what they had learned and

RE: New assignmens ...

2021-10-27 Thread Avi Gross via Python-list
Dave, You make me wonder about unintended side effects. Are we allowing the ++ and --- operations into Python through a side door? any context that allows you to insert the walrus operator like: index := index + 1 index := index - 1 Is now similar to notations in C/C++ and

walrus with a twist :+= or ...

2021-10-27 Thread Avi Gross via Python-list
I realized that the person seeking completeness in Python may next ask why the Walrus operator, :=, is not properly extended to include a whole assortment of allowed assignment operators I mean in normal python programs you are allowed to abbreviate x = x + 5 with x += 5

RE: walrus with a twist :+= or ...

2021-10-27 Thread Avi Gross via Python-list
I just realized I left out **= so my apologies. Are there other such abbreviations and does anyone use them? -Original Message- From: Python-list On Behalf Of Avi Gross via Python-list Sent: Wednesday, October 27, 2021 8:57 PM To: [email protected] Subject: walrus with a twist

RE: walrus with a twist :+= or ...

2021-10-27 Thread Avi Gross via Python-list
ome languages have a built-in extension method such as R that allows you to create arbitrary functions by placing them between % signs as in %>% or %percentile% If Python wanted to add more flexibility than admittedly it already has, then possibly something like I jokingly suggested as a

RE: walrus with a twist :+= or ...

2021-10-27 Thread Avi Gross via Python-list
purpose in Python as using them means you do not need to specify an argument twice and you can specify some dunder methods that make it more efficient to type: obj += obj2 rather than obj = obj + obj2 So there may be a valid argument, not just about completeness, to implement something BUT as

Re: New assignmens ...

2021-10-28 Thread Jon Ribbens via Python-list
ial class for it: > >if g := re.search(pat1, text): > hack(g.group(1)) >elif g := re.search(pat2, text): > smack(g.group(2), "foo") >... > > It's way messier if you have to separate the assignment and test the old > way. That said, I&#

RE: Re: The task is to invent names for things

2021-10-28 Thread Avi Gross via Python-list
nse and make the program easier to read. So, the obvious solution is to ask the language, like Python, to allow variables that are synonyms. In languages with pointers, this can often be done fairly easily. In some languages with some optimizations, it can be dangerous as some copies of this kind

RE: New assignmens ...

2021-10-28 Thread Avi Gross via Python-list
, 5+cos(x))) … Not necessarily pretty and I am sure there may well be reasons it won’t work, but I wonder if it will work in more places than the currently minimal walrus operator. From: Antoon Pardon Sent: Thursday, October 28, 2021 3:03 AM To: Avi Gross ; [email protected] Subj

RE: walrus with a twist :+= or ...

2021-10-28 Thread Avi Gross via Python-list
Good points, Peter. Although we are discussing Python, I think it would be reasonable to look a bit more broadly. Ages ago, IBM used a different encoding than ASCII called EBCDIC (Extended Binary Coded Decimal Interchange Code ) which let them use all 8 bits and thus add additional symbols

RE: The task is to invent names for things

2021-10-28 Thread Avi Gross via Python-list
ltiple CONTRADICTORY such declarations and it is often a matter of taste. In some languages I use periods in longer variable names and in others I use underscores and many times I use camelCase, Hungarian notation and others. The compiler and interpreter generally do NOT care. To bring this bac

RE: walrus with a twist :+= or ...

2021-10-28 Thread Avi Gross via Python-list
, that should do even on standard keyboards. ∴ -Original Message- From: Python-list On Behalf Of Chris Angelico Sent: Thursday, October 28, 2021 3:24 PM To: Python Subject: Re: walrus with a twist :+= or ... On Fri, Oct 29, 2021 at 5:53 AM Avi Gross via Python-list wrote: > Is ther

Re: Get a Joke in Python

2021-10-28 Thread Jon Ribbens via Python-list
gs it follows: A real customer walks into the bar and doesn't order anything, but asks where the toilets are. The bar explodes in flames. -- https://mail.python.org/mailman/listinfo/python-list

RE: New assignmens ...

2021-10-29 Thread Avi Gross via Python-list
lf.ctr - 1) <= 0 : Then assuming passing it 'ctr' as a string makes sense, and the object self is passed by reference, I can see it working without a walrus operator. But it is extra overhead. This being python, setting values WITHIN an object is a challenge. I mean there are ways t

RE: How to apply a self defined function in Pandas

2021-10-31 Thread Avi Gross via Python-list
it for them, as in some asking about HW. I am not joining this one. 😉 -Original Message- From: Python-list On Behalf Of Karsten Hilbert Sent: Sunday, October 31, 2021 4:00 PM To: [email protected] Subject: Re: How to apply a self defined function in Pandas Am Sun, Oct 31, 2021 at

Problem with concatenating two dataframes

2021-11-06 Thread Mahmood Naderan via Python-list
As it reaches the contact() statement, I get this error: TypeError: first argument must be an iterable of pandas objects, you passed an object of type "DataFrame" Based on the definition I wrote in the beginning of the code, "dict[name]" should be a dataframe. Isn't that? How can I fix that? Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem with concatenating two dataframes

2021-11-06 Thread Mahmood Naderan via Python-list
  0 M3  0, 'K1':    Value 0 10 1  5 2 10 6  2 7  2 8  2, 'K2':    Value 3 20 4 10 5 15} For K1, there should be three rows and two columns labeled as Value. Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem with concatenating two dataframes

2021-11-06 Thread Mahmood Naderan via Python-list
  Value 0   10.0NaN 15.0NaN 2   10.0NaN 6NaN2.0 7NaN2.0 8NaN2.0, 'K2':Value 3 20 4 10 5 15} Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Breaking new relic format on a new line character in FileHandler appender

2021-11-10 Thread Vijay Karavadra via Python-list
Hello Team, I'm trying to add logs in the new relic platform from a python application. For that, I've to add logs in a local file in a specific format which is '{"log.level":"%(levelname)s", "log.entity.name":"my-service-name", "messa

Re: Avoid nested SIGINT handling

2021-11-10 Thread Jon Ribbens via Python-list
On 2021-11-10, Paulo da Silva wrote: > Hi! > > How do I handle a SIGINT (or any other signal) avoid nesting? I don't think you need to. Python will only call signal handlers in the main thread, so a handler can't be executed while another handler is running anyway. -- http

Re: Avoid nested SIGINT handling

2021-11-13 Thread Mladen Gogala via Python-list
antum expires or until initiates a synchronous I/O operation, as is the case with all normal read operations. BTW, that's the case on both Unix/Linux systems and Windows systems. -- Mladen Gogala Database Consultant https://dbwhisperer.wordpress.com -- https://mail.python.org/mailman/listinfo/python-list

Returning the index of a row in dataframe

2021-11-14 Thread Mahmood Naderan via Python-list
lobal stores" but the output is `None`. Any idea about that? Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Re: Returning the index of a row in dataframe

2021-11-14 Thread Mahmood Naderan via Python-list
>>> df.iloc[1].name Correct I also see that 'df.index[1]' works fine. Thanks. Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Using astype(int) for strings with thousand separator

2021-11-14 Thread Mahmood Naderan via Python-list
'1,024' How can I fix that? Any idea? Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Re: Using astype(int) for strings with thousand separator

2021-11-15 Thread Mahmood Naderan via Python-list
> (see > https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html) Got it. Thanks. Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Re: Proliferation of Python packaging formats

2021-11-17 Thread Jon Ribbens via Python-list
On 2021-11-17, Skip Montanaro wrote: > Is the proliferation of packaging formats in Python as nutzo as this author > believes? > > https://drewdevault.com/2021/11/16/Python-stop-screwing-distros-over.html > > Asking because I've never been in the business of re

get_axes not present?

2021-11-18 Thread Mahmood Naderan via Python-list
lotting/_matplotlib/core.py", line 903, in _get_subplots     ax for ax in self.axes[0].get_figure().get_axes() if isinstance(ax, Subplot) AttributeError: 'NoneType' object has no attribute 'get_axes' I guess there is a mismatch between versions. Is there any workaround for that? Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Re: get_axes not present?

2021-11-18 Thread Mahmood Naderan via Python-list
Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Re: get_axes not present?

2021-11-19 Thread Mahmood Naderan via Python-list
buteError: 'NoneType' object has no attribute 'get_axes' The error is weird. I have stick at this error... Any thoughts on that? Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

RE: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-20 Thread Avi Gross via Python-list
t by the bit representation of 6 and stores a result which then is handed to sqrt() and if the bits are not identical, there is no guarantee that the result is identical. I will say this. Python has perhaps an improved handling of large integers. Many languages have an assortment of integer sizes you

RE: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-20 Thread Avi Gross via Python-list
n floats but on the design not accommodating the precision needed or perhaps on the algorithm used not necessarily being expected to reach a certain level. -Original Message- From: Python-list On Behalf Of Chris Angelico Sent: Saturday, November 20, 2021 5:17 PM To: [email protected]

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-20 Thread Rob Cliffe via Python-list
On 20/11/2021 22:59, Avi Gross via Python-list wrote: there are grey lines along the way where some mathematical proofs do weird things like IGNORE parts of a calculation by suggesting they are going to zero much faster than other parts and then wave a mathematical wand about what happens when

RE: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-20 Thread Avi Gross via Python-list
. As such, since this is a Python Forum let me add you can get limited support for some of this using the decimal module: https://www.askpython.com/python-modules/python-decimal-module But I doubt Python can be said to do things worse than just about any other computer language when storing and usin

RE: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-20 Thread Avi Gross via Python-list
expectations. The example I gave, is NOW, indeed on quite firm footing but for quite a while was not. What we have in this forum recently is people taking pot shots at aspects of Python where in a similar way, they know not what is actually happening and insist it be some other way. Some people

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-20 Thread Rob Cliffe via Python-list
a repeating decimal but 14 and 10 are not coprime. I believe it is correct to say that infinitely recurring expansions occur when the denominator is divisible by a prime that does not divide the base. Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

RE: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-20 Thread Avi Gross via Python-list
er calculations. I note some of your argument is the valid difference between when your knowledge of the input numbers is uncertain and what the computer does with them. Yes, my measures of the height/width/depth may be uncertain and it is not the fault of a python program if it multiplies the

RE: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-20 Thread Avi Gross via Python-list
limited. Is there any official limit on the maximum size of a python integer other than available memory? And replying sparsely, yes, pretty much nothing can be represent completely in base e other than integral multiples of e, perhaps. No other numbers, especially integers, can be linear combinations

Re: get_axes not present?

2021-11-21 Thread Mahmood Naderan via Python-list
().get_axes() if isinstance(ax, Subplot) AttributeError: 'NoneType' object has no attribute 'get_axes' I am pretty sure that there is a version mismatch because on a system with Pandas 1.3.3 the output should be like https://imgur.com/a/LZ9eAzl Any feedback is appreciated. Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Re: get_axes not present?

2021-11-21 Thread Mahmood Naderan via Python-list
>I installed the latest pandas, although on Python 3.10, and the script >worked without a problem. Yes as I wrote it works with 1.3.3 but mine is 1.2.3. I am trying to keep the current version because of the possible future consequences. In the end maybe I have to upgrade the pandas. R

Re: get_axes not present?

2021-11-21 Thread Mahmood Naderan via Python-list
lf._get_subplots()   File "/home/mnaderan/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py", line 903, in _get_subplots     ax for ax in self.axes[0].get_figure().get_axes() if isinstance(ax, Subplot) AttributeError: 'NoneType' object has no attribute 'get_axes' Any idea about that? Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

About get_axes() in Pandas 1.2.3

2021-11-22 Thread Mahmood Naderan via Python-list
s/pandas/plotting/_matplotlib/core.py", line 903, in _get_subplots ax for ax in self.axes[0].get_figure().get_axes() if isinstance(ax, Subplot) AttributeError: 'NoneType' object has no attribute 'get_axes' Although the plot() crashes, I see that row and axes variabl

<    33   34   35   36   37   38   39   40   41   42   >