Re: Line continuation and comments

2023-02-22 Thread Cameron Simpson
t = True split_before_expression_after_opening_paren = True split_before_first_argument = True split_before_logical_operator = True split_complex_comprehension = True use_tabs = False So basicly PEP8 with some tweaks. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Python + Vim editor

2023-02-22 Thread Cameron Simpson
On 21Feb2023 18:00, Hen Hanna wrote: what editor do you (all) use to write Python code? (i use Vim) vim -- https://mail.python.org/mailman/listinfo/python-list

Re: Line continuation and comments

2023-02-23 Thread Cameron Simpson
bles used (self). Constant a class attribute. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Error-Msg Jeannie's charming, teasing ways

2023-02-23 Thread Cameron Simpson
an my code and tell me such (wink,wink) type suggestions There are several type checking programs for Python, with mypy probably being the best known. I seem to recall seeing some mention of tools which will aid inferring types from partially types programmes, usually as

Re: Programming by contract.

2023-02-25 Thread Cameron Simpson
lf, fspath): ''' Compute the absolute path used to index a `TaggedPath` instance. This returns `realpath(fspath)` if `self.config.physical`, otherwise `abspath(fspath)`. ''' return realpath(fspath) if self.config.physical else abspath(

Re: How to escape strings for re.finditer?

2023-02-27 Thread Cameron Simpson
r_, then you're effectively searching for a _fixed_ string, not a pattern/regexp. So why on earth are you using regexps to do your searching? The `str` type has a `find(substring)` function. Just use that! It'll be faster and the code simpler! Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How to escape strings for re.finditer?

2023-02-27 Thread Cameron Simpson
verkill. Just something to keep in mind. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How to escape strings for re.finditer?

2023-02-27 Thread Cameron Simpson
ee what your programme is actually working with, instead of what you thought it was working with. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How to escape strings for re.finditer?

2023-02-28 Thread Cameron Simpson
it to choose a programming language (eg sed vs awk vs shell vs python in loose order of problem difficulty), but it applies also to choosing tools within a language. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.10 Fizzbuzz

2023-03-01 Thread Cameron Simpson
On 28Feb2023 12:54, Greg Ewing wrote: I guess this means I can't use Black. :-( Black's treatment of quotes and docstrings is one of the largest reasons why I won't let it touch my personal code. yapf is far better behaved, and can be tuned as well! Cheers, Cameron Si

Re: Python 3.10 Fizzbuzz

2023-03-01 Thread Cameron Simpson
7; and the converse for the other quote character. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Regular Expression bug?

2023-03-02 Thread Cameron Simpson
art of the string. You want r0.search(s). - Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Bug 3.11.x behavioral, open file buffers not flushed til file closed.

2023-03-05 Thread Cameron Simpson
design something is hanging on to a file while it is waiting for something, then a crash occurs, they lose a portion of what was assumed already complete... f.flush() Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Bug 3.11.x behavioral, open file buffers not flushed til file closed.

2023-03-05 Thread Cameron Simpson
acket data to a stream (eg a TCP connection): https://github.com/cameron-simpson/css/blob/00ab1a8a64453dc8a39578b901cfa8d1c75c3de2/lib/python/cs/packetstream.py#L624 Starting at line 640: `if Q.empty():` it optionally pauses briefly to see if more packets are coming on the source queue. If anoth

Re: Lambda returning tuple question, multi-expression

2023-03-08 Thread Cameron Simpson
nchronously you arrange to issue an "event", and the GUI mainloop will process that as it happens - the event callback will be fired (called) by the main loop itself and thus the callback gets to do its thing in the main loop. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Lambda returning tuple question, multi-expression

2023-03-09 Thread Cameron Simpson
;), ...maybe more..., expr)[-1] to embed some debug tracing in a lambda defined expression. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Lambda returning tuple question, multi-expression

2023-03-09 Thread Cameron Simpson
b, c, ) in varying flavours of indentation depending on tuning. The point being that if, like me, you often have a code formatter active-on-save it can be hinted to nicely present complex tuples (or parameter lists and imports). It isn't magic, but can be quite effective. Cheers,

Re: Baffled by readline module

2023-03-09 Thread Cameron Simpson
xample I found elsewhere that you don't call some module method to fetch the next user-entered line. You call the input() built-in. Ah. That's not overtly stated? [...reads...] Ah, there it is in the last sentence of the opening paragraph. Not quite as in-your-face as I'd have l

Re: Baffled by readline module

