ing as it once did, there's plenty of other 'inspiration', eg a
parallel discussion 'here' about the virtues of a programmer positioning
dialog(ue)s/windows or leaving it to the window manager...
I'll give it some thought - as long as Fridays keep coming!
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list
uch as
when to use radio-buttons and when check-boxes. I can't tell you if the
gtk, qt, or wx people offer something similar...
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list
an't instantiate i/Image directly" )
class Non_Image( Image ):
def load_file( self, filename:str ):
"""This looks reasonable."""
try:
n = Non_Image( "Under Exposed" )
except TypeError:
print( "Sorry, n/Non_Image does not look good" )
class PNG_Image( Image ):
def load( self, filename:str ):
"""Load PNG file."""
def save( self, filename:str ):
"""Save to PNG file."""
p = PNG_Image( "Picture of the Artist as a Young Man" )
print( "p has instantiated successfully" )
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
ly might it have been literally the end of (your) day. This
conversation does seem to have reached the point of reductio ad absurdum!
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list
keenly appreciate (that makes
me "[feel] good", to borrow your words), is that not only are "batteries
included", but I don't have to carry-around any 'spare batteries' that I
don't actually need right now!
(even more applicable when using MicroPython, etc)
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list
;
> It's a common condition.
There are three components:
1 From the Greek: "con" meaning 'against' or 'unable'.
2 From tech-jargon (and the Australian habit of shortening every word in
the English language): "fuzz" is the contraction of two highly-technical
terms, famously applied in intro courses and by naive job-interviewers.
3 From English: the suffix "ed" meaning past tense.
Thus, (smirking!) "confuzzed" is the psychological term for people who
have never been able to bend their minds around the "fizz-buzz" coding
challenge.
PS am running for cover before @Chris reads this...
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list
e general public are of
the order of tens of mega-bytes. (a URL might help people trying to
replicate the problem!)
Be advised that everyone 'here' is a volunteer. Please help us to help you!
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list
me (odd) suffix, then why not slice the
string [ :-2 ]?
Alternately, consider str.translate() where both character codes are
removed, regardless of location.
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
nteracted with.
This mailing list strips many attachments. Please copy-paste.
First step is to check the target HTML-page to ensure it does actually
have a class of that name.
Whilst used by many CSS-tools, is the double-dash/hyphen intended?
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
he pythonic idiom for iterating
over a container.
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
that have not (yet)
been updated to run on Python 3.9. Your solution is the current advice.
However, I'm concerned about mathematical applications on 32-bit
platforms. Did you try Python 3.8's 64-bit option (plus libraries)?
NB this is an English-language list - for faster response
(particularly the Beginner's Guide)
https://www.python.org/doc/ (for everything, but start with "Using Python")
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
ts are managed by a single person. This list is a
great meeting-place to find others who might share your particular
interest - and further, who might be prepared to collaborate - as the
saying goes "scratch your own itch". Is this what you seek? Has the
choice of language/approach in this conve
On 12/02/2021 08.53, Chris Angelico wrote:
> On Fri, Feb 12, 2021 at 6:47 AM dn via Python-list
> wrote:
>> 3
>> My mind is whirling in an attempt to understand "show me a better time".
>> Does this perhaps indicate that @Chris' social life leaves somet
also allows deque-mutation, then the first value(s),
previously printed, will no longer exist within the queue.
I'm enjoying the question: wither inconsistency? Perhaps someone (wiser)
will jump in...
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
to MSFT, why not suggest VSCodium
(https://vscodium.com/) - the same open-source IDE, before any such
'extras' are added.
Disclaimer: I do not use or publish Idle, VS-Code, or VSCodium, and have
nothing to gain/lose by MSFT collecting data about what you are doing
with the help of 'their' product.
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
hen used in "folding" and "unfolding", as described in section
2.2.3. All field bodies MUST conform to the syntax described in
sections 3 and 4 of this specification.
...
>>>
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
On 16/02/2021 07.09, Ethan Furman wrote:
> Thank you to those who pointed out this individual to the moderators. As
> Mr. Flibble accurately noted, he is not on the mailing list -- so his
> posts won't be here either.
Appreciating the work you(s) invest on my/our behalf!
--
o execute, which made it
a competent fore-runner of Micro-Python (etc) in the micro and
single-board computer arenae/arenas.
Without Python, I think I'd prefer to use (an updated) UCSD-Pascal or
Borland Turbo-Pascal to this very day! PL/I, not so much - even on a
mainframe project!
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
t-like #list data structure
maintains the sequence of its elements, a set #set is not required to do
so. Thus, if "k" were a set, what is produced on your machine may be
different to what happens on mine/no guarantees:
Possibly @Wolfgang's machine =
>>> k
{ 'one', 'two' }
Possibly @dn's machine =
>>> k
{ 'two', 'one' }
Thus no guarantee that when we try to re-combine keys and values they
would correspond correctly!
- and if we applied the same to data - even worse: combinatorial issue!
Web.Refs:
#repr:
https://docs.python.org/3/reference/datamodel.html#basic-customization
#list: and #set:
https://docs.python.org/3/reference/datamodel.html#the-standard-type-hierarchy
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
ow has the student proven that (s)he has learned the material?
(apologies for criticism: I readily assume your motivation was to be
helpful)
The problem is a Caesar Cipher - disguised, because most examples/usage
of such is for alphanumeric messages. This topic is often used for ComSc
examples to demonstrate modulo arithmetic and/or circular data
structures, eg a bounded-queue (per other's responses).
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
the system is 'clean', then
start-again...
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
guage into Python?
Thereafter tackle problems two and three.
We don't know your level of Python skill. So, let us know how you
get-on, and come back with sample code, if you strike a problem at any step.
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
t; 71 208 217 266 279 290 458 478 523 614 766 853 888 944 969
> 43 70 176 204 227 334 369 480 513 703 708 835 874 895
> 25 52 278 730
> 151 432 504 830 890
Great!
For what purpose - is this a 'homework assignment'?
What code do you have so far?
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
lem into smaller units of code
("subroutines"), and checking that each of them works (correctly).
Alternately, I follow a practice called "TDD" (Test-Driven Development),
whereby each large problem is broken-down into subroutines, and then
each subroutine is individually created and tested. Further tests will
ensure that as the smaller-units are combined, they work-together
correctly. Finally, when all are combined, we expect that the entire
system will work.
The original code appeared to work, but one small part (ie do these
divisors reveal that the number is "perfect"?) was not correct.
Accordingly, the whole program[me] failed.
The (great) people who create the Python language and its interpreter
did not let us down!
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
ment and self-banishment
- and a protagonist whose Last Will and Testament read:
"That Elizabeth-Jane Farfrae be not told of my death, or made to grieve
on account of me. that I be not bury'd in consecrated ground. that no
sexton be asked to toll the bell. that nobody is wished to see my dead
body. that no murners walk behind me at my funeral. that no flours be
planted on my grave, that no man remember me."
RiP - and this thread also!
--
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
the
point:-
(Scenarios 1 and 2, plus leaving the asserts to run in case of
'accidents' during production-execution)
When testing the integrity of some collection of data, why use assert
over raising a descriptive and class-identified exception?
Both can be trapped by 'higher-level' code. Both can provide
text-planations.
Is assert so much faster/cheaper than try...except...raise?
--
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
MP4). Am working
on a similar container format at the moment, where the length of
sub-components may be reported in bytes (if not delineated by 'markers').
So, there are many reasons why "bytes" is a 'good' measure of length -
in this context.
Is it "misusing __len__" in a class/object designed to manipulate such
files? Hope not!
(or I'm 'in trouble' - again...)
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
On 12/03/2021 11.27, Chris Angelico wrote:
> On Fri, Mar 12, 2021 at 9:10 AM Ethan Furman wrote:
>>
>> On 3/11/21 1:45 PM, dn via Python-list wrote:
>>
>>> Is assert so much faster/cheaper than try...except...raise?
>>
>> Infinitely faster when they ar
t;; or you can use both components, eg
open( os.path.join( path, file_name )...
So, now by setting the "path" according to "that folder", and adding the
requisite file-name(s), will that answer the need?
Remember that a path may be "absolute" or "relative", according to need.
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
PYTHONPATH, you will either have to provide a mechanism
to install such for your users, or ask them to do it manually!
(hint: users want to play the game, so don't expect them to be *nix
command-line experts)
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
el Suit'
>
> should be
>
> 'The Man in the Grey Flannel Suit'
To be fair, aren't book-titles* a (formalised) sub-set of the English
language?
https://www.librarianshipstudies.com/2018/12/anglo-american-cataloguing-rules-aacr.html
* plays, movies, ...
See also people's/family-names which have been anglicised or
transliterated...
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
cal trap' here - that the
documentation is in English, but that the feature's application is
language-agnostic.
Perhaps the bigger trap is "SODD"! (Stack Overflow-Driven Development -
dn patent pending) Specifically, from where do we learn, the
authoritative (or otherwise) na
facilities, or to re-use Python's own names
to customise functionality. You have complete freedom to use Python in
any way(s) you see fit. Thus:-
Freedom
noun
UK /ˈfriː.dəm/ US /ˈfriː.dəm/
the condition or right of being able or allowed to do, say, think, etc.
whatever you want to,
e language to another can play mind-games with us. What
makes sense in one; may be right, OK, or possibly even plain-wrong, in
another. For (obvious) example, Python is unusual in that (in some
places) horizontal-spacing is a part of the language, but quite optional
in others. Accordingly, trying
r you spent time helping me with a
design/coding problem, helping debug, and/or reviewing/improving my code
(and I for you); than we had not time left-over after spending many
hours and much mental energy arguing about whether this format is [more]
right than that!
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
rt copy
dod = {
"alice":
{
"lang": "python",
"level": "expert"
},
"bob":
{
"lang": "perl",
"level": "noob"
}
}
original = copy.deepcopy( dod )
lod = []
for name in dod:
d = dod[name]
d["name"] = name
lod.append(d)
print( original == dod )
pp(dod)
pp(original)
False
{'alice': {'lang': 'python', 'level': 'expert', 'name': 'alice'},
'bob': {'lang': 'perl', 'level': 'noob', 'name': 'bob'}}
{'alice': {'lang': 'python', 'level': 'expert'},
'bob': {'lang': 'perl', 'level': 'noob'}}
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
On 31/03/2021 19.24, Loris Bennett wrote:
> dn writes:
>
>> On 31/03/2021 01.22, Loris Bennett wrote:
>>> Jon Ribbens writes:
>>>> On 2021-03-30, Loris Bennett wrote:
>>>>> If I have dict of dicts, say
>>>>>
>>>>>
ment, to let his mind unwind and return to (what passes
as) 'reality']
Without looking into the details/context: surely there's a more
straightforward approach?
As to this, I'm slightly amused, but perhaps not in a good way:
class Sanatorium( Building ):
patient_name = "
On 01/04/2021 13.54, Chris Angelico wrote:
> On Thu, Apr 1, 2021 at 11:39 AM dn via Python-list
> wrote:
>>
>> On 01/04/2021 12.14, Chris Angelico wrote:
>>> I think this code makes some sort of argument in the debate about
>>> whether Python has too
true!
We all know you are ham-ming it up*...
However, after some reflection, is the bot part not true?
* slang term: https://idioms.thefreedictionary.com/hamming+it+up
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
d more generally
as "food" or "meal". That said, "tuck in" is certainly slang for 'start
eating [your meal]'.
However, the phrase "best bib and tucker" means "Sunday best" clothing
or 'dressing for dinner. Those who are still following-along in the hope
of a Python reference may like to contemplate the similar implications
carried by "The Monty Python Matching Tie and Handkerchief".
From "tuck" we get "tuck shop" (which Wikipedia tells us is indeed
closely-related to schools and confectionery
(https://en.wikipedia.org/wiki/Tuck_shop)!).
With that understanding(?) or allusion you may feel equipped to realise
the specialty nature of the "cheese shop", and thus the
Monty-Pythonesque previous name for PyPi!
Toodle-pip!
(https://en.wiktionary.org/wiki/toodle_pip)
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
On 02/04/2021 21.32, Alan Gauld via Python-list wrote:
> On 02/04/2021 00:42, dn via Python-list wrote:
>
>> Contrarily "tuck" in (old) English slang represented "sweets" (or
>
> Not that old. We still use it occasionally today. And we
> certainly had
On 02/04/2021 13.00, Chris Angelico wrote:
> On Fri, Apr 2, 2021 at 10:43 AM dn via Python-list
> wrote:
>>
>> On 02/04/2021 10.13, Chris Angelico wrote:
>>> Well, it's a simple matter of chronology. First you have crude oil,
>>> then time passes, and th
nds you into submission?
Perhaps you have different approaches depending upon the number of
objects in the 'list' and the proximity of column-79, or by nature of
the application?
--
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
ome
of the 'squares' are significantly larger/smaller than others!
> I'd upload a patch for that, but it doesn't seem to be
> open source. At least I can't find it on chochub.
Recommend you use our local facility:
https://git.nzoss.org.nz/users/sign_in
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
r crude above/to-the-left?"
>
> Cognitive burden slows down and fatigues.
+1
> Alternatively, if the data "fits together", use a `namedtuple` with kwarg
> initialisation or structured data types like `dataclasses`.
Whereas the other formats cannot, it would be very easy to turn an (a)
type of list into a dataclass!
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
( x=0, y=0, z=None ):
...
...
starting_coordinates = coordinates( x=1, y=2, z=3 )
This is 'self-documenting'. Thus no need for explanatory comments.
Using a structured-object, we have the capability to do more with the
data, either as an entity or individually, eg
def move_horizontally( delta=1 ):
self.x += delta
Of course, it all hinges on how the data-items will be used after the
initialisation stage. There is utterly no point in coding a class merely
to shorten an initialisation-phase! (Same logic applies to named-tuples)
Did you spot how various contributors identified when they prefer one
method in a specific situation, but reach for another under differing
circumstances!
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
the above/
> print(x)
>
> # This function divides two numbers
> def divide(x, y):
> return x / y
Why use a function instead of operating in-line?
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
#x27; the equals/assignment.
Thus, the answer to your question is a matter of style, and thus the
understanding of those who might read the code.
FWIW: I leave them out because it is easier on my eyes whilst scanning
the line of code.
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
On 12/04/2021 22.32, Chris Angelico wrote:
> On Mon, Apr 12, 2021 at 8:20 PM dn via Python-list
> wrote:
>>
>> On 12/04/2021 20.29, Steve Keller wrote:
>>> Just a short style question: When returning multiple return values, do
>>> you use parenthesis?
>>
x27;s there to stop some nefarious/stupid user (like me!)
entering "gobbledegook" and complaining that the program fails?
--
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
' - or are they 'ideas' - might be!
Here's another: "YAGNI" (You Aren't Going to Need It) - don't try to
make a simple program into the be-all-and-end-all just in-case some
idiot (I mean: nice person, like me) comes along asking for
database-output. That said, designing for 'independence' will facilitate
such extensions, should they (ever) be required.
- and another: "YMMV" (Your Mileage May Vary) - from the motor industry
expecting us to excuse their outlandish claims about how little fuel a
car requires/how many miles or km it will travel on a single
electric-charge. We apply it to say that what my team thinks is 'the one
true way' to do things, may be quite different to what you/your team
think is 'correct'!
NB 'umble scribe has (lazily) not tested these code-snippets
Web.Ref:
https://towardsdatascience.com/5-principles-to-write-solid-code-examples-in-python-9062272e6bdc
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
I know Debian actually does what
> you're looking for as a feature of the packaging system (apt-get
> autoclean), and the Fedora/RedHat universe does not, so I've also looked
> for what you're looking for :)
Not a sand-box I've played in. However, dnf is at least par
include a note that each file has/not been processed (plus any other
stats or logging you may deem appropriate). A third state would be 'in
process'. Now, at start-up, the application can quickly check to see if
there is any file in that state...
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
ll-attended PUG
meeting? (cf a PyCon)
Is it a 'failure', or a 'success'?
Are there reasons why someone might prefer StackOverflow to this list?
Are they more to do with the person, or something the Python Community
should address?
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
Builder(s)
Sundry tools built on PHP
- for varying definitions of F/LOSS and 'ad-hoc'!
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
and motivation behind them, or have they (perhaps)
had the effect of de-motivating the very people who seek to be helpful
(to you)?
Please note: The questions (above) are Socratic and rhetorical. No reply
is requested or required. They ask you to think about maintaining
constructive relationships. You certainly do not need to explain
yourself to us (nor us to you). Per the opening comment, the idea behind
this message is that we become better at helping each other...
--
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
t the same site.
There are plenty of books and both $free and paid courses available
on-line, to suit many preferred ways of learning, and covering many
specialised applications of the language.
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
eg "Monsoon Season". Thus,
are not appropriate for use amongst an international audience.
Web.Ref:
Amusing discussion of ISO 8601:2019 (not the usual dry and turgid
documentation one expects from a standards organisation)
https://www.iso.org/news/2017/02/Ref2164.html
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
f files from which the data has been extracted, and the second
containing the data currently formatted as a dict. NB The second may
benefit from stating in "normal form" or splitting into related tables,
and certainly indexing.
Thus the process requires two steps: firstly to capture the data (from
the files) into the DB, and secondly to graph the appropriate groups or
otherwise 'chosen' users.
SQL will simplify data retrieval, and feeding into matplotlib (or
whichever tool). It will also enable simple improvements both to select
sub-sets of users or to project over various periods of time.
YMMV!
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
rt:
http://www.columbia.edu/cu/computinghistory/029.html
Those were the days...
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
t to more focussed functionality
...
eg an integer which may not hold a negative value, a string which may
not be empty...
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
how to enter code if it's not just
>> clicking on
>> the 'code' box before pasting text
>
> Last time I tried *before*, it did not work. paste, reselect (a
> nuisance) and click does.
Using text-mode email formatting and copy-pasting 'here', works well!
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
ot;Main branch" (or user-chosen alternative name). Will referring to
skilled professionals as 'masters (of their profession/craft)'
transgress (international or at least US-instigated) 'Political
Correctness'?
What do you think a professionally-recognisable series of skill-levels
for programmers?
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
gt; reply: b'221 2.0.0 Bye\r\n'
> reply: retcode (221); Msg: b'2.0.0 Bye'
>
> The SMTP part of the system is working (hence this message).
> The message from machine B correctly interprets "sysname" as
> sysn...@sysname.. i.e a valid addr4ess.
&
by reducing inter-connections,
then using tkinter and its tight-linkage to Python removes the need for
the (http) web-server.
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
t;polymorphism" can only deliver functionality according to the
characteristics of the specific data-type!
Having entered the queue-of-life a long time ago, and shuffling ever
closer to 'the end of the line', this memory-challenged 'silver-surfer'
prefers to reserve pop()
. was not a registered subdomain with
>> my ISP, whereas bach.. was registered. Sorted now.
>>
>
> I like your naming convention :)
He's playing your tune!
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
On 15/06/2021 21.37, BlindAnagram wrote:
> On 15/06/2021 00:11, dn wrote:
>> On 15/06/2021 09.18, BlindAnagram wrote:
>>> On 14/06/2021 20:43, Chris Angelico wrote:
>>>> On Tue, Jun 15, 2021 at 5:41 AM BlindAnagram
>> ...
> I think the difference here is th
s I'm building are both database applications. If
> tksheet() is not the most appropriate widget to display database tables
> what
> alternative would be better?
Use the DBMS by retrieving the data in the desired sequence?
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
ed "The
Python Standard Library". To use a library it must be import-ed into
your code.
Docs describing the library are available on-line, specifically the
turtle module (and some examples of its use) can be found at:
https://docs.python.org/3/library/turtle.html
Have fun!
--
Regards,
=dn
alues ) )
[('A', 'portfolioName')]
Now, have we simplified things to the point of being able to more-easily
code the update and filter?
PS I fear even that step is/those steps are more complicated than needed
- but you know your data and schema better than I!
Critique:
1 never,
essage, from
the terminal-session into an email response, and we'll try to help...
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
tem i of sequence a is selected by a[i].
Sequences also support slicing: a[i:j] selects all items with index k
such that i <= k < j. When used as an expression, a slice is a sequence
of the same type. This implies that the index set is renumbered so that
it starts at 0.
Some sequences also support “extended slicing” with a third “step”
parameter: a[i:j:k] selects all items of a with index x where x = i +
n*k, n >= 0 and i <= x < j.
>>>
So, now there is yet more alternate nomenclature for 'stride'. Plus
there is no mention of negative-values for index or bound!
For completeness:
- the above exclusively discusses using slices to 'get' data - what we
used to term "RHS", ie usage on the Right-Hand Side of an assignment. An
expression may involve an index or slice on the LHS, if (and only if)
the target-sequence is mutable (eg lists, but not strings or tuples).
- slices and subscriptions can be used in a del statement, but exactly
what this means "is determined by the sliced object".
(these are also topics for another day)
Finally, it is not forgotten that you want to code a loop which
simulates a slice with negative attributes. (although it is hoped that
after the above explanations (and further reading) such has become
unnecessary as a learning-exercise!)
Please recall that whilst a slice-object will not, a range-object will
work with a for-loop. So:
>>> rng = range( 4, 0, -1 )
>>> list( rng )
[4, 3, 2, 1]
>>> for index in rng:
... print( name[ index ], end=" " )
...
k c a >>>
Oops! This looks familiar, so apply the same 'solution':
>>> rng = range( 4, -1, -1 )
>>> list( rng )
[4, 3, 2, 1, 0]
>>> for index in rng:
... print( name[ index ], end=" " )
...
k c a J
The 'bottom line' is that such simulation code will become torturous
simply because indexes/indices follow different rules to slices!
Should you wish to persist, then may I suggest modifying mySlice(it,
beg, end, step = 1) to:
def my_slice( sequence, lower_bound, upper_bound, stride=1 ):
and first splitting the implementation's decision-tree into two paths,
according to whether the stride is positive or negative, before getting
into 'the nitty-gritty'.
Perversely (if not, foolishly) I have indulged (and can't recommend
it!). Nevertheless, if you are determined, I will be happy to forward
some test conditions, upon request (caveat emptor!)...
Web.Refs/Further reading:
https://docs.python.org/3/tutorial/introduction.html
https://docs.python.org/3/reference/expressions.html#primaries
https://docs.python.org/3/library/functions.html
https://docs.python.org/3/tutorial/controlflow.html
https://docs.python.org/3/library/stdtypes.html#typesseq
https://docs.python.org/3/library/stdtypes.html#ranges
https://docs.python.org/3/reference/simple_stmts.html
https://docs.python.org/3/glossary.html
https://web.archive.org/web/20190321101606/https://plus.google.com/115212051037621986145/posts/YTUxbXYZyfi
https://docs.python.org/3/reference/datamodel.html
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
On 12/08/2021 02.59, Jack Brandom wrote:
> dn writes:
>
...
>> Also, whereas I prefer to illustrate 'how it works', I perceive that you
>> are used to learning 'rules' and only thereafter their application (the
>> teaching-practice under which mos
#x27;while I'm doing this, adding ... will be easy
to do', aka "famous last words", see also "YAGNI".
Negative-stepping comes-across as a bit of a party-trick. I wonder if
anyone can offer a (professional) application?
Similarly, when adding a __getitem__() to a custom-class, has anyone had
need to implement/account for negative-stepping, to achieve some purpose?
PS I'm waiting (with bated breath*) for @Chris' bared teeth...
* or is that "baited"?
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
e
is/should be! Further that Python allows such a value to be used in
comparisons:
>>> None != None
False
>>> None == None
True
Leading to:
c, x, y = 0, None, None
while ...
Which solution reverts to the original loop-contents. which seem more
obvious and thus more readable. (YMMV!)
Simplicity over 'being clever'...
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
ly on
computers running the Hollywood Operating System).
Continuous Education:
Thanks for the reminder that enumerate() can be seeded with a "start" value!
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
On 29/08/2021 22.24, Chris Angelico wrote:
> On Sun, Aug 29, 2021 at 8:14 PM dn via Python-list
> wrote:
>> Efficiency:
>> - wonder how max( d ) == min( d ) compares for speed with the set() type
>> constructor?
>
> That may or may not be an improvement.
>
>&
On 30/08/2021 00.47, Peter Otten wrote:
> On 29/08/2021 12:13, dn via Python-list wrote:
>> On 29/08/2021 20.06, Peter Otten wrote:
>> ...
>>> OK, maybe a bit complicated... but does it pay off if you want to
>>> generalize?
>>>
>>>
ldn't understand/didn't believe me - yet I am completely correct.
(as always - cough, splutter, snort...)
Welcome to the last day of (what may be) your summer!
These things can be tricky...
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
On 01/09/2021 00.45, Chris Angelico wrote:
> On Tue, Aug 31, 2021 at 8:55 PM MRAB wrote:
>> On 2021-08-31 02:16, dn via Python-list wrote:
>>> On 31/08/2021 11.07, Dennis Lee Bieber wrote:
>>>> On Sun, 29 Aug 2021 19:49:19 -0700 (PDT), "hongy...@gmail
On 01/09/2021 09.13, Chris Angelico wrote:
> On Wed, Sep 1, 2021 at 6:38 AM dn via Python-list
> wrote:
>>> Yeah. I do recommend making good use of the IANA tzinfo database
>>> though (especially since Python 3.9 made that a bit easier to access),
>>> as it'
adan-hours" for 'flipping the switch' (in my
head) and turning a late-night owl, and stereotypical techie/hacker;
into an 'early bird'. Ironically such serves me well today - dealing
with clients and colleagues on the other side of the planet, who much
prefer me to wake-early, so that they don't have to interrupt their
evenings at home...
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
82% of New Zealanders approved of the 2007
extension to the period of daylight saving time.
The rationale for changing the time over the summer months is that more
sunlight hours will fall in the early morning if standard time is
applied year round. In summer, these early morning sunlight hours a
information.
>>>> from distutils import sysconfig
>>>> print sysconfig.get_python_inc()
> File "", line 1
> print sysconfig.get_python_inc()
> ^
> SyntaxError: invalid syntax
>>>>
> [/code]
>
> What is the proper
as/2009-April/004306.html
and
https://mail.python.org/archives/list/python-id...@python.org/thread/2VUZ3J6C4GSHGBZJW62AY4HPEEBMXAT6/#2VUZ3J6C4GSHGBZJW62AY4HPEEBMXAT6
PEP 548 https://www.python.org/dev/peps/pep-0548/
BDFL Rejection
https://mail.python.org/pipermail/python-dev/2017-September/149232.html
Python-Ideas post
https://mail.python.org/archives/list/python-id...@python.org/thread/EDNARFL2RGOE53SLWPTD5ZLJQOYSVDCR/#EDNARFL2RGOE53SLWPTD5ZLJQOYSVDCR
Duke Paper
https://users.cs.duke.edu/~ola/patterns/plopd/loops.html#loop-and-a-half
RegEx in Python https://docs.python.org/3/library/re.html
and https://docs.python.org/3/howto/regex.html
"bastardise" (meaning 1) https://www.dictionary.com/browse/bastardize
https://stackoverflow.com/questions/743164/how-to-emulate-a-do-while-loop
DRY
https://code.tutsplus.com/tutorials/3-key-software-principles-you-must-understand--net-25161
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
e readable layout.
It doesn't use a two-arg iter, but still rates because it does use a
relatively-obscure member of the itertools library...
https://docs.python.org/3.8/library/itertools.html#itertools.takewhile
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
On 11/09/2021 18.03, Chris Angelico wrote:
> On Sat, Sep 11, 2021 at 3:26 PM dn via Python-list
> wrote:
>>
>> On 31/08/2021 01.50, Chris Angelico wrote:
>>> On Mon, Aug 30, 2021 at 11:13 PM David Raymond
>>> wrote:
>>>>
>>>&
structure what is currently a 'teaching notes' or "script" document
(from which I was copy-pasting), and build a 'projector' program which
will run a sub-interpreter* to run exactly one 'step' of the
'live-coding' demo at a time (whilst also retaining the option of REPL
access, to be able prove or expose short-comings (nr 4, above), and
without revealing the 'what comes next'?
* rather than python -i; am considering Lib.runpy, and/or Lib.code
How might any of this relate to your interest?
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
wrote:
>> after answering 'no' or 'yes' after the last sentence I wrote, the
Are you using MS-Windows?
Are you executing the program directly/from the menu?
(or do you first start a terminal window, and then run Python within that)
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
own research, so I can give myself the data in any format that I
> like.
...
With that, why not code it as Python expressions, and include the module?
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
On 24/09/2021 14.07, Stefan Ram wrote:
> dn writes:
>> With that, why not code it as Python expressions, and include the module?
>
> This might create a code execution vulnerability if such
> files are exchanged between multiple parties.
The OP's spec, as quoted ea
mix
> them all in a single document (and there are tools available to validate
> your files). But those features make it very complex (you almost
> certainly don't want to write your own parser) and you really have to
> understand the data model (especiall namespaces) to use it.
and YAML?
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
ed,
overlaying hierarchy onto 3NF and using an RDBMS would be my first
thought - but because of the recursive JOINs, I recommend something more
capable than SQLite.
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
nly country to which your data applies.
> If there's a standard for your industry, or your company, or on
> some other level, then at least document what it is and that
> you're using it, so that the next person (which may be you a
> year from now) doesn't have to guess.
+1
*always* add unit attributes
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
c-facing gmail address?
(if the concern relates to having too many email addresses 'open to the
world', is Google the best 'gatekeeper' and privacy guard?)
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
6U
Article (rather brief) introducing YAML, of possible interest:
https://opensource.com/article/21/9/intro-yaml
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
irate stories:
long John # Silver
For those of us who remember/can compute in binary, octal, hex, or
decimal as-needed:
Why do programmers confuse All Hallows'/Halloween for Christmas Day?
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
201 - 300 of 540 matches
Mail list logo