RE: [Neuroimaging] what's the problem??????

2022-07-15 Thread avi.e.gross
Dennis, I am replying to the group but mainly you as I doubt Nati really reads much of what we write. The use of list() is needed as what comes out of the function may be an object of type dict_keys which is iterable but if you want it in a list form all at once, the idiom he uses is common. In

RE: [Neuroimaging] what's the problem??????

2022-07-14 Thread avi.e.gross
Dennis, I see Nati sent some more code without explaining again what he wants. Yes, somewhere in this stack of messages he may have said things (that we generally failed to understand) but it would be helpful to summarize WHY he sent us what he did or which lines to look at. If your

RE: Extract the space group generators from Bilbao Crystallographic Server.

2022-07-14 Thread avi.e.gross
I guess Dan, that he may not be seeing what he is working on as a list of lists of lists with each terminal sublist being of cardinality 4. Maybe Zhao could look up what methods a list object has that allow you to place additional items, such as a list of 4 numbers, at the beginning or end or in

RE: [Neuroimaging] what's the problem??????

2022-07-14 Thread avi.e.gross
That is more detailed, Nati, albeit I may not still understand. You are working on a detailed project you may have some understanding of and getting stuck. But the people you ask for help do not have your info and, worse, your code seems full of blunders based on making assumptions, so

RE: ml on medical images - keras

2022-07-14 Thread avi.e.gross
Nati, You ask what the problem is in that code. I say there I absolutely NO PROBLEM for me in that code. Do you know why? Because even if I want to copy it and make sure I have all the modules it needs, I have no access to the files it opens, and no idea what the output of the images pumped

RE: [Neuroimaging] what's the problem??????

2022-07-14 Thread avi.e.gross
Nati, I know you think you are communicating. שטרן >> I want to swap indexes of dict When you say SWAP, do you mean replace the index with something else, or swap the key and value or something entirely else? You have not shared an example of what is in your dictionary, but say it

RE: Resolving Weekday Schedules to Dates

2022-07-21 Thread avi.e.gross
Do you know of a library that resolves schedules like every Wednesday at 3:00pm to absolute time, that is return the datetime of the next occurrence? It may be as simple, as this to add seven days, assuming a slip of a second is not important or even a hour when things change. Enddate =

RE: any author you find very good has written a book on Python?

2022-09-06 Thread avi.e.gross
Subject: searching for books by an author you like on rather unrelated topics. I am curious if you normally look or books by a writer of Mysteries you like to see if they also wrote Science Fiction or Cookbooks and so on? Having said that, there are plenty of people in the Computer Science field

RE: Question about learning Python

2022-09-07 Thread avi.e.gross
Chris, I started with BASIC in high school and kept shifting my focus from one computer language to another long before I even looked at Python. Arguably each language had a REASON for existing so it supported some ideas or paradigms or ways of looking at things. Many at first were rather

RE: Question about learning Python

2022-09-07 Thread avi.e.gross
Maybe we should ask WHY the person asking the question about how to learn a computer language called Python is pairing it with the idea of whether to also learn C. What are they preparing for? Most people using Python have absolutely no reason to learn C, or C++ or C# or JAVA or one of a

RE: for -- else: what was the motivation?

2022-10-16 Thread avi.e.gross
Realistically an idea about something new is easier to consider than changing what you have. Some newer languages may well be designed from the start in new ways and Julia is an example of a language that allows a wide swath of UNICODE characters to be used in identifiers. They also let you type

RE: for -- else: what was the motivation?

2022-10-16 Thread avi.e.gross
My point Chris was that you can have a conversation where you are exploring and not proposing. Brainstorming, perhaps. I was saying that there are many ways to signal things and in some hypothetical new language, it may be implemented in novel ways that do not break anything. I note languages

RE: How to replace an instance method?

2022-09-17 Thread avi.e.gross
>From your description, Chris, it sounds like the functional programming technique often called currying. A factory function is created where one (or more) parameters are sort of frozen in so the user never sees or cares about them, and a modified or wrapped function is returned. In this case,

RE: WHAT THIS EXCEPTION MEANT? I ATTCHED SCREENSOHT

2022-09-09 Thread avi.e.gross
Nati, If you thought a bit first, you might remember this mailing list does not forward attachments so we are not seeing the image you called image.png and you neglected to also give us some text telling us what exception you saw or lots of additional details that might help. And, just FYI.