2023-03-09 Thread Cameron Simpson
n it on if available. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Lambda returning tuple question, multi-expression

2023-03-10 Thread Cameron Simpson
On 09Mar2023 17:55, aapost wrote: On 3/9/23 16:37, Cameron Simpson wrote: Just a note that some code formatters use a trailing comma on the last element to make the commas fold points. Both yapf (my preference) and black let you write a line like (and, indeed, flatten if short enough

Re: Baffled by readline module

2023-03-10 Thread Cameron Simpson
because I read this the way you read it. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Baffled by readline module

2023-03-10 Thread Cameron Simpson
hether it is already imported. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: 转发: How to exit program with custom code and custom message?

2023-03-13 Thread Cameron Simpson
Notice that the only call to `sys.exit()` is right at the bottom. Everything else is just regularfunction returns. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Cameron Simpson
that is stored as the ".__mro__" field on the new class (EqualityConstraint). You can look at it directly as "EqualityConstraint.__mro__". So looking up: self.choose_method() looks for a "choose_method" method on the classes in "type(self).__mro__". Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Cameron Simpson
perclass inits get to run. This givens you full control to sompletely replace some superclass' init with a custom one. By calling super().__init__() we're saying we not replacing that stuff, we're running the old stuff and just doing something additional for our subclass. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Cameron Simpson
On 27Mar2023 12:03, Cameron Simpson wrote: On 27Mar2023 01:53, Jen Kris wrote: But that brings up a new question.  I can create a class instance with x = BinaryConstraint(), That makes an instance of EqualityConstraint. Copy/paste mistake on my part. This makes an instance of

Re: Standard class for time *period*?

2023-03-28 Thread Cameron Simpson
I'm not sure I understand Loris' other requirements though. It might be hard to write a general thing which was also still useful. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Standard class for time *period*?

2023-03-29 Thread Cameron Simpson
On 30Mar2023 10:13, Cameron Simpson wrote: I do in fact have a `TimePartition` in my timeseries module; it presently doesn't do comparisons because I'm not comparing them - I'm just using them as slices into the timeseries data on the whole. https://github.com/cameron-s

Re: Standard class for time *period*?

2023-03-29 Thread Cameron Simpson
n the whole. https://github.com/cameron-simpson/css/blob/0ade6d191833b87cab8826d7ecaee4d114992c45/lib/python/cs/timeseries.py#L2163 But it would be easy to give that class `__lt__` etc methods. You're welcome to use it, or anything from the module (it's on PyPI). Cheers, Cameron Simps

Re: Python file location

2023-03-29 Thread Cameron Simpson
cs/ for my modules, which are all named "cs.*" (avoids conflict). But that's just me. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Looking for package/library to extract MP4 metadata

2023-04-10 Thread Cameron Simpson
e knitty gritty you could try my `cs.iso14496` package, which has a full MP4/MOV parser and a hook for getting the metadata. Not as convenient as ffprobe, but if you care about the innards... Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Weak Type Ability for Python

2023-04-12 Thread Cameron Simpson
time with Java, being staticly typed). Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Weak Type Ability for Python

2023-04-12 Thread Cameron Simpson
On 13Apr2023 03:36, MRAB wrote: I thought that in Java you can, in fact, concatenate a string and an int, so I did a quick search online and it appears that you can. I stand corrected. I could have sworn it didn't, but it has been a long time. - Cameron Simpson -- https://mail.pytho

Re: Fwd: pip is not installed

2023-04-16 Thread Cameron Simpson
install some package "foo". Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Question regarding unexpected behavior in using __enter__ method

2023-04-20 Thread Cameron Simpson
j.y". The means that what happens to a name when you define the class depends on the typeof the value bound to the name. A plain function gets turned into an unbound instance method, but other things are left alone. When you went: __enter__ = int That's not a plain function and so "obj.__enter__" doesn't turn into a bound method - it it just `int`. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Cameron Simpson
if not ok: ... not all directories made ... 2 notes on the above: - catching Exception, not a bare except (which catches a rather broader suit of things) - reporting the other exception Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Cameron Simpson
There are plenty of similar situations. Because of this I usually am prepared to make a missing final component with mkdir(), but not a potentially deep path with makedirs(). Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: double bracket integer index in pandas; Is this a legal syntax

2023-05-03 Thread Cameron Simpson
lying this index: [1] which is a list of ints (with just one int). Have a look at this page: https://pandas.pydata.org/docs/user_guide/indexing.html If you suppply a list, it expects a list of labels. Is 1 a valid label for your particular dataframe? Cheers, Cameron Simpson --

