On 2024-03-23 3:25 PM, Frank Millman via Python-list wrote:
It is not pretty! call_soon_threadsafe() is a loop function, but the
loop is not accessible from a different thread. Therefore I include a
reference to the loop in the message passed to in_queue, which in turn
passes it to
On 2024-03-22 12:08 PM, Thomas Nyberg via Python-list wrote:
Hi,
Yeah so flask does support async (when installed with `pip3 install
flask[async]), but you are making a good point that flask in this case
is a distraction. Here's an example using just the standard library that
exhibits the sam
On 2024-03-22 1:23 PM, Frank Millman via Python-list wrote:
On 2024-03-22 12:09 PM, Frank Millman via Python-list wrote:
I am no expert. However, I do have something similar in my app, and it
works.
I do not use 'await future', I use 'asyncio.wait_for(future)'.
I test
On 2024-03-22 12:09 PM, Frank Millman via Python-list wrote:
I am no expert. However, I do have something similar in my app, and it
works.
I do not use 'await future', I use 'asyncio.wait_for(future)'.
I tested it and it did not work.
I am not sure, but I think the
PT_DYNAMIC Debian 6.1.76-1
(2024-02-01) x86_64 GNU/Linux
$ python3 -V
Python 3.11.2
$ pip3 freeze
asgiref==3.7.2
blinker==1.7.0
click==8.1.7
Flask==3.0.2
itsdangerous==2.1.2
Jinja2==3.1.3
MarkupSafe==2.1.5
Werkzeug==3.0.1
```
Thanks for any help!
Cheers,
Thomas
Hi Thomas
I am no exper
On 2024-01-17 3:01 AM, Greg Ewing via Python-list wrote:
On 17/01/24 1:01 am, Frank Millman wrote:
I sometimes need to keep a reference from a transient object to a more
permanent structure in my app. To save myself the extra step of
removing all these references when the transient object is
On 2024-01-16 2:15 PM, Chris Angelico via Python-list wrote:
Where do you tend to "leave a reference dangling somewhere"? How is
this occurring? Is it a result of an incomplete transaction (like an
HTTP request that never finishes), or a regular part of the operation
of the server?
I have a c
On 2024-01-15 3:51 PM, Frank Millman via Python-list wrote:
Hi all
I have read that one should not have to worry about garbage collection
in modern versions of Python - it 'just works'.
I don't want to rely on that. My app is a long-running server, with
multiple clients lo
ry simple program to illustrate this.
Am I missing something? All comments appreciated.
Frank Millman
==
import gc
class delwatcher:
# This stores enough information to identify the object being watched.
# It does not store a reference
'DbParams']). But I would still like
an answer to the original question, as I am sure similar situations will
occur without such a simple solution.
Thanks
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
github.com/FrankMillman/AccInABox.
You are welcome to look at it, but it needs a lot of tidying up before
it will be ready for a wider audience.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
On 2023-02-15 5:59 AM, Thomas Passin wrote:
>
> "Download the latest release from http://www.sqlite.org/download.html
> and manually copy sqlite3.dll into Python's DLLs subfolder."
>
I have done exactly this a number of times and it has worked for me.
Frank Millman
On 2023-01-27 2:14 PM, Frank Millman wrote:
I have changed it to async, which I call with 'asyncio.run'. It now
looks like this -
server = await asyncio.start_server(handle_client, host, port)
await setup_companies()
session_check = asyncio.create_task(
chec
On 2023-01-26 7:16 PM, Dieter Maurer wrote:
Frank Millman wrote at 2023-1-26 12:12 +0200:
I have written a simple HTTP server using asyncio. It works, but I don't
always understand how it works, so I was pleased that Python 3.11
introduced some new high-level concepts that hide the gory de
nner
I have not figured out how to adapt my code to use this new approach.
Any suggestions appreciated.
Frank Millman
P.S. Might it be better to ask these questions on the Async_SIG
Discussion Forum?
--
https://mail.python.org/mailman/listinfo/python-list
largely independently of the names that are or are not
referencing the objects.
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.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
not, feel free to come back with
more questions.
BTW, there is an indentation error in your original post - line 5 should
line up with line 4. It is preferable to copy/paste your code into any
messages posted here rather than type it in, as that avoids the
possibility of any typos.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
On 2022-07-20 4:45 PM, Chris Angelico wrote:
On Wed, 20 Jul 2022 at 23:50, Peter Otten <__pete...@web.de> wrote:
I found
https://peps.python.org/pep-3101/
"""
PEP 3101 – Advanced String Formatting
...
An example of the ‘getitem’ syntax:
"My name is {0[name]}".format(dict(name='Fred'))
It sh
On 2022-07-20 12:31 PM, Frank Millman wrote:
On 2022-07-20 11:37 AM, Chris Angelico wrote:
On Wed, 20 Jul 2022 at 18:34, Frank Millman wrote:
Hi all
C:\Users\E7280>python
Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64
bit (AMD64)] on win32
Type "help"
On 2022-07-20 11:37 AM, Chris Angelico wrote:
On Wed, 20 Jul 2022 at 18:34, Frank Millman wrote:
Hi all
C:\Users\E7280>python
Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64
bit (AMD64)] on win32
Type "help", "copyright", "credits"
>
>>> '{x[1]}'.format(**vars())
'1'
>>>
>>> '{x[-1]}'.format(**vars())
Traceback (most recent call last):
File "", line 1, in
TypeError: list indices must be integers or slices, not str
>>>
Can anyone explain this
On 2022-02-22 5:45 PM, David Raymond wrote:
Is there a simpler way?
d = {1: ['aaa', 'bbb', 'ccc'], 2: ['fff', 'ggg']}
[a for b in d.values() for a in b]
['aaa', 'bbb', 'ccc', 'fff', 'ggg']
Now that's what I was looking for.
I am not saying that I will use it, but as an academic exercis
On 2022-02-22 11:30 AM, Chris Angelico wrote:
On Tue, 22 Feb 2022 at 20:24, Frank Millman wrote:
Hi all
I think this should be a simple one-liner, but I cannot figure it out.
I have a dictionary with a number of keys, where each value is a single
list -
>>> d = {1: ['aaa
7;, 'fff', 'ggg']
I can also do this -
>>> from itertools import chain
>>> a = list(chain(*d.values()))
>>> a
['aaa', 'bbb', 'ccc', 'fff', 'ggg']
>>>
Is there a simpler way?
Thanks
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
ing in assembler. I recall my
boss telling me that the ICL assembler was called PLAN, which was an
acronym, but I forget what it stood for.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
On 2021-11-26 11:24 PM, dn via Python-list wrote:
On 26/11/2021 22.17, Frank Millman wrote:
In my program I have a for-loop like this -
for item in x[:-y]:
... [do stuff]
'y' may or may not be 0. If it is 0 I want to process the entire list
'x', but of course -0 equ
On 2021-11-26 11:17 AM, Frank Millman wrote:
Hi all
In my program I have a for-loop like this -
>>> for item in x[:-y]:
... [do stuff]
'y' may or may not be 0. If it is 0 I want to process the entire list
'x', but of course -0 equals 0, so it returns an empt
item in x[:-y] if y else x:
... [do stuff]
But in my actual program, both x and y are fairly long expressions, so
the result is pretty ugly.
Are there any other techniques anyone can suggest, or is the only
alternative to use if...then...else to cater for y = 0?
Thanks
Frank Millman
--
ht
y *fun* generators people may have seen or written? Not so much the cool
or clever ones. Or the mathematical ones (e.g. fib). Something more inane and
"fun". But still showcasing generators uniqueness. Short and simple is good.
Thanks in advance!
Have you looked at this?
http://www.da
#x27;Calling' a generator function does not execute the function, it returns
a generator object.
You have to iterate over the generator object (e.g. by calling next() on
it) in order to execute the function and return values.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
On 2021-03-06 8:21 AM, Frank Millman wrote:
Hi all
This is purely academic, but I would like to understand the following -
>>>
>>> a = [('x', 'y')]
>>>
>>> s = []
>>> for b, c in a:
... s.append((b, c))
...
>>>
I expected.
>>>
>>> s = []
>>> s.append(((b, c) for b, c in a))
>>> s
[ at 0x019FC3F863C0>]
>>>
I expected the same as the first one.
I understand the concept that a generator does not return a value until
you call next() on it, but I have
I use for this arrangement is 'sub-types'.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
ee.parse(gf) to convert to an etree object
It works.
But I don't know what goes on under the hood, so I don't know if this
achieves anything. If any of the steps involves decompressing the data
and storing the entire string in memory, I may as well stick to my
present approach.
Any
On 2020-11-07 1:28 PM, Frank Millman wrote:
On 2020-11-07 1:03 PM, Bischoop wrote:
[...]
another example:
text = "this is text, there should be not commas, but as you see there
are still"
y = txt.strip(",")
print(text)
output:
this is text, there should be not commas,
If the string ends with the suffix string and that suffix is not empty,
return string[:-len(suffix)]. Otherwise, return a copy of the original
string
HTH
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
move the line 'from datetime import datetime'.
2. Change dt = datetime.fromisoformat(ItemDateTime) to
dt = datetime.datetime.fromisoformat(ItemDateTime)
Unless I have missed something, that should work.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
x27; method, KeyboardInterrupt is not caught by
'server.serve_forever()' but by 'asyncio.run()'. It is too late to do
any cleanup at this point, as the loop has already been stopped.
Is it ok to stick to the 'old' method, or is there a better way to do this.
Thanks
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
ng.
So the result is the concatenation of -
1. '\n' + '#' + length of string + '\n' as the start delimiter
2. the string itself
3. '\n' + '#' + '#' + '\n' as the end delimiter
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
On 2020-10-16 9:42 AM, Steve wrote:
d2 = datetime.datetime.now() #Time Right now
Show this: 2020-10-16 02:53
and not this: 2020-10-16 02:53:48.585865
>>>
>>> str(d2)
'2020-10-16 10:29:38.423371'
>>>
>>> d2.strftime('%Y-%m-%d %H:%M
On 2020-10-03 8:58 AM, Chris Angelico wrote:
On Sat, Oct 3, 2020 at 4:53 PM Frank Millman wrote:
Hi all
When debugging, I sometimes add a 'breakpoint()' to my code to examine
various objects.
However, I often want to know how I got there, so I replace the
'breakpoint()
using the extra info from the traceback.
Is there a way to combine these into one step, so that, while in the
debugger, I can find out how I got there?
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
On 2020-09-25 7:46 AM, Chris Angelico wrote:
On Fri, Sep 25, 2020 at 3:43 PM Frank Millman wrote:
Hi all
I have a problem related (I think) to list comprehension namespaces. I
don't understand it enough to figure out a solution.
In the debugger, I want to examine the contents of the cu
ing on?
Q2. Is there a way to get what I want?
Thanks
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
I made the mistake of relying on
the error message in my logic, to distinguish between 'too few' and 'too
many'. Guess what happened - Python changed the wording of the messages,
and my logic failed.
After messing about with some alternatives, I ended up with the OP's
f
On 2020-09-14 7:07 AM, Frank Millman wrote:
On 2020-09-14 3:18 AM, Terry Reedy wrote:
User Tushar Sadhwani and I both have Win 10 with 3.8.5 installed.
When he runs
...> py -3.8 -m turtledemo.colormixer
and moves the sliders a reasonable amount, he repeatably gets
Fatal Python error: Can
est with no issues
at all.
I will upgrade to 3.8.5 later today and try again.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
using the last
element, I assume that this would be the way to do it -
>>> for i in range(5):
... print(i)
... j = i
...
0
1
2
3
4
>>> print(j)
4
>>>
Alternatively, this also works, but is this one guaranteed?
>>> for i in range(5):
... print(i)
.
On 2020-07-06 3:08 PM, Jon Ribbens via Python-list wrote:
On 2020-07-06, Frank Millman wrote:
On 2020-07-06 2:06 PM, Jon Ribbens via Python-list wrote:
While I agree entirely with your point, there is however perhaps room
for a bit more helpfulness from the json module. There is no sensible
'datetime.date(2020, 7, 6)'. I look for that pattern on retrieval to
detect that it is actually a date object.
I use the same trick for Decimal objects.
Maybe the OP could do something similar.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
input("enter 1st and 2nd no ").split()
ValueError: not enough values to unpack (expected 2, got 1)
Without arguments, split() splits on whitespace.
If you entered 2 numbers separated by a comma, but no spaces, there is
no split.
Maybe you meant split(',') whi
On 2020-05-24 9:58 AM, DL Neil via Python-list wrote:
On 24/05/20 5:43 PM, Frank Millman wrote:
On 2020-05-23 9:45 PM, DL Neil via Python-list wrote:
My habit with SQL queries is to separate them from other code, cf the
usual illustration of having them 'buried' within the code,
i
dding more and more SQL in my
code.
How do you handle parameters? Do you leave placeholders ('?' or '%s') in
the query, and leave it to the 'importer' of the query to figure out
what is required?
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
re discussing how to improve the download experience on Windows for
newbies.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
On 2020-03-24 8:39 PM, Barry Scott wrote:
On 24 Mar 2020, at 11:54, Frank Millman wrote:
I decided to concentrate on using Wireshark to detect the difference between a
Python3.7 session and a Python3.8 session. Already I can see some differences.
There is only one version of my program
On 2020-03-24 1:54 PM, Frank Millman wrote:
On 2020-03-23 1:56 PM, Frank Millman wrote:
I have one frustration with Wireshark. I will mention it in case anyone
has a solution.
I can see that Edge opens multiple connections. I am trying to track the
activity on each connection separately. I
On 2020-03-23 1:56 PM, Frank Millman wrote:
On 2020-03-23 12:57 PM, Chris Angelico wrote:
On Mon, Mar 23, 2020 at 8:03 PM Frank Millman wrote:
On 2020-03-22 12:11 PM, Chris Angelico wrote:
On Sun, Mar 22, 2020 at 8:30 PM Frank Millman
wrote:
On 2020-03-22 10:45 AM, Chris Angelico wrote
On 2020-03-23 12:57 PM, Chris Angelico wrote:
On Mon, Mar 23, 2020 at 8:03 PM Frank Millman wrote:
On 2020-03-22 12:11 PM, Chris Angelico wrote:
On Sun, Mar 22, 2020 at 8:30 PM Frank Millman wrote:
On 2020-03-22 10:45 AM, Chris Angelico wrote:
If you can recreate the problem with a
On 2020-03-22 12:11 PM, Chris Angelico wrote:
On Sun, Mar 22, 2020 at 8:30 PM Frank Millman wrote:
On 2020-03-22 10:45 AM, Chris Angelico wrote:
If you can recreate the problem with a single socket and multiple
requests, that would be extremely helpful. I also think it's highly
likely
On 2020-03-22 1:01 PM, Chris Angelico wrote:
On Sun, Mar 22, 2020 at 12:45 AM Frank Millman wrote:
Hi all
I have a strange intermittent bug.
The role-players -
asyncio on Python 3.8 running on Windows 10
Microsoft Edge running as a browser on the same machine
The bug does not
On 2020-03-22 11:00 AM, Barry Scott wrote:
On 22 Mar 2020, at 07:56, Frank Millman wrote:
On 2020-03-21 8:04 PM, Barry Scott wrote:
I'd look at the network traffic with wireshark to see if there is anything
different between edge and the other browsers.
You are leading me into
On 2020-03-22 10:45 AM, Chris Angelico wrote:
On Sun, Mar 22, 2020 at 6:58 PM Frank Millman wrote:
I'd look at the network traffic with wireshark to see if there is anything
different between edge and the other browsers.
You are leading me into deep waters here :-) I have never
On 2020-03-21 8:04 PM, Barry Scott wrote:
On 21 Mar 2020, at 13:43, Frank Millman wrote:
Hi all
I have a strange intermittent bug.
The role-players -
asyncio on Python 3.8 running on Windows 10
Microsoft Edge running as a browser on the same machine
The bug does not occur with
()
writer.close()
await writer.wait_closed()
I have asked the same question on StackOverflow, from an MS Edge
perspective -
https://stackoverflow.com/questions/60785767/ms-edge-randomly-does-not-load-script
I don't know whether the problem lies with Python or MS Edge, but a
On 2020-02-28 1:37 AM, rmli...@riseup.net wrote:
> What resources are you trying to conserve?
>
> If you want to try conserving time, you shouldn't have to worry about
> starting too many background tasks. That's because asyncio code was
> designed to be extremely time efficient at handling larg
IN, or is ignored
as neither.
Now -- write a program does just that...
"""
Try his suggestion, and come back here if you get stuck.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
Hi all
Why is 'explicit passing of a loop argument to asyncio.Event' deprecated
(see What's new in Python 3.8)?
I use this in my project. I can find a workaround, but it is not elegant.
I can explain my use case if requested, but I was just curious to find
out the reason.
On 2020-02-21 11:13 PM, Greg Ewing wrote:
On 21/02/20 7:59 pm, Frank Millman wrote:
My first attempt was to create a background task for each session
which runs for the life-time of the session, and 'awaits' its queue.
It works, but I was concerned about having a lot a background tas
he session is closed.
Is this better, worse, or does it make no difference? If it makes no
difference, I will lean towards the first approach, as it is easier to
reason about what is going on.
Thanks for any advice.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
On 2020-02-07 1:06 PM, Barry Scott wrote:
On 7 Feb 2020, at 05:27, Frank Millman wrote:
@Barry
I agree that __del__() is rarely useful, but I have not come up with an
alternative to achieve what I want to do. My app is a long-running server, and
creates many objects on-the-fly depending
On 2020-02-06 2:58 PM, Frank Millman wrote:
[...]
I have a module (A) containing common objects shared by other modules. I
have a module (B) which imports one of these common objects - a set().
[...]
This has worked for years, but now when the __del__ method is called,
the common object
.
I have a workaround, so I am just reporting this for the record.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
On 2020-02-03 10:39 AM, Peter Otten wrote:
Frank Millman wrote:
This is a minor issue, and I have found an ugly workaround, but I
thought I would mention it.
Like this?
children = list(xml)
for y in children:
print(etree.tostring(y))
if y.get('z') == 'c
', 'b', 'c', 'd']
>>>
>>> lmx = ''
>>> xml = etree.fromstring(lmx)
>>> for y in xml:
... print(etree.tostring(y))
... if y.get('z') == 'c':
... xml.append(etree.Element('y', attrib={'z': 'd'}))
...
b''
b''
b''
>>> etree.tostring(xml)
b''
As you can see, the last element is correctly appended, but is not
included in the iteration.
Is there any chance that this can be looked at, or is it just the way it
works?
BTW, I see that ElementTree in the standard library does not have this
problem.
Thanks
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
can't multiply sequence by non-int of type 'float'
>>>
You probably meant
float(squares) * float(.15)
or more simply
float(squares) * .15
HTH
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
On 2020-01-21 6:17 PM, Maxime S wrote:
Hi,
Le ven. 17 janv. 2020 à 20:11, Frank Millman a écrit :
It works perfectly. However, some pdf's can be large, and there could be
concurrent requests, so I wanted to minimise the memory footprint. So I
tried passing the client_writer directly t
quite difficult"
I realised that my method is vulnerable to this and, like Robin, I have
not come up with an easy way to guard against it.
Frank Millman
Just use floats instead of integers.
I like that idea. I will probably use Decimal instead of float, but the
principle is the sa
wait pdf_handler(client_writer)
client_writer.write(b'\r\n')
It works! ReportLab accepts client_writer as a file-like object, and
writes to it directly. I cannot use chunking, so I just let it do its thing.
Can anyone see any problem with this?
Thanks
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
o add this line -
import sys
HTH
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
mon. More likely is the use of a newline.
I use this from time to time when constructing long string literals -
long_string = (
"this is the first chunk "
"this is the second chunk "
"etc etc"
)
My 0.02c
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
On 2019-12-11 10:51 PM, Skip Montanaro wrote:
Why is a dtm instance also an instance of dt?
The datetime type is, in fact, a subclass of the date type:
import datetime
datetime.date.__bases__
(,)
datetime.datetime.__bases__
(,)
datetime.time.__bases__
(,)
Skip
Thanks for that.
I fou
object."
If it was using multiple inheritance, a dtm should also be an instance
of tm, but it is not.
This is using Python 3.7.2.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
On 2019-10-19 12:37 AM, DL Neil via Python-list wrote:
On 16/10/19 6:33 PM, Frank Millman wrote:
On 2019-10-14 10:55 PM, DL Neil via Python-list wrote:
Is there a technique or pattern for taking a (partially-) populated
instance of a class, and re-creating it as an instance of one of its
sub
On 2019-10-16 7:33 AM, Frank Millman wrote:
Here is a link to an article entitled 'Understanding Hidden Subtypes'.
It dates back to 2004, but I think it is still relevant. It addresses
precisely the issues that you raise, but from a data-modelling
perspective, not a programming o
ure
2) showing the data relationships. I downloaded the original article
onto my computer years ago, and my local copy does have the images, so
if you would like to see them let me know and I will upload my version
somewhere to make it accessible.
Frank Millman
--
https://mail.python.org/m
you have a large volume of temp
data, but it may be worth trying.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
ng machines. That approach has attracted
interest from DARPA ..."
Hope this is of interest.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
>>> my_dict = dict()
>>> my_dict
{}
>>> my_dict = {} # this does the same, but is shorter
>>> my_dict
{}
>>> my_dict['high'] = 21
>>> my_dict
{'high': 21}
>>>
Try that, and report back with any questions
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
On 2019-09-01 8:12 AM, Hongyi Zhao wrote:
Hi,
The following two forms are always equivalent:
``if var'' and ``if var is not None''
Regards
Not so. Here is an example -
>>> var = []
>>> bool(var)
False
>>> bool(var is not None)
True
>>
x27;, 2)]
What's a working way to go about this?
This would have worked if you sorted your lists first -
>>> [i for i, j in zip(sorted(teams), sorted(shuffle_teams)) if i != j]
[('Ally', 2), ('Fredricka', 3), ('Tim', 1)]
Except you wanted to see the re
27;, whereas with a global 'foo' there can only
be one value of 'foo' for the module.
It would make sense to use the 'global' keyword if you have a module
with various functions, several of which refer to 'foo', but only one of
which changes the value of 'foo'.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
):
print(num[idx + 1], num)
I am expecting 2, 1.
But am receiving
TypeError: 'int' object is not subscriptable
Why?
I think you want a[idx+1], not num[idx+1].
Bear in mind that you will get IndexError for the last item in the list.
Frank Millman
--
https://mail.python.org/mailma
default, range() starts from 0. Anything multiplied by 0 equals 0. So
you can multiply as many numbers as you like, if the first one is 0, the
rest will also be 0.
QED
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
eparate lists
called 'Starters', 'Main Course', and 'Desert'?", the code that you
started with is exactly what you asked for.
I think you were asking how to create a variable called 'Starters'
containing the list of starters. It can be done, using th
On 2019-07-02 3:41 PM, Adam Tauno Williams wrote:
On Tue, 2019-07-02 at 07:36 +0200, Frank Millman wrote:
On 2019-07-01 10:13 PM, Adam Tauno Williams wrote:
I am trying to connect to a Named Instance on an MS-SQL server
using pyODBC.
This is what I use -
conn = pyodbc.connect
tabase,
user=self.user,
password=self.pwd,
trusted_connection=True)
SQL Server is running on the same host as my python program, so it may
be a simpler setup than yours.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
e string as per the above format?
Thanks in advance
The following (untested) assumes that you are using a reasonably
up-to-date Python that has the 'f' format operator.
tempStr = f'{year},{mon},{day},{UTCHrs[k]:6.4f}'
for col in range(10):
tempStr += f',{AExt[k, col]:9.7f}'
HTH
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
first on the list -
"""
Python, the fastest-growing major programming language, has risen in the
ranks of programming languages in our survey yet again, edging out Java
this year and standing as the second most loved language (behind Rust).
"""
I thought
'11th'
chooseFrom[21]
'21st'
Not having a default case as in switch forced you to write out all
possible combinations.
I think the intent and readbility of switch statements is a bit nicer.
I have not been following this thread in detail, but how about this
"^Bart" wrote in message news:q2mghh$ah6$1...@gioia.aioe.org...
> 1. The last two lines appear to be indented under the 'if number3 < '
> line. I think you want them to be unindented so that they run every
> time.
I'm sorry but I didn't completely understand what you wrote about the last
t
1 - 100 of 777 matches
Mail list logo