RE: for -- else: what was the motivation?

2022-10-10 Thread avi.e.gross
I just want to get clear on what may be a side issue The suggestion is that a loop with an ELSE clause only makes sense if the user can BREAK out without finishing, right? My first question is whether a warning or even error makes sense if there is no BREAK statement anywhere in the loop but

What to use for finding as many syntax errors as possible.

2022-10-11 Thread avi.e.gross
I think we are in agreement here, Chris. My point is that the error detection and correction is now done at levels where there is not much need to use earlier and inefficient methods like parity bits set aside. We use protocols like TCP and IP and layers above them and above those to maintain the

RE: What to use for finding as many syntax errors as possible.

2022-10-10 Thread avi.e.gross
Cameron, or OP if you prefer, I think by now you have seen a suggestion that languages make choices and highly structured ones can be easier to "recover" from errors and try to continue than some with way more complex possibilities that look rather unstructured. What is the error in code like

RE: What to use for finding as many syntax errors as possible.

2022-10-10 Thread avi.e.gross
Michael, A reasonable question. Python lets you initialize variables but has no explicit declarations. Languages differ and I juggle attributes of many in my mind and am reacting to the original question NOT about whether and how Python should report many possible errors all at once but how ANY

RE: What to use for finding as many syntax errors as possible.

2022-10-10 Thread avi.e.gross
I stand corrected Chris, and others, as I pay the sin tax. Yes, there are many kinds of errors that logically fall into different categories or phases of evaluation of a program and some can be determined by a more static analysis almost on a line by line (or "statement" or "expression", ...)

RE: What to use for finding as many syntax errors as possible.

2022-10-11 Thread avi.e.gross
Thanks for a rather detailed explanation of some of what we have been discussing, Chris. The overall outline is about what I assumed was there but some of the details were, to put it politely, fuzzy. I see resemblances to something like how a web page is loaded and operated. I mean very different

RE: for -- else: what was the motivation?

2022-10-11 Thread avi.e.gross
Anton, Your example overlaps with the use of generators in Python to do variants of the same pipeline ideas. But is that native python or some extension where "|" has been modified to mean something other than a form of OR in some places? What module do you need to load to make that happen? I

RE: for -- else: what was the motivation?

2022-10-09 Thread avi.e.gross
I won't reply to everything Dave says and especially not the parts I fully agree with. I think in many situations in life there is no ONE way to do things so most advice is heuristic at best and many exceptions may exist depending on your chosen approach. As such, I do not really think in

RE: What to use for finding as many syntax errors as possible.

2022-10-09 Thread avi.e.gross
Cameron, Your suggestion makes me shudder! Removing all earlier lines of code is often guaranteed to generate errors as variables you are using are not declared or initiated, modules are not imported and so on. Removing just the line or three where the previous error happened would also have a

RE: for -- else: what was the motivation?

2022-10-09 Thread avi.e.gross
Chris, a short(er) answer to your addition below. I did not at first share your perception but maybe do now. If the argument was that ELSE and other constructs like FINALLY or CATCH are horrible because they follow other code and important things should be first, that is a silly argument. Many

RE: for -- else: what was the motivation?

2022-10-09 Thread avi.e.gross
[This is an answer for Peter and can easily be skipped by those who know or have no wish to.] Strictly speaking Peter, the word "pipe" may not mean quite something in Python but other concepts like chaining may be better. The original use of the word I am used to was at the UNIX shell level

RE: for -- else: what was the motivation?

2022-10-09 Thread avi.e.gross
>>>Which is more disparaging: "I couldn't find anyone suggesting this" or "The only place I could find it was a PHP style guide"? >>>ChrisA Chris, If someone says they heard something from their own personal guru, people often do not feel threatened or argue. I often am told nutrition or medical

RE: for -- else: what was the motivation?

2022-10-15 Thread avi.e.gross
This has been discussed so often precisely because I swear NO CHOICE of keyword would satisfy everybody! Most languages start with designated keywords and some reserve a few for later use. But then things can get frozen in place to avoid breaking existing programs or break older

RE: Trying to understand nested loops

2022-08-05 Thread avi.e.gross
I wonder if someone is pulling our leg as they are sending from an invalid email address of "GB " which is a bit sick. I have trouble imagining ANYONE learning a language like python without rapidly being told that python uses indentation instead of various ways to detect when a body of text is

RE: Exclude 'None' from list comprehension of dicts