Re: double bracket integer index in pandas; Is this a legal syntax

2023-05-03 Thread Cameron Simpson
column. versus: df[ [0] ] # spaces for clarity makes a new dataframe with only the first column. A dataframe can be thought of as an array of Series (one per column). Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: What do these '=?utf-8?' sequences mean in python?

2023-05-09 Thread Cameron Simpson
8?B?" Aye. Specification: https://datatracker.ietf.org/doc/html/rfc2047 You should reach for jak's suggested email.header suggestion _before_ parsing the subject line. Details: https://docs.python.org/3/library/email.header.html#module-email.header Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use instead of nntplib?

2023-05-16 Thread Cameron Simpson
On 16May2023 09:26, Alan Gauld wrote: On 15/05/2023 22:11, Grant Edwards wrote: I got a nice warning today from the inews utility I use daily: DeprecationWarning: 'nntplib' is deprecated and slated for removal in Python 3.13 What should I use in place of nntplib? I'm curious as to why

Re: Tkinter (related)~

2023-05-18 Thread Cameron Simpson
it is part of the stdlib. On some platforms eg Ubuntu Linux the stdlib doesn't come in completely unless you ask - a lot of stdlib packages are apt things you need to ask for. On my Ubunut here tkinter comes from python3-tk. So: $ sudo apt-get install python3-tk Cheers, Cameron Si

Re: Tkinter docs?

2023-05-24 Thread Cameron Simpson
On 24May2023 02:18, Rob Cliffe wrote:     There doesn't seem to be any decent documentation for it anywhere. Already mentioned in the replies, I use this: https://tkdocs.com/shipman/index.html quite a lot. -- https://mail.python.org/mailman/listinfo/python-list

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Cameron Simpson
uff to an external system programme. I've used the Python llfuse library to implement a filesystem in Python. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Cameron Simpson
to do. They're great for physical repair though, which again is an explicit example of a particular fixed task. Repaired our stand mixer with reference to a good video. Would not want to use a video to learn the theory of stand mixer design. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: conceptual problem (was: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Cameron Simpson
# put some in _a self._b = x - x2# put the rest in _b # you can still do this, but it calls methods now x = o.x o.x = 9 So Python supports OOP practices but doesn't enforce them. Adopt the degree of discipline you think best. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Exploring terminfo

2021-01-15 Thread Cameron Simpson
ically >states that it writes to stdout. If you want an example of code using the curses.ti* functions with arbitrary Python files, have a gander at this: https://hg.sr.ht/~cameron-simpson/css/browse/lib/python/cs/upd.py?rev=tip It's on PyPI if you want easy installation in addition

Re: Python flask logging: two different formats, but want one format

2021-01-21 Thread Cameron Simpson
> >What do I need to do to get vmware_exporters_support.py to use the same >logging format as update.py? > >BTW, update.py is the __main__, not vmware_exporters_support.py. Can you pass the logger you get from create_logger(app) to the vmware_exporters_support setup function? That way you could tell it to use your preferred logger. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: list() strange behaviour

2021-01-23 Thread Cameron Simpson
stance attributes directly as above or provide a reset method of some kind. If you don't need to fiddle/reset you can just write: for x in G(9): The two step above is so we have "g" to hand to do the fiddling. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.

2021-01-26 Thread Cameron Simpson
t how you _choose_ to debug. Usually I have the code in a file in one window and a command line in another, and go: python my_code_file.py ... to test when debugging. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.

2021-01-26 Thread Cameron Simpson
ld presume from this that the "person" object at the bottom of the traceback is the "raw_person" called above it. But I do not see raw_person defined anywhere. Are you sure you didn't mean to pass "raw_neo" instead of "raw_person"? That would be more normal, since you're iterating over "raw_objects". Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Response for PING in ircbot.

2021-01-30 Thread Cameron Simpson
ction was closed before you sent your reply. More detail needed, particularly: how is the socket set up, and what's doing the sending of the "ping"? Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Convert MBOX thunderbird to PST outlook

2021-02-07 Thread Cameron Simpson
dea about, alas. CalDAV for the calendar? I know that's a vague and unspecific suggestion. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Python subinterpreters with separate GILs

2021-02-10 Thread Cameron Simpson
exclusive user of objects - that's what the GIL means. Separate GILs would mean different realms' GIL-holding threads could run against a shared object at the same time. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: mutating a deque whilst iterating over it

