Re: some problems for an introductory python test

2021-08-09 Thread Chris Angelico
On Tue, Aug 10, 2021 at 1:41 PM Mats Wichmann wrote: > > > On 8/9/21 6:34 PM, Chris Angelico wrote: > > > If you want to highlight the OOP nature of Python, rather than looking > > at magic methods, I'd first look at polymorphism. You can add a pair > > of integers; you can add a pair of tuples; y

Re: some problems for an introductory python test

2021-08-09 Thread Mats Wichmann
On 8/9/21 6:34 PM, Chris Angelico wrote: If you want to highlight the OOP nature of Python, rather than looking at magic methods, I'd first look at polymorphism. You can add a pair of integers; you can add a pair of tuples; you can add a pair of strings. Each one logically adds two things toge

Re: some problems for an introductory python test

2021-08-09 Thread Chris Angelico
On Tue, Aug 10, 2021 at 8:19 AM Mats Wichmann wrote: > Even if you do > > x = 2 + 3 > > you're actually creating an integer object with a value of 2, and > calling its add method to add the integer object with the value of 3 to > it. The syntax hides it, but in a way it's just convenience that it

Re: some problems for an introductory python test

2021-08-09 Thread Mats Wichmann
On 8/9/21 3:07 PM, Hope Rouselle wrote: I'm looking for questions to put on a test for students who never had any experience with programming, but have learned to use Python's procedures, default arguments, if-else, strings, tuples, lists and dictionaries. (There's no OOP at all in this course.

Re: some problems for an introductory python test

2021-08-09 Thread Chris Angelico
On Tue, Aug 10, 2021 at 7:25 AM Hope Rouselle wrote: > I came up with the following question. Using strings of length 5 > (always), write a procedure histogram(s) that consumes a string and > produces a dictionary whose keys are each substrings (of the string) of > length 1 and their correspondin

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-09 Thread Chris Angelico
On Tue, Aug 10, 2021 at 7:24 AM Jack Brandom wrote: > > Greg Ewing writes: > > > On 6/08/21 12:00 pm, Jack Brandom wrote: > >> It seems > >> that I'd begin at position 3 (that's "k" which I save somewhere), then I > >> subtract 1 from 3, getting 2 (that's "c", which I save somewhere), then > >> I

some problems for an introductory python test

2021-08-09 Thread Hope Rouselle
I'm looking for questions to put on a test for students who never had any experience with programming, but have learned to use Python's procedures, default arguments, if-else, strings, tuples, lists and dictionaries. (There's no OOP at all in this course. Students don't even write ls.append(...).

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-09 Thread Jack Brandom
Greg Ewing writes: > On 6/08/21 12:00 pm, Jack Brandom wrote: >> It seems >> that I'd begin at position 3 (that's "k" which I save somewhere), then I >> subtract 1 from 3, getting 2 (that's "c", which I save somewhere), then >> I subtract 1 from 2, getting 1 (that's "a", ...), then I subtract 1 f

Re: CODING PAGE ACCESS

2021-08-09 Thread Jack Dangler
Or open a terminal and type 'python3' ... Or open an editor, type in a py program, save it as "myfirstcode.py" and then at the console type 'python3 ./myfirstcode.py' and hit return... There are a number of choices to get there - that's the tenet of Linux. It's all about choice. On 8/7/21 3

Re: Errors and some bugs

2021-08-09 Thread dn via Python-list
On 09/08/2021 15.12, Himanshu Gupta wrote: > While running some pip command to install spacy package for ver3.9 I always > face trouble can you provide a solution The short answer is "yes", but what is the problem? Please copy-paste the install command and the (full) error message, from the termi

annotations cause dataclass fields type side effects

2021-08-09 Thread Lukas Lösche
I'm on Python 3.9.6 and trying to make sense of the following behaviour: >>> from dataclasses import dataclass, fields >>> @dataclass ... class Foobar: ... name: str ... >>> fields(Foobar)[0].type >>> type(fields(Foobar)[0].type) >>> from __future__ import annotations >>> from dataclasses imp

Errors and some bugs

2021-08-09 Thread Himanshu Gupta
While running some pip command to install spacy package for ver3.9 I always face trouble can you provide a solution -- https://mail.python.org/mailman/listinfo/python-list

John Griner Python Tutor Available

2021-08-09 Thread John Griner
To whom it may concern, I am not sure if this is appropriate, but I would like to somehow `advertise' my classes. I have a free workshop: Intro to Python: Data Wrangling, Visualization, List and Tuples and a series that consist of 3 parts, (1) Data Wrangling (2) Data Visualiza

Re: Flask – how to write csv file & save using prefilled value of the filename (response.headers["Content-Disposition"]="attachment; filename=xxx")

2021-08-09 Thread Roland Mueller via Python-list
pe 6. elok. 2021 klo 19.15 MRAB (pyt...@mrabarnett.plus.com) kirjoitti: > On 2021-08-06 16:50, Suretha Weweje wrote: > > I am trying to upload a CSV file with flask, read and process one line > at a > > time while iterating through all rows of the file and write the results > > back to a new CSV f

Re: Tracing in a Flask application

2021-08-09 Thread Albert-Jan Roskam
Hi, logging.basicConfig(level="DEBUG") ..in e.g __init__.py AJ On 4 Aug 2021 23:26, Javi D R wrote: Hi I would like to do some tracing in a flask. I have been able to trace request in plain python requests using sys.settrace(), but this doesnt work with F