2022-08-05 Thread avi.e.gross
Benchmarking aside, Lori, there are some ideas about such things. You are describing a case, in abstract terms, where an algorithm grinds away and produces results that may include an occasional or a common unwanted result. The question is when to eliminate the unwanted. Do you eliminate them

RE: Trying to understand nested loops

2022-08-06 Thread avi.e.gross
This reminds me a bit of how routine spelling checkers and often especially grammar checkers, generate so many suggestions about mistakes as to become ignored. If you are writing using lots of names and jargon that keep getting flagged as errors and they are spelled or used exactly as you want,

RE: Trying to understand nested loops

2022-08-05 Thread avi.e.gross
I had considered that, Dave. Albeit others did at least put in some three-dot markers to show there was other code between the three lines shown. But the same silly argument they used applies elsewhere. Consider nested calls like: Delta(Gamma(Beta(Alpha))) Now say one of those functions takes

RE: Parallel(?) programming with python

2022-08-10 Thread avi.e.gross
There are many possible discussions we can have here and some are not really about whether and how to use Python. The user asked how to do what is a fairly standard task for some people and arguably is not necessarily best done using a single application running things in parallel. So, yes, if

RE: [Tutor] (no subject)

2022-08-14 Thread avi.e.gross
How long? Not fibbing but infinite is infinite and I simply so not have the time. This is so such an EASY question that you need to show some work to interest us. You can do this in ANY programming language so explain if there is a reason you ask here or ... The real question is what you want.

RE: Register multiple excepthooks?

2022-07-31 Thread avi.e.gross
Albert-Jan, Unless there is something special in your scenario, aren't there many ways within python proper to create functions that effectively call another function or more as needed? Think decorators as one example. Of course if the caller expects some specific result when it calls your

RE: Which linux distro is more conducive for learning the Python programming language?

2022-08-04 Thread avi.e.gross
To be clear, the discussion strikes me oddly. You can learn python without a computer. Of course to actually have people write code and try it out is another story. Python by itself is simply a program that can be typed into an interpreter or given a file to process and works just as well on

RE: Parallel(?) programming with python

2022-08-08 Thread avi.e.gross
Stefan, You are correct that the goal of a lock is to do something rather quickly and atomically, so your design should not do something complex or long before releasing the lock. In your example, you have a producer adding data as regularly as every second and another that wakes up rarely and

RE: set.add() doesn't replace equal element

2022-12-30 Thread avi.e.gross
Ian, Do you have some examples of things you can put in a set that you consider equal but want to store in the set INSTEAD of any current element? What follows is some thoughts on some methods you could build yourself. Others re possible and someone else may present you with a module that does

RE: NoneType List

2022-12-31 Thread avi.e.gross
Chris, There is much to say about consistent behavior as compared to flexibility and convenience. I have seen other languages provide functions for example, where the result can vary and often cause confusion. R had a function that would sometimes notice the result could be simplified and

RE: NoneType List

2022-12-31 Thread avi.e.gross
It depends on what people consider too complicated. I find it a tad complicated when someone posts using two different ID, and then wonders ... The question related to taking a list and extending it and using the result in an assignment statement. There were several inter-related questions

RE: NoneType List

2022-12-31 Thread avi.e.gross
Agreed, there are lots of pro/con arguments and the feature is what it is historically and not trivial to change. Inline changes to an object make sense to just be done "silently" and if there are errors, they propagate the usual way. As Guido was a major influence at that time, one view was

RE: NoneType List

2023-01-01 Thread avi.e.gross
Thomas, I used PASCAL before C and I felt like I was wearing a straitjacket at times in PASCAL when I was trying to write encryption/decryption functions and had to find ways to fiddle with bits. Similar things were easy in C, and are even easier in many more recent languages such as Python.

RE: NoneType List

2023-01-01 Thread avi.e.gross
Not to wax poetic about our pasts, Thomas, but I do did not start with PASCAL and used quite a few languages before and plenty after. At the time it had interesting contrasts to languages like BASIC, FORTRAN and LISP and I tended to use whatever was available on the machines I was using. My first

RE: RE: NoneType List

2023-01-02 Thread avi.e.gross
Alan, I stand corrected as my path never led me back to any form of PASCAL. And, frankly, my path rarely led me again to having to do what we describe as twiddling bits with the minor exception when doing something like setting the bits needed to specify what permissions should be associated

RE: Python-list Digest, Vol 232, Issue 1

2023-01-02 Thread avi.e.gross
Well explained, Roger. Your explanation reminds me why some languages very deliberately do not want the C operators of pre/post increment/decrement. Similar to your argument, code in C like: Y = X++ Or Y = ++X And similarly the -- versions, have a sort of side effect of changing X either

RE: To clarify how Python handles two equal objects

2023-01-12 Thread avi.e.gross
Jen, It is dangerous territory you are treading as there are times all or parts of objects are copied, or changed in place or the method you use to make a view is not doing quite what you want. As an example, you can create a named slice such as: middle_by_two = slice(5, 10, 2) The above

RE: NoneType List

2023-01-01 Thread avi.e.gross
Several of you have mentioned the role of history in the development of languages and what the founders of a language were trying to improve. As noted with PASCAL, some earlier languages strived to be different things and in a certain sense, their procedures were perhaps seen as a safer and

RE: String to Float, without introducing errors

2022-12-17 Thread avi.e.gross
As often seems to happen, someone asks something that may not be fully clear and others chime in and extend the question. Was the original question how to read in a ingle column of numbers from a file that are all numeric and NOT integers and be able to use them? If so, the answer was quite

RE: Single line if statement with a continue

2022-12-17 Thread avi.e.gross
I happen to be of two schools here. Is something sort of taboo when using something like a computer language to write a program? What if another language tells you to do it a different way or sort of the opposite? Is it based on the details of the language and implementation or the prejudices

RE: Single line if statement with a continue

2022-12-14 Thread avi.e.gross
Unless someone is counting lines of code for some purpose, like number of error found per thousand lines of code, many short one-liners strike me as more readable and especially if followed by a blank line so it is a bit obvious. Consider a similar issue in many languages that use curly braces

RE: Single line if statement with a continue

2022-12-15 Thread avi.e.gross
Multiple returns is not always a problem as it depends on the nature of a task whether it has complex enough cases. I have seen code that instead sets Boolean variables when it is ready to return and everything else keeps checking the variables to skip further processing so the program then

RE: In code, list.clear doesn't throw error - it's just ignored

2022-11-15 Thread avi.e.gross
Yes, Chris, that is a REPL feature and one that people may use interactively. As you note, it does not work inside something like a function which the REPL is not trying to evaluate and print. So clearly my supposed use would not make much sense in such code. -Original Message- From:

RE: In code, list.clear doesn't throw error - it's just ignored

2022-11-15 Thread avi.e.gross
That is clear, Cameron, but on my python interpreter values evaluated on the command line ARE saved: >>> numb = 5 >>> 5 + numb 10 >>> numb 5 >>> _ + _ + 1 11 >>> _ * 2 22 >>> The point is that a dummy variable of _ is assigned and re-assigned at each step and there can be a valid, if not very

RE: To clarify how Python handles two equal objects

2023-01-13 Thread avi.e.gross
Jen, This may not be on target but I was wondering about your needs in this category. Are all your data in a form where all in a cluster are the same object type, such as floating point? Python has features designed to allow you to get multiple views on such objects such as memoryview that

RE: To clarify how Python handles two equal objects

2023-01-13 Thread avi.e.gross
Axel and others, I can appreciate the comparison to a partially applied function but not in this case. Not that it matters, but this example is more like creating an object in something like machine learning and initializing parameters without adding data. Only when you ad data and call upon some

RE: To clarify how Python handles two equal objects

2023-01-13 Thread avi.e.gross
ers or Booleans and then later try using it after the number of items or rows or columns have changed. Your indices no longer match. Avi -Original Message- From: Python-list mailto:python-list-bounces+avi.e.gross=gmail@python.org> > On Behalf Of Jen Kris via Python-list

RE: The Zen of D.E.K.

2023-01-14 Thread avi.e.gross
I can appreciate a beautiful piece of code but I can also appreciate another piece of code that does things in another pleasing way so there is quite a bit of subjectivity here. And, in yet another computer language, the implementation of what seems to be the same algorithm is somewhat jarring as

RE: Improvement to imports, what is a better way ?

2023-01-19 Thread avi.e.gross
Just FYI, the example Dave supplied was not using python code and using a rather strange re-definition in the R language package he was using. Or maybe not. Anyone not interested, skip the rest. First, R does not use indentation for almost anything. So you can break one long line up into many

RE: Improvement to imports, what is a better way ?

2023-01-19 Thread avi.e.gross
I stand corrected. Thomas is (mostly) writing valid Python if you use the module that looks (deliberately) like the R implementation. The use of "+" in two contexts such as when not needed to concatenate strings, reminded me too much of R. Either way, this thread has moved on from any original

RE: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-24 Thread avi.e.gross
If I understood the issue, the problem is the unary minus at the start of the expression. So if you know the expression is in that argument, would it make sense to pad it in one of many ways that are otherwise harmless? Could you put parens on both sides of "-4^2+5.3*abs(-2-1)/2":

RE: bool and int

2023-01-24 Thread avi.e.gross
Python yet again is being asked why something is the way it is and not as someone insists it should be. It is a tool to be used the way it SAYS it works so the bug is perhaps in the user and their expectations. It is what it is and would break lots of things if changed without much thought. Every

Languages working together

2023-01-25 Thread avi.e.gross
Thomas, I changed the subject line as we are not talking about bool and int anymore. For me, there are several sides to JAVA that go beyond the "language" to the JVM, or Java Virtual Machine. What you are describing is an example of interoperability you can get if your language also is built on

RE: bool and int

2023-01-25 Thread avi.e.gross
Dino, There is no such things as a "principle of least surprise" or if you insist there is, I can nominate many more such "rules" such as "the principle of get out of my way and let me do what I want!" Computer languages with too many rules are sometimes next to unusable in practical situations.

RE: bool and int

2023-01-25 Thread avi.e.gross
Chris, We generally agree albeit I have a question in python with the concept of being truthy that results in either a Boolean value that boils down to 0 and 1 but in some cases may boil down to the last evaluated argument which remains in a form that may not be either a Boolean or an integer. I

RE: bool and int

2023-01-25 Thread avi.e.gross
Like Chris, I appreciate precision when it matters but since I am not writing a textbook here, I often talk more informally. There are many variations on now variables or objects are treated differently in certain languages and when I said "STRONG" I simply meant a sort of opposite to "WEAK". I

RE: bool and int

2023-01-26 Thread avi.e.gross
Gerard, I am sure there is. I have been on many forums that discuss programming languages and since nothing is perfect and people differ in many ways, there is always grumbling and comparison. If we all agreed and there was only one of something, I suspect we still would complain and that is

RE: RE: bool and int

2023-01-26 Thread avi.e.gross
[Dino has a deliberately invalid email address so sending him anything privately is not an option.] Dino, I would agree with you that for some purposes, you do NOT need to dig deep into a language to get fairly routine things done. You can often borrow ideas and code from an online search and

RE: Evaluation of variable as f-string

2023-01-27 Thread avi.e.gross
May I point out that some dynamic situations can in a sense be normalized? The example below posits a dynamically allocated dictionary during run time. But why can't you have a placeholder variable name in place and make your placeholder a link to the dictionary (or other item) before invoking

logically Boolean

2023-01-28 Thread avi.e.gross
"F" then perhaps they would allow Booleans to be treated as characters and let them be concatenated to strings and so on. -Original Message- From: Python-list mailto:python-list-bounces+avi.e.gross=gmail@python.org> > On Behalf Of Grant Edwards Sent: Saturday

RE: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-28 Thread avi.e.gross
Jack, I get uneasy when someone thinks a jackhammer is a handy dandy tool for pushing in a thumbtack that is sitting on my expensive table. I agree it is quite easy to grab some code that does lot of things and also does something truly minor, and use it for that purpose. Sometimes the cost is

RE: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-29 Thread avi.e.gross
Although today you could say POSIX is the reason for many things including the use of "--" I hesitate to mention I and many others used that convention long before as a standard part of many UNIX utilities. Like many other such things, you build things first and by the time you standardize, ...

RE: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-29 Thread avi.e.gross
Cameron, You are technically correct but perhaps off the mark. Yes, a python program only sees what is handed to it by some shell if invoked a certain way. The issue here is what you tell people using your program about what they need to type to get it to work. That means if their shell is

RE: To clarify how Python handles two equal objects

2023-01-15 Thread avi.e.gross
<<< Frank Millman>>> My 'aha' moment came when I understood that a python object has only three properties - a type, an id, and a value. It does *not* have a name. Yes, Frank, it is a bit like how some people need to wrap their minds around a concept like an anonymous function. It has no name

RE: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread avi.e.gross
Cameron, What would be the meaning of an ordering relation determining what is MORE VALID? As has been pointed out, not only are some uses that look odd sometimes valid, but perhaps even can be used in ways you simply may not see, such as side effects. Some examples ranging from poor to horrible

RE: Fast full-text searching in Python (job for Whoosh?)

2023-03-06 Thread avi.e.gross
Thomas, I may have missed any discussion where the OP explained more about proposed usage. If the program is designed to load the full data once, never get updates except by re-reading some file, and then handles multiple requests, then some things may be worth doing. It looked to me, and I

RE: Fast full-text searching in Python (job for Whoosh?)

2023-03-06 Thread avi.e.gross
Gerard, I was politely pointing out how it was more than the minimum necessary and might gets repeated multiple times as people replied. The storage space is a resource someone else provides and I prefer not abusing it. However, since the OP seems to be asking a question focused on how long it

RE: Fast full-text searching in Python (job for Whoosh?)

2023-03-06 Thread avi.e.gross
Ah, thanks Dino. Autocomplete within a web page can be an interesting scenario but also a daunting one. Now, do you mean you have a web page with a text field, initially I suppose empty, and the user types a single character and rapidly a drop-down list or something is created and shown? And as

RE: Can you process seismographic signals in Python or should I switch to Matlab ?

2023-03-11 Thread avi.e.gross
I have used GNU Octave as a sort of replacement for MATLAB as a free resource. I have no idea if it might meet your needs. Although Python is a good environment for many things, if you have no knowledge of it yet, it can take a while to know enough and if you just need it for one project, ...

RE: Can you process seismographic signals in Python or should I switch to Matlab ?

2023-03-11 Thread avi.e.gross
A a, Consider asking a more specific question. Many things can be done in many different programming languages. Are you asking if there are helpers you can use such as modules that implement parts of the algorithms you need? Are you asking about speed or efficiency? Have you considered how few

RE: =- and -= snag

2023-03-13 Thread avi.e.gross
Morten, Suggesting something is UNPYTHONIC is really not an argument I take seriously. You wrote VALID code by the rules of the game and it is not a requirement that it guesses at what you are trying to do and calls you an idiot! More seriously, python lets you do some completely obscure things

RE: =- and -= snag

2023-03-14 Thread avi.e.gross
There seem to be a fundamental disconnect here based on people not understanding what can happen when spaces are optional. Yes, I have had my share of times I found what I programmed was not quite right and been unhappy but the result was mostly learning how to not not not not do that next time

Feature migration

2023-03-08 Thread avi.e.gross
This may be of interest to a few and is only partially about Python. In a recent discussion, I mentioned some new Python features (match) seemed related to a very common feature that has been in a language like SCALA for a long time. I suggested it might catch on and be used as widely as in

RE: Feature migration

2023-03-08 Thread avi.e.gross
Greg, Yes, it is very possible from other sources. I doubt it hurts if a popular language, albeit not compiled the same way, uses a feature. I see it a bit as more an impact on things like compiler/interpreter design in that once you see it can reasonably be implemented, some features look

RE: Can you process seismographic signals in Python or should I switch to Matlab ?

2023-03-13 Thread avi.e.gross
Hi, This seems again to be a topic wandering. Was the original question whether Python could be used for dealing with Seismic data of some unspecified sort as in PROCESSING it and now we are debating how to clean various aspects of data and make things like data.frames and extract subsets for

RE: Fast full-text searching in Python (job for Whoosh?)

2023-03-07 Thread avi.e.gross
Some of the discussions here leave me confused as the info we think we got early does not last long intact and often morphs into something else and we find much of the discussion is misdirected or wasted. Wouldn't it have been nice if this discussion had not started with a mention of a

RE: semi colonic

2023-02-23 Thread avi.e.gross
Grant, I am not sure it is fair to blame JSON for a design choice. Use of commas can be done many ways in many contexts. One context is a sort of placeholder. Can you have a language where a function has multiple arguments and you can skip some as in: Func(a,b,c) Func(a, b,) Func(a,,) Or

RE: semi colonic

2023-02-23 Thread avi.e.gross
Rob, It depends. Some purists say python abhors one liners. Well, I politely disagree and I enjoyed this book which shows how to write some quite compressed one-liners or nearly so. Python One-Liners: Write Concise, Eloquent Python Like a Professional Illustrated Edition by Christian Mayer

RE: semi colonic

2023-02-23 Thread avi.e.gross
That is a reasonable use, Rob, albeit I would refactor that example in quite a few ways so the need for a semicolon disappears even for lining things up. So to extrapolate, perhaps a related example might be as simple as wanting to initialialize multiple variables together might suffice as

RE: Line continuation and comments

2023-02-23 Thread avi.e.gross
Good example, Rob, of how some people make what I consider RELIGIOUS edicts that one can easily violate if one wishes and it makes lots of sense in your example. Let me extend that. The goal was to store a character string consisting of multiple lines when printed that are all left-aligned.

RE: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-23 Thread avi.e.gross
Rob, There are lots of nifty features each of us might like and insist make much more sense than what others say they want. Sometimes the answer is to not satisfy most of those demands but provide TOOLS they can use to do things for themselves. As you agree, many of us have found all kinds of

RE: TypeError: can only concatenate str (not "int") to str

2023-02-25 Thread avi.e.gross
Greg, Yes, the forum should be open. The first requests from the person were replied to politely. At some point a pattern was emerging of lots of fairly irreverent posts by someone who is having trouble shifting programming paradigms. The suggestion was then made as a SUGGESTION by several

RE: one Liner: Lisprint(x) --> (a, b, c) instead of ['a', 'b', 'c']

2023-02-26 Thread avi.e.gross
I so rarely need to save a list in python in a form acceptable to LISP but here is a go with no visible recursion needed. >>> nested = [1, 2, [3, 4, [5, 6, 7], 8], 9] >>> print(nested) [1, 2, [3, 4, [5, 6, 7], 8], 9] # Just converting to a tuple does not change nested lists >>>

RE: Python 3.10 Fizzbuzz

2023-02-26 Thread avi.e.gross
Only sometimes. Is it an insult to suggest the question about what quotes to use is quite basic? Python has a wide variety of ways to make a string and if you have text that contains one kind of quote, you can nest it in the other kind. Otherwise, it really does not matter. And, yes, there

RE: TypeError: can only concatenate str (not "int") to str

2023-02-26 Thread avi.e.gross
Alan, Good tack. By not welcoming someone who is paranoid about being welcomed you are clearly the right kind of welcoming! Kidding aside, you have a point about one of the barrage of messages probably not getting a great answer on your tutor forum. It is the MANY messages often about fairly

RE: Comparing caching strategies

2023-02-18 Thread avi.e.gross
MRAB, I made it very clear I was using the translation provided by Google Translate. I copied exactly what it said and as I speak the languages involved, they seemed reasonable. I often find it provides somewhat different translations than I expect and sometimes I need to supply a longer

RE: Comparing caching strategies

2023-02-18 Thread avi.e.gross
It is not an unusual pattern, Thomas, to do something selective to some object rather than do all parts just one way. The history of computing has often been one where you had to deal with scarcity of expensive resources. Consider the Python "list" as a rather wasteful container that is best

RE: Tuple Comprehension ???

2023-02-21 Thread avi.e.gross
There is a very common misunderstanding by people learning python that a tuple has something to do with parentheses. It confused me too at first. A tuple is made by the use of one or more commas and no parentheses are needed except when, like everything else, they are used for grouping as in the

RE: Tuple Comprehension ???

2023-02-21 Thread avi.e.gross
There are limits to anyone arguing for designs to be the way they want or expect and Roel has explained this one below. When it comes to designing a function, lots of rules people expect are beyond irrelevant. Many functions can be implemented truly hundreds of ways with varying numbers of

RE: Tuple Comprehension ???

2023-02-21 Thread avi.e.gross
Axy, Nobody denies some of the many ways you can make a good design. But people have different priorities that include not just conflicts between elements of a design but also equally important factors like efficiency and deadlines and not breaking too badly with the past. You can easily enough

RE: it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-27 Thread avi.e.gross
I am not a big fan of religions or philosophies that say a road to salvation is for the "I" to disappear. But on a more serious note, as Roel said, there is NO RULE being violated unless the documentation of the language says it is supposed to do something different. There are many excellent

RE: How to escape strings for re.finditer?

2023-02-27 Thread avi.e.gross
Just FYI, Jen, there are times a sledgehammer works but perhaps is not the only way. These days people worry less about efficiency and more about programmer time and education and that can be fine. But it you looked at methods available in strings or in some other modules, your situation is

  1   2   >