2021-02-11 Thread Cameron Simpson
e_ your change in the former case. Not necessarily that it wouldn't want to. I confess to not being sure that appending to a deque during an iteration should be a bad thing, except that with a bounded deque that might entail discarding the element at your current iteration point. Mayb

Re: editor recommendations?

2021-02-26 Thread Cameron Simpson
gers know vim. Some others' fingers know emacs. So I mostly get my colours from my terminal setup, which means I have a consistent dark theme for most of my activities: editing, shells and email (mutt). And I have my terminal panes which don't have the keyboard focus slightly di

weirdness with list()

2021-02-27 Thread Cameron Simpson
robably going to have to fix that - some subclasses are actually namedtuples where __len__ would be the field count. Ugh. Still, thoughts? I'm interested in any approaches that would have let me make list() fast while keeping __len__==binary_length. I'm accepting that __len__ !=

Re: weirdness with list()

2021-02-28 Thread Cameron Simpson
On 28Feb2021 10:51, Peter Otten <__pete...@web.de> wrote: >On 28/02/2021 01:17, Cameron Simpson wrote: >>I noticed that it was stalling, and investigation revealed it was >>stalling at this line: >> >> subboxes = list(self) >> >>when doing the MDAT

Re: weirdness with list()

2021-02-28 Thread Cameron Simpson
l: >""" >The list constructor does not overallocate the internal item buffer if >the input iterable has a known length (the input implements __len__). >This makes the created list 12% smaller on average. (Contributed by >Raymond Hettinger and Pablo Galindo in bpo-33234

Re: weirdness with list()

2021-03-01 Thread Cameron Simpson
t;>> list(a) >[] >>>> print(time.time() - s) >0.16294455528259277 3.9.1 on MacOS: 14.529589891433716 3.9.2 on MacOS: instant again Interesting. - Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: yield from () Was: Re: weirdness with list()

2021-03-02 Thread Cameron Simpson
On 28Feb2021 23:47, Alan Gauld wrote: >On 28/02/2021 00:17, Cameron Simpson wrote: >> BUT... It also has a __iter__ value, which like any Box iterates over >> the subboxes. For MDAT that is implemented like this: >> >> def __iter__(self): >> yield f

Re: weirdness with list()

2021-03-02 Thread Cameron Simpson
o answered. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: yield from () Was: Re: weirdness with list()

2021-03-02 Thread Cameron Simpson
results. Which is a primary goal in Go's design. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Why assert is not a function?

2021-03-05 Thread Cameron Simpson
available in >the exception output. That's definitly valuable. Did we all see the recently announced ycecream PyPI module? Very cool! See: https://github.com/salabim/ycecream Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: editor recommendations?

2021-03-07 Thread Cameron Simpson
On 03Mar2021 10:00, Lele Gaifax wrote: >Cameron Simpson writes: >> My fingers know vim. Some others' fingers know emacs. > >Emacs has also an Evil[1] mode, that mimics some vi/vim features. Whenever I've tries emulate-vi modes they tend to lack some coner case known

Re: Best practices regarding PYTHONPATH

2021-03-09 Thread Cameron Simpson
ubmodule.fixtures import these_things And I'm usually happy to go up an additional level: from ..package2.fixtures import those_things Somewhere around 3 dots I start to worry about presuming too much, but that is an arbitrary decision based on the discipline (or lack of it) in the project naming. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Why assert is not a function?

2021-03-11 Thread Cameron Simpson
em. >Having assert be a function would not make it much harder to get rid >of. It would just make it harder to get the text. Hah. I repeat my mention of the ycecream package - very neat! Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Why assert is not a function?

2021-03-11 Thread Cameron Simpson
ery/particular >situations... I find assert visually low impact. Try/except is quite wordy and brings more indentation. One has to keep in mind the use case. For me, try/except is for when something might reasonably "go wrong" in normal use, even niche normal use. Whereas assert is for things which should _never_ occur. Roughly, again for me, try/except if for catching misuse and assert is for catching misdesign/misimplementation. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: .title() - annoying mistake

2021-03-19 Thread Cameron Simpson
rrect results. Don't get hung up that it didn't do what you want, recognise that it does something simple and work with that limitation. Or make your own, likely as part of a more complex library with deeper understanding of language. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: .title() - annoying mistake

2021-03-20 Thread Cameron Simpson
gt;> >But that's exactly what he's doing, with a result which is documented, >but not really satisfactory. Not to mention that the .title method _predates_ Python's use of Unicode in strings. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: .title() - annoying mistake

2021-03-20 Thread Cameron Simpson
On 20Mar2021 23:18, Jon Ribbens wrote: >On 2021-03-20, Cameron Simpson wrote: >> Not to mention that the .title method _predates_ Python's use of >> Unicode >> in strings. > >Well, it predates Python's use of Unicode in the default string type, >bu

Re: convert script awk in python

2021-03-23 Thread Cameron Simpson
ny need for user variables at all. But at "1.5, Counting" is the sentence: Awk variables used as numbers begin life with the value 0, so we don't need to initialise emp. Which is great for writing ad hoc scripts, particularly on the command line. But not a great style for anything complex. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: convert script awk in python

2021-03-24 Thread Cameron Simpson
r the like to get a tally. I totally agree that once you're processing a lot of data from places or where a shell script is making long pipelines or many command invocations, if that's a performance issue it is time to recode. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Code Formatter Questions

2021-03-28 Thread Cameron Simpson
ecific tuning isn't what you want. (Or patch yapf to add the tuning, maybe.) For example, if some formatter gets you 95% if the way there, maybe you can apply your type annotation special case with a simpler tool (eg, for me, sed) since you can have more confidence in the physical code lay

Re: memory consumption

2021-03-30 Thread Cameron Simpson
o I think >it's not a memory leak, but rather Python wont release allocated memory back >to OS. Maybe I'm wrong. I don't know enough about Python's "release OS memory" phase. But reducing the task memory footprint will help regardless. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Using pytest, sometimes does not capture stderr

2021-04-04 Thread Cameron Simpson
red. By contrast, module_1.py looks up sys.stderr inside msg(), and finds the new one the code harness put at sys.stderr. So it writes to the thing that captures stuff. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Using pytest, sometimes does not capture stderr

2021-04-04 Thread Cameron Simpson
On 05Apr2021 13:56, David wrote: >On Mon, 5 Apr 2021 at 13:44, Cameron Simpson wrote: >> On 05Apr2021 13:28, David wrote: >> >Can anyone explain why the module_2.py test fails? >> >Is it because stderr during module import is not the same as during test? >> &g

Re: Error 2503

2021-04-12 Thread Cameron Simpson
e Python prompt and vice versa. >I've decided to uninstall it and then the error 2503 occurred. CWhat process did you do for the uninstall? If you're on Windows, I at least am not a Windows person. But others on this list are. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Comparing text strings

2021-04-12 Thread Cameron Simpson
ackage file, and update your record that to the new one. Note that this depends on sorting by version. A lexical sort (eg "ls|sort") will look good intil a package version crosses a boundary like this: 1.9.1 1.10.0 A lexical sort will put those the other way around because "9" > "1". Wrongness will ensue. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Comparing text strings

2021-04-12 Thread Cameron Simpson
On 12Apr2021 19:11, Rich Shepard wrote: >On Tue, 13 Apr 2021, Cameron Simpson wrote: >>Alternatively, and now that I think about it, more simply: _if_ the >>package files can be sorted by version, then all you need to do is read a >>sorted listing and note that latest fil for

Re: Repair Install of 64 bit python

2021-04-16 Thread Cameron Simpson
: it definitely installs in the Python you'd be running. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Determine what the calling program is

2021-04-18 Thread Cameron Simpson
d ps sniffing is racey, in addition to its other issues. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Determine what the calling program is

2021-04-19 Thread Cameron Simpson
On 19Apr2021 23:13, Peter J. Holzer wrote: >On 2021-04-19 08:54:06 +1000, Cameron Simpson wrote: >> My personal preference is lock directories. Shell version goes like >> this: >> >> if mkdir /my/lock/directory/name-of-task >> then >>

Re: learning python ...

2021-05-23 Thread Cameron Simpson
provides a print() function which withdraws the status lines, runs the builtin print, then restores them, allowing normal idiomatic use of print() in scripts making use of the status lines. Similar situations abound. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: learning python ...

2021-05-24 Thread Cameron Simpson
On 24May2021 08:21, hw wrote: >On 5/24/21 12:03 AM, Cameron Simpson wrote: >>On 23May2021 21:02, Stestagg wrote: >>>On Sun, 23 May 2021 at 20:37, hw wrote: >>>>I don't know about shadowing. >>> >>>Shadowing is effectively saying “within thi

Re: learning python ...

2021-05-24 Thread Cameron Simpson
On 24May2021 16:17, hw wrote: >On 5/24/21 11:33 AM, Cameron Simpson wrote: >>Note that in this function: >> >> x = 1 >> y = 2 >> >> def f(a): >> x = 3 >> print(x, y) >> >>"x" is local, because t

Re: learning python ...

2021-05-24 Thread Cameron Simpson
t, or when you pass it to a function, you're not copying the storage, just the reference. Same with Python, except that all the basic types like int and float are also done with references. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: learning python ...

2021-05-24 Thread Cameron Simpson
o away, even when they are no longer >referenced? Well, the builtins module itself has a reference. But what greg's showing you above it the "int" class/type. You've got an in in play in the code above - the class will of course exist. But the builtin classes (and other names) always exist because they're built in. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: imaplib: is this really so unwieldy?

2021-05-25 Thread Cameron Simpson
se (data bytes) into some higher level thing (such as UIDs in your case, but you can ask for all sorts of weird stuff with IMAP). So having passed '(UID)' to the SEARCH request, you now need to parse the response. >This so totally awkward and unwieldy and involves so much overhead

Re: imaplib: is this really so unwieldy?

2021-05-25 Thread Cameron Simpson
>>>> exit() !!!! I have learned a new thing today. Regardless, hw didn't call it, just named it :-) Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: imaplib: is this really so unwieldy?

2021-05-25 Thread Cameron Simpson
On 25May2021 19:21, hw wrote: >On 5/25/21 11:38 AM, Cameron Simpson wrote: >>On 25May2021 10:23, hw wrote: >>>if status != 'OK': >>>print('Login failed') >>>exit >> >>Your "exit" won't do what you want.

Re: string storage [was: Re: imaplib: is this really so unwieldy?]

2021-05-26 Thread Cameron Simpson
dle of an arbitrary stream of UTF8 bytes and find the character boundaries. That doesn't solve slicing/indexing in general, but it does avoid any risk of producing mojibake just by starting your decode at a random place. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: imaplib: is this really so unwieldy?

2021-05-27 Thread Cameron Simpson
On 27May2021 18:42, hw wrote: >On 5/26/21 12:25 AM, Cameron Simpson wrote: >>On 25May2021 19:21, hw wrote: >>>On 5/25/21 11:38 AM, Cameron Simpson wrote: >>>>On 25May2021 10:23, hw wrote: >>You'd be surprised how useful it is to make almost any standalon

Re: Pandas: How does df.apply(lambda work to create a result

2021-05-27 Thread Cameron Simpson
nfess I subscribe to the python-list mailing list, not the newsgroup. It has much much less spam, and the two are gatewayed so you can particpate either way. For example, you've posted to the newsgroup and I'm seeing your post in the mailing list. Likewise my reply will be going to the mailing list and copied to the newsgroup. Come on over to the mailing list. It is rumoured to be much quieter. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Applying winpdb_reborn

2021-05-28 Thread Cameron Simpson
'TERM') that way the offending code can at least find the name RPDBTERM in the builtin names (just like "print" can always be found). It's a hack, but will at least make that line work. I do not know if the value of your $TERM environment variable is suitable,

Re: Applying winpdb_reborn

2021-05-28 Thread Cameron Simpson
ay, try it. There's no need to hack your .profile; you can do things like this at the command prompt for experiments: export RPDBTERM=$TERM then run the programme. BTW, that is statement looks like it is explicitly trying to handle lack of the envvar. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Applying winpdb_reborn

2021-05-29 Thread Cameron Simpson
point to trip, then inspect the programme variables. In your example above I'd blithely imagine checking that the list of widgets I expected were in fact constructed, etc. But I'd also be littering my window setup with progress print calls :-) Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Applying winpdb_reborn

2021-05-29 Thread Cameron Simpson
On 30May2021 09:03, Cameron Simpson wrote: >>I knew the debugging process with Fortran and C, but haven't learned >>how to effectively use pdb to find bugs that don't issue a traceback or >>obvious >>wrong answer such as my module displaying an empty window w

Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-05-30 Thread Cameron Simpson
in the other window. I'd also think one could do some kind of shuffle setting up curses to attach its display to another terminal, letting you use an interactive debugging in the invoking terminal. Haven't tried this yet. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-05-31 Thread Cameron Simpson
On 30May2021 20:36, Dennis Lee Bieber wrote: >On Mon, 31 May 2021 08:07:21 +1000, Cameron Simpson >declaimed the following: >>Open another terminal, note its terminal device with the "tty" >>command. >>Start your programme like this: >>pytho

<    1   2   3   4   5   6   7   8   9   10   >