Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-05 Thread Rustom Mody
On Tuesday, December 5, 2017 at 2:28:44 PM UTC+5:30, Lawrence D’Oliveiro wrote:
> On Tuesday, December 5, 2017 at 3:39:26 AM UTC+13, Rick Johnson wrote:
> > 
> > Sounds like your OS file associations are all botched-up ...
> 
> Linux doesn’t do “OS file associations”.

From a strict pov thats right

But then from a strict pov linux is not an OS, its just one component of an OS
https://www.howtogeek.com/177213/linux-isnt-just-linux-8-pieces-of-software-that-make-up-linux-systems/

The more pragmatic answer to this question is to run
$ man xdg-mime
$ man xdg-open
etc

(terrible documentation like everything else gnome… but thats another story)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: why won't slicing lists raise IndexError?

2017-12-05 Thread Ned Batchelder

On 12/4/17 10:41 PM, Rick Johnson wrote:

I think we've demonstrated the slicing semantics well.

Indeed. And i never questioned this aspect. I merely wanted
to inform the lurkers that the else-clause was handling a
non-action, and therefore, could be omitted.


Your original statement sounded like, "The else clause can never be 
executed," which would have been in direct opposition to the point, that 
slicing outside the limits would produce an empty list, not an 
exception.  I'm not sure why you are certain that there's never a reason 
to execute code in that case.


Perhaps I have a simulation on a conceptually infinite line, but only 
store the actual points needed.  The "non action" would be to extend the 
line.


--Ned.
--
https://mail.python.org/mailman/listinfo/python-list


Re: why won't slicing lists raise IndexError?

2017-12-05 Thread Rick Johnson
Ned Batchelder wrote:
[...]
> Your original statement sounded like, "The else clause can
> never be executed," 

No. Of course not. Note that i mentioned _pragmatism_. My
complaint about the else-clause was not that it could
_never_ be executed, my complaint that was that the else-
clause (in Terry's example) serves no useful purpose save to
act as a semantical placeholder for a non-action. Heck, it
doesn't even log anything! "Practicality beats purity". For
instance:

(1) Would it be practical to make a shopping list that
includes only the products you _don't_ want to buy?

no ham
no eggs
no spam
no Limburger

"Okay, but what do we _need_!!!"

(2) How about a list of navigation directions that includes
tangential info?

"After you take the second left turn, you'll see a big
windmill -- just ignore that"

(3) How about a recipe that includes non-ingredients?

1 egg
2 pounds of ham
0 teaspoons coarse sea-salt
0 cups of finely shreded Limburger
...

> which would have been in direct opposition to the point,
> that slicing outside the limits would produce an empty
> list, not an exception.

And again, that is precisely why i raised an objection to
this else-clause. Because the inclusion of this else-clause
is a distraction from the point.

> I'm not sure why you are certain that there's never a
> reason to execute code in that case.

Oh, there will be a _reason_ for else-clause to execute
(when the slice overlaps the boundary), but i argue the code
contained within is not a _good_ reason for it to execute.

item = seq[n:n+1]
if item:
process(item)
else:
do_without_item()
 
"do_without_item()" implies a non-action. However, that's
not to say that under different circumstances, the else-
clause might serve a practical purpose for a programmer. For
instance, even a logging event serves a purpose.

ss, se = n, n+1
item = seq[ss:se]
if item:
process(item)
else:
print('Slice ({0}, {1}) out of bounds!'.format(ss, se))

> Perhaps I have a simulation on a conceptually infinite
> line, but only store the actual points needed.  The "non
> action" would be to extend the line.

That logic does not follow! How do you _extend_ an infinite
line? :-). Of course, in the realm of maths, a line is by
definition infinite.

But whether you're speaking in metaphor or not, there are
literally infinite ways in which an else-clause can be
justified. My argument was simply: "do_without_item()" is
not a legitimate justification.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: why won't slicing lists raise IndexError?

2017-12-05 Thread Steve D'Aprano
On Tue, 5 Dec 2017 11:31 pm, Rick Johnson wrote:

> Ned Batchelder wrote:
> [...]
>> Your original statement sounded like, "The else clause can
>> never be executed,"
> 
> No. Of course not. Note that i mentioned _pragmatism_. My
> complaint about the else-clause was not that it could
> _never_ be executed, my complaint that was that the else-
> clause (in Terry's example) serves no useful purpose save to
> act as a semantical placeholder for a non-action.

When you find yourself in a hole, stop digging.

You've already been told that there's no indication or reason to believe that
it is a non-action. You've already been given at least one possible action.
It isn't a non-action, it is two distinct actions:

- the action you take when the slice is non-empty;

- the action you take when the slice is empty.



> Heck, it 
> doesn't even log anything! "Practicality beats purity". For
> instance:
> 
> (1) Would it be practical to make a shopping list that
> includes only the products you _don't_ want to buy?

Obviously not *only* the products you don't want, but it is very common to
specify constraints, e.g. what you don't want.

New car. Must not have an internet connected engine.

Gluten-free bread.

Unscented toilet paper.

Ingredients to make fruit salad. No bananas.

Or alternatives:

Get a slice of pizza for lunch. If they're out of pizza (i.e. the
slice is empty) get Chinese food instead.


> (2) How about a list of navigation directions that includes
> tangential info?
>   
> "After you take the second left turn, you'll see a big
> windmill -- just ignore that"

Be careful about rhetorical questions. The answer is not always what you think
it must be.

Giving directions that include landmarks is *very* useful. If you don't see
the windmill, you know you've taken the wrong turn. When you do see it, you
know you're on the right track.


> (3) How about a recipe that includes non-ingredients?

My wife is an expert at making bread-and-no-butter pudding. This should be
obvious, but in case it isn't, the reason it has that name is because it is a
modified recipe based on (can you guess what?) bread-and-butter pudding, a
British staple.

Also:

Flourless orange cake.

Taken from a recipe for cooking lentils:

"Don't add vinegar, as it makes the lentils tough."

(Apparently some people add vinegar when cooking pulses. Curious.)

And for those who are well-educated but not wise:

"The difference between being educated and being smart is, the 
educated person knows that tomato is a fruit, while the wise
person knows not to put tomato in fruit salad."

I can think of a couple of people I would need to write "No tomatoes" on any
fruit salad recipe I gave them.



>> which would have been in direct opposition to the point,
>> that slicing outside the limits would produce an empty
>> list, not an exception.
> 
> And again, that is precisely why i raised an objection to
> this else-clause. Because the inclusion of this else-clause
> is a distraction from the point.

Ah, we've entered Ricksville, where demonstrating that slicing can return an
empty list is taken as distraction from the point that slicing can return an
empty list.

No, wait, you've convinced me Rick! Your logic is impeccable! Except for one
teeny tiny flaw in your reasoning -- you have the conclusion backwards. Its
not the *empty* slice (the else clause) that is the distraction. Its the
*non* empty clause. We already know that slicing returns a list of items. The
part we're discussing is what happens when the slice is out of bounds? Does
it return an empty list, or raise an exception?


alist = bigger_list[start:finish]
if not alist:
print("Look Ma, no exception was raised!!!")


/only half serious


[...]
> item = seq[n:n+1]
> if item:
> process(item)
> else:
> do_without_item()
>  
> "do_without_item()" implies a non-action.

The mind boggles how you get by in real life, when you're so busy digging
yourself into deeper and deeper holes. Do you think about things before you
write them?

"I was going to make spaghetti and meat balls for tea tonight, but the store
was out of mince, so I'll have to do without meat balls."

Does that mean I go hungry and don't eat?


>> Perhaps I have a simulation on a conceptually infinite
>> line, but only store the actual points needed.  The "non
>> action" would be to extend the line.
> 
> That logic does not follow! How do you _extend_ an infinite
> line? :-). 

Ned said that the line stores only the points needed. If you've only used
positions between 1 and 10, only values 1 through 10 have been stored. If you
then try to access position 20, the line is extended to position 20.


> Of course, in the realm of maths, a line is by 
> definition infinite.

Not necessarily. Lines can be finite (e.g. a chord) or infinite, and if
infinite, they can be defined as extending towards infinity in both
direc

Profiler which takes I/O into account?

2017-12-05 Thread Skip Montanaro
Is there a profiler for Python (2.7 in my case) which recognizes when
a process (or all threads but the profiler's) is blocked on I/O? I'm
using cProfile at the moment, which is fine as far as it goes, but the
program I'm profiling does a fair amount of I/O, so that dominates the
actual time the program spends calculating. My goal in this case is
minimizing latency of request handling, so while it's not CPU-bound,
it's still important to minimize the relevant code paths.

Thx,

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


we want python software

2017-12-05 Thread Jyothiswaroop Reddy
Sir,
I am b.tech student I would like to learn python. So please send the 
python software.
Thanking you sir.

Sent from Mail for Windows 10

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-05 Thread Igor Korot
Hi,

On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy
 wrote:
> Sir,
> I am b.tech student I would like to learn python. So please send the 
> python software.

Sorry, we don't send anything. You will have to go get it yourself. -)

Thanking you back.

> Thanking you sir.
>
> Sent from Mail for Windows 10
>
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-05 Thread Rick Johnson
On Tuesday, December 5, 2017 at 2:58:44 AM UTC-6, Lawrence D'Oliveiro wrote:
> On Tuesday, December 5, 2017 at 3:39:26 AM UTC+13, Rick Johnson wrote:
> >
> > Sounds like your OS file associations are all botched-up ...
>
> Linux doesn't do "OS file associations".

True. But i'm not convinced that file associations
are really all that terrible of a thing. What do you think?

Though, Micheal Torrie did raise a valid point regarding the
pitfalls of those who rely too heavily on the X-Windows
mouse event, warning that -- paraphrasing here -- "You don't
want to invoke a python script with a double-click as you
will not maintain control of the output stream when the
program fails or quietly exits"

Fair point.

Although, on windows, at least, there is an option of using
either a ".py" file extension or a ".pyw" file extension for
your scripts, such that, when invoking the script from the
desktop enviroment (via double-click), the former will
ensure a terminal window is displayed while the latter will
suppress a terminal entirely. However, i find this design to
be woefully inadequate as a "feature". Hmm, it seems this
design is best described as: "a feature that wanted to be
great, allbeit, one that failed _miserably_".

With that in mind, a more practical implementation of
"forcing" or "suppressing" terminals via file extensions
would take the form of the following three alternatives:

(OPTION_1): Run the script with a terminal, and autoclose
upon fatal error or EOP. (".py")

(OPTION_2): Run script with a terminal, but do not auto-close
the terminal when Python chokes or the program exits,
instead, allow the human to decide. (this will be best for
debugging purposes) (".pydb" or ".pyt" or "pyl")

(OPTION_3): Run the script, but suppress the terminal
entirely. (".pyw")
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double clicking on file.

2017-12-05 Thread Jason
On Monday, December 4, 2017 at 4:49:11 AM UTC-5, dhananjays...@gmail.com wrote:
> Respected Sir/Mam,
> I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when i am 
> double click in python program (Dhananjay.py),it is opening in Text Editor by 
> Default in Ubuntu.I want to run this program when i double click on it as any 
> *.Exe file executes as in Window.
> Sir please help me.



Make the first line oh the file:
#!/usr/bin/env python

Then chmod it with executable permissions:
chmod +x Dhananjay.py

Then you can double-click to run it.
-- 
https://mail.python.org/mailman/listinfo/python-list


csv.DictReader line skipping should be considered a bug?

2017-12-05 Thread Jason
I ran into this:
https://stackoverflow.com/questions/27707581/why-does-csv-dictreader-skip-empty-lines

# unlike the basic reader, we prefer not to return blanks,
# because we will typically wind up with a dict full of None
# values

while iterating over two files, which are line-by-line corresponding. The 
DictReader skipped ahead many lines breaking the line-by-line correspondence. 

And I want to argue that the difference of behavior should be considered a bug. 
It should be considered as such because:
1. I need to know what's in the file to know what class to use. The file 
content should not break at-least-1-record-per-line. There may me multiple 
lines per record in the case of embedded new lines, but it should never no 
record per line. 
2.  It's a premature optimization. If skipping blank lines is desirable, then 
have another class on top of DictReader, maybe call it 
EmptyLineSkippingDictReader. 
3. The intent of DictReader is to return a dict, nothing more, therefore the 
change of behavior isn inappropriate. 

Does anyone agree, or am I crazy?


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-05 Thread Joel Goldstick
Go visit python.org to see how to download python for the operating system
you are using.  Its free of course

On Tue, Dec 5, 2017 at 11:55 AM, Igor Korot  wrote:

> Hi,
>
> On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy
>  wrote:
> > Sir,
> > I am b.tech student I would like to learn python. So please send
> the python software.
>
> Sorry, we don't send anything. You will have to go get it yourself. -)
>
> Thanking you back.
>
> > Thanking you sir.
> >
> > Sent from Mail for Windows 10
> >
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: csv.DictReader line skipping should be considered a bug?

2017-12-05 Thread Neil Cerutti
On 2017-12-05, Jason  wrote:
> I ran into this:
> https://stackoverflow.com/questions/27707581/why-does-csv-dictreader-skip-empty-lines
>
> # unlike the basic reader, we prefer not to return blanks,
> # because we will typically wind up with a dict full of None
> # values
>
> while iterating over two files, which are line-by-line corresponding. The 
> DictReader skipped ahead many lines breaking the line-by-line correspondence. 
>
> And I want to argue that the difference of behavior should be considered a 
> bug. It should be considered as such because:
> 1. I need to know what's in the file to know what class to use. The file 
> content should not break at-least-1-record-per-line. There may me multiple 
> lines per record in the case of embedded new lines, but it should never no 
> record per line. 
> 2.  It's a premature optimization. If skipping blank lines is desirable, then 
> have another class on top of DictReader, maybe call it 
> EmptyLineSkippingDictReader. 
> 3. The intent of DictReader is to return a dict, nothing more, therefore the 
> change of behavior isn inappropriate. 
>
> Does anyone agree, or am I crazy?

I've used csv.DictReader for years and never come across this
oddity. Very interesting!

I am with you. Silently discarding blank records hides
information--the current design is unusable if blank records are
of interest. Moreover, what's wrong with a dict full of None, if
that's what's in the record? Haw many Nones are too many?

-- 
Neil Cerutti

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: csv.DictReader line skipping should be considered a bug?

2017-12-05 Thread Skip Montanaro
> And I want to argue that the difference of behavior should be considered a 
> bug.

Sorry, that ship has sailed. If you want different behavior,
subclassing DictReader and providing your own next() implementation
should be straightforward. All you need to do is copy the existing
implementation of next() and strip out the comment and the while loop
which follows it.

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to upload to Pythonhosted.org

2017-12-05 Thread waylan
After asking here, I found a mailing list post here: 
https://mail.python.org/pipermail/distutils-sig/2015-May/026381.html

That post outlines a roadmap for shutting down pythonhosted. Unfortunately, it 
seems that they skipped from step 1 to step 5 without bothering with steps 2, 
3, & 4.

In any event, that list discussion seems to be the official word that things 
are being shut down, which was what I was looking for.  It's unfortunate that 
things weren't done more smoothly.

Also it seems that if you want to avoid search results showing up for the 
pythonhosted content after you find a new host, they at least provide a way to 
"delete" the content from pyhtonhosted. That way, Google will stop indexing it 
and stop including it in search results. Unfortunately, all the existing links 
across the internet are now dead with no way to redirect people.

Waylan

On Thursday, November 30, 2017 at 1:47:32 PM UTC-5, Irmen de Jong wrote:
> On 11/30/2017 03:31 AM, Ben Finney wrote:
> > Irmen de Jong  writes:
> > 
> >> On 11/30/2017 02:06 AM, waylan wrote:
> >>> So, how do I upload an update to my documentation?
> >>
> >> I ran into the same issue. From what I gathered, Pythonhosted.org is
> >> in the process of being dismantled and it hasn't allowed new doc
> >> uploads for quite some time now. I switched to using readthedocs.io
> >> instead.
> > 
> > The issue that many are facing is how to update the pages *at the
> > existing URL* to tell visitors where to go next. Cool URIs don't change
> > https://www.w3.org/Provider/Style/URI.html> but, when they do, we
> > are obliged to update the existing pages to point to the new ones.
> 
> Sorry, yes, that is the problem I experience as well. My library's old version
> documentation is somehow frozen on Pythonhosted.org (and obviously still pops 
> up as the
> first few google hits).
> 
> 
> > So, if pythonhosted.org is indeed being dismantled, there should be a
> > way to update the pages there for informing visitor where they should go
> > next.
> > 
> > If that's not possible and instead the service is just locked down,
> > that's IMO a mistake.
> 
> I agree with that. I think it's an unsolved issue until now, that gets some 
> discussion
> in this github issue https://github.com/pypa/warehouse/issues/582
> 
> 
> Irmen

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-05 Thread Tony van der Hoff
On 05/12/17 16:55, Igor Korot wrote:
> Hi,
>
> On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy
>  wrote:
>> Sir,
>> I am b.tech student I would like to learn python. So please send the 
>> python software.
> Sorry, we don't send anything. You will have to go get it yourself. -)
>
Well, at least try to be helpful:
https://www.python.org/downloads/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-05 Thread Igor Korot
Hi, Tony,

On Tue, Dec 5, 2017 at 11:10 AM, Tony van der Hoff  wrote:
> On 05/12/17 16:55, Igor Korot wrote:
>> Hi,
>>
>> On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy
>>  wrote:
>>> Sir,
>>> I am b.tech student I would like to learn python. So please send 
>>> the python software.
>> Sorry, we don't send anything. You will have to go get it yourself. -)
>>
> Well, at least try to be helpful:
> https://www.python.org/downloads/

This is LMGIFY.
If they say they are tech students - they should know how to work with Google.

And I even tried to be polite. I should have probably write something like:

1. Open the Web browser.
2. In the "Address Bar" type "www.pyton.org".
3. Find the link which reads "Downloads". Click on it.
4. Carefully read what version you need to install for your OS.
5. Apply the acquired knowledge and download the appropriate version.
6. Click on the installer (if on Windows).
7. Follow all the prompts.
8. Enjoy.

but this is too much for the tech student.

Thank you.

> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-05 Thread Steve D'Aprano
On Tue, 5 Dec 2017 07:58 pm, Lawrence D’Oliveiro wrote:

> On Tuesday, December 5, 2017 at 3:39:26 AM UTC+13, Rick Johnson wrote:
>> 
>> Sounds like your OS file associations are all botched-up ...
> 
> Linux doesn’t do “OS file associations”.


Then how does my Linux box know that when I double-click on a text file, it
launches kwrite rather than (say) the Gimp or LibreOffice?

When I right-click on a mp4 video, I get a menu that includes a Open With
command that shows (amount others) Kaffeine, mplayer and VLC.

If you mean the Linux *kernel* doesn't do file associations, then you should
have said so.

But why do you care about the kernel? Would you think it even the *tiniest*
useful to claim that "Linux doesn't do email" because it is sendmail or
postfix (or similar) that sends email rather than the Linux kernel itself?



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: csv.DictReader line skipping should be considered a bug?

2017-12-05 Thread Steve D'Aprano
On Wed, 6 Dec 2017 04:20 am, Jason wrote:

> I ran into this:
>
https://stackoverflow.com/questions/27707581/why-does-csv-dictreader-skip-empty-lines
> 
> # unlike the basic reader, we prefer not to return blanks,
> # because we will typically wind up with a dict full of None
> # values
> 
> while iterating over two files, which are line-by-line corresponding. The
> DictReader skipped ahead many lines breaking the line-by-line
> correspondence.

Um... this doesn't follow. If they are line-by-line corresponding, then they
should skip the same number of blank lines and read the same number of
non-blank lines.

Even if one file has blanks and the other does not, if you iterate the over
the records themselves, they should keep their correspondence.

I'm afraid that if you want to convince me this is a buggy design, you need to
demonstrate a simple pair of CSV files where the non-blank lines are
corresponding (possibly with differing numbers of blanks in between) but the
CSV readers get out of alignment somehow.


> And I want to argue that the difference of behavior should be considered a
> bug. It should be considered as such because: 1. I need to know what's in
> the file to know what class to use.

Sure. But blank lines don't tell you what class to use.

> The file content should not break at-least-1-record-per-line.

Blank lines DO break that requirement. A blank line is not a record.


> There may me multiple lines per record in the 
> case of embedded new lines, but it should never no record per line.

I disagree. A blank line is not a record. If I have (say) five fields, then:

\n

is a blank record with five empty fields. \n alone is just a blank. The
DictReader correctly returns records with blank fields.


> 2.  It's a premature optimization. If skipping blank lines is desirable,
> then have another class on top of DictReader, maybe call it
> EmptyLineSkippingDictReader.

No, that's needless ravioli code. The csv module already defines a basic
reader that doesn't skip blank lines. Having two different DictReaders, one
which doesn't work correctly because it wrongly expands blank lines to
collections of blank fields, is not helpful.

Perhaps if they were called BrokenDictReader for the one which expands blank
lines to empty records, and DictReader for the one which correctly skips
blank lines.


> 3. The intent of DictReader is to return a 
> dict, nothing more, therefore the change of behavior isn inappropriate.

No, if all you want is a dict, call dict() or use the dict display {}. The
intent of DictReader is to *read a CSV file and extract the records* as a
dict. Since blank lines aren't records, they should be skipped.


> Does anyone agree, or am I crazy?

I wouldn't want to guess your mental health based just on this isolated
incident, but if I had to make a diagnosis, I'd say, yes, crazy as a loon.

*wink*




-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


f-string

2017-12-05 Thread Steve D'Aprano
Anyone got a handy copy of Python 3.6 available to test something for me?

What does compile('f"{spam} {eggs}"', '', 'single') return?

What does eval()'ing the above compiled object do? If necessary, you may have
to define spam and eggs first.


Thanks in advance.


-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: f-string

2017-12-05 Thread MRAB

On 2017-12-06 00:16, Steve D'Aprano wrote:

Anyone got a handy copy of Python 3.6 available to test something for me?

What does compile('f"{spam} {eggs}"', '', 'single') return?

What does eval()'ing the above compiled object do? If necessary, you may have
to define spam and eggs first.


Thanks in advance.



Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\MRAB>py -3.6
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit 
(AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> spam = 'SPAM'
>>> eggs = 'EGGS'
>>> c = compile('f"{spam} {eggs}"', '', 'single')
>>> c
 at 0x0269E2020C00, file "", line 1>
>>> eval(c)
'SPAM EGGS'
>>>
--
https://mail.python.org/mailman/listinfo/python-list


Re: f-string

2017-12-05 Thread Ned Batchelder

On 12/5/17 7:16 PM, Steve D'Aprano wrote:

compile('f"{spam} {eggs}"', '', 'single')


   $ python3.6
   Python 3.6.3 (default, Oct  4 2017, 06:03:25)
   [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
   Type "help", "copyright", "credits" or "license" for more information.
>>> compile('f"{spam} {eggs}"', '', 'single')
at 0x105e79660, file "", line 1>
>>> co = _
>>> spam = 17
>>> eggs = 34
>>> eval(co)
   '17 34'
>>> dis.dis(co)
  1   0 LOAD_NAME    0 (spam)
  2 FORMAT_VALUE 0
  4 LOAD_CONST   0 (' ')
  6 LOAD_NAME    1 (eggs)
  8 FORMAT_VALUE 0
 10 BUILD_STRING 3
 12 PRINT_EXPR
 14 LOAD_CONST   1 (None)
 16 RETURN_VALUE


--Ned.
--
https://mail.python.org/mailman/listinfo/python-list


Re: f-string

2017-12-05 Thread Chris Angelico
On Wed, Dec 6, 2017 at 11:16 AM, Steve D'Aprano
 wrote:
> Anyone got a handy copy of Python 3.6 available to test something for me?
>
> What does compile('f"{spam} {eggs}"', '', 'single') return?
>
> What does eval()'ing the above compiled object do? If necessary, you may have
> to define spam and eggs first.
>
>

In 3.6a4+, which is the only 3.6 I have handy, it returns a code object.

>>> spam = "((spam))"
>>> eggs = "!!eggs!!"
>>> compile('f"{spam} {eggs}"', '', 'single')
 at 0x7f0f82bf7db0, file "", line 1>
>>> eval(_)
'((spam)) !!eggs!!'
>>> dis.dis(compile('f"{spam} {eggs}"', '', 'single'))
  1   0 LOAD_NAME0 (spam)
  2 FORMAT_VALUE 0
  4 LOAD_CONST   0 (' ')
  6 LOAD_NAME1 (eggs)
  8 FORMAT_VALUE 0
 10 BUILD_STRING 3
 12 PRINT_EXPR
 14 LOAD_CONST   1 (None)
 16 RETURN_VALUE

Same is true in 3.7 alphas.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: csv.DictReader line skipping should be considered a bug?

2017-12-05 Thread MRAB

On 2017-12-06 00:06, Steve D'Aprano wrote:

On Wed, 6 Dec 2017 04:20 am, Jason wrote:


I ran into this:


https://stackoverflow.com/questions/27707581/why-does-csv-dictreader-skip-empty-lines


# unlike the basic reader, we prefer not to return blanks,
# because we will typically wind up with a dict full of None
# values

while iterating over two files, which are line-by-line corresponding. The
DictReader skipped ahead many lines breaking the line-by-line
correspondence.


Um... this doesn't follow. If they are line-by-line corresponding, then they
should skip the same number of blank lines and read the same number of
non-blank lines.

Even if one file has blanks and the other does not, if you iterate the over
the records themselves, they should keep their correspondence.

I'm afraid that if you want to convince me this is a buggy design, you need to
demonstrate a simple pair of CSV files where the non-blank lines are
corresponding (possibly with differing numbers of blanks in between) but the
CSV readers get out of alignment somehow.



And I want to argue that the difference of behavior should be considered a
bug. It should be considered as such because: 1. I need to know what's in
the file to know what class to use.


Sure. But blank lines don't tell you what class to use.


The file content should not break at-least-1-record-per-line.


Blank lines DO break that requirement. A blank line is not a record.


There may me multiple lines per record in the 
case of embedded new lines, but it should never no record per line.


I disagree. A blank line is not a record. If I have (say) five fields, then:

\n

is a blank record with five empty fields. \n alone is just a blank. The
DictReader correctly returns records with blank fields.


A blank line could be a record if there's only one field and it's empty.

[snip]
--
https://mail.python.org/mailman/listinfo/python-list


Re: f-string

2017-12-05 Thread John Pote


On 06/12/2017 00:16, Steve D'Aprano wrote:

Anyone got a handy copy of Python 3.6 available to test something for me?

What does compile('f"{spam} {eggs}"', '', 'single') return?

What does eval()'ing the above compiled object do? If necessary, you may have
to define spam and eggs first.


Thanks in advance.



rslt = compile('f"{spam} {eggs}"', '', 'single')

print( rslt )
print( "\n" )

spam = "SPAM"
eggs = "scrambled"
eRslt = eval( 'f"{spam} {eggs}"' )
print( eRslt )

Ran above test file and got,
>>python36 compiletest.py
 at 0x02120E40, file "", line 1>


SPAM scrambled
>>

Py version on Win 7 box
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit 
(AMD64)] on win32


Any help?
John
--
https://mail.python.org/mailman/listinfo/python-list


Re: f-string

2017-12-05 Thread Chris Angelico
On Wed, Dec 6, 2017 at 11:54 AM, John Pote  wrote:
>
> On 06/12/2017 00:16, Steve D'Aprano wrote:
>>
>> Anyone got a handy copy of Python 3.6 available to test something for me?
>>
>> What does compile('f"{spam} {eggs}"', '', 'single') return?
>>
>> What does eval()'ing the above compiled object do? If necessary, you may
>> have
>> to define spam and eggs first.
>
> SPAM scrambled
>
> Py version on Win 7 box
> Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit
> (AMD64)] on win32
>
> Any help?

I think Steve just wanted to see what we'd all define spam and eggs as.

ChrisA
*ducking for cover*
-- 
https://mail.python.org/mailman/listinfo/python-list


Python homework

2017-12-05 Thread nick.martinez2--- via Python-list
I have a question on my homework. My homework is to write a program in which 
the computer simulates the rolling of a die 50
times and then prints
(i). the most frequent side of the die
(ii). the average die value of all rolls. 
I wrote the program so it says the most frequent number out of all the rolls 
for example (12,4,6,14,10,4) and will print out "14" instead of 4 like I need.
This is what I have so far:
import random

def rollDie(number):
rolls = [0] * 6
for i in range(0, number):
roll=int(random.randint(1,6))
rolls[roll - 1] += 1
return rolls

if __name__ == "__main__":
result = rollDie(50)
print (result)
print(max(result))
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python homework

2017-12-05 Thread MRAB

On 2017-12-06 01:33, nick.martinez2--- via Python-list wrote:

I have a question on my homework. My homework is to write a program in which 
the computer simulates the rolling of a die 50
times and then prints
(i). the most frequent side of the die
(ii). the average die value of all rolls.
I wrote the program so it says the most frequent number out of all the rolls for example 
(12,4,6,14,10,4) and will print out "14" instead of 4 like I need.
This is what I have so far:
import random

def rollDie(number):
 rolls = [0] * 6
 for i in range(0, number):
 roll=int(random.randint(1,6))
 rolls[roll - 1] += 1
 return rolls

if __name__ == "__main__":
 result = rollDie(50)
 print (result)
 print(max(result))


What is "rolls"? It's the number of times each side came up.

In the last line you asked it for the maximum number of times a side 
came up, and that's what you got.


You now just have to figure out _which_ side of the die that count 
corresponds to.

--
https://mail.python.org/mailman/listinfo/python-list


Re: why won't slicing lists raise IndexError?

2017-12-05 Thread Rick Johnson
Steve D'Aprano wrote:

[...]

> You've already been told that there's no indication or
> reason to believe that it is a non-action. You've already
> been given at least one possible action. It isn't a non-
> action, it is two distinct actions:
>
> - the action you take when the slice is non-empty;
>
> - the action you take when the slice is empty.

When Python follows a logic clause like a train skating
along a set of railroad tracks, and finds itself in a *GHOST
TOWN*, that's not an action -- "Steve-o" -- it's a non-
action.

Listen, I think it might help you to understand the
absurdity of this else-clause if you ruminate about this
code using a metaphor. Below, i've defined some fictional
characters and objects that will live in a little
metaphorical world, and futhermore, explained how these
characters and objects relate to our real-life code example.



TERRY("THE BUILDER"): Terry is a personable fella who builds
little shanty towns for a living.

IF_VILLE: This is the first of two towns that Terry
establish in our little metaphorical world. And although
it's not quite the shining-city-on-a-hill that he, or the
inhabitants, had envisioned, he did manage to build a proper
train platform and a small warehouse for strong
deliverables, so we shouldn't be too critical of his work
here.

ELSE_VILLE: This is the "other" town that Terry establish.
However, after slaving away in the hot desert sun building
IF_VILLE all day, Terry decided to go home and drink a case
of beer, became drunk, and then forgot all about his
responsibilities to develope ELSE_VILLE. This has happened
before. But we typically forgive Terry for his irresponsible
nature simple because he's such a personable fella. However,
if this gets any worse, we may have to give him an
intervention.

KENNY_LINTER: Kenny Linter is a faithful civil servant who's
sole job is to inspect little shanty towns. And though he's
a little short on manners, he is typically competent
_enough_ to tell us if our towns are built to quality
standards, and if they're not built to quality standards,
well, it's his job to annoy us until we repair them.
Unfortunately, i've got some bad news to share with you.
After hastily exiting the train in ELSE-VILLE last night and
not realizing there was no platform in this town (Thanks
Terry!), KENNY_LINTER has broken both of his legs, fractured
an arm, and scratched his face up pretty bad. So i doubt
we'll be hearing from him in this episode, but stay tuned
for future appearances.

THE_TRAIN: The Train represents our Python script.

THE_TRACKS: The (railroad)tracks represent our program
logic. And the train's course is bound to these tracks

THE_ENGINEER: This is the Python runtime which "drives" the
train.

THE_TRACK_SWITCH: The Track Switch is a mechanical section
of the track (aka: logic gate) placed approximately halfway
between the train station and the two shanty towns that
Terry built. The switch allows the train to travel in one of
two directions -- one leading to IF_VILLE, and one leading
to ELSE_VILLE. Now, the mechanical apparatus of the switch
is spring loaded, and thus, by default, it always sends a
passing train to ELSE_VILLE. However, there is a tiny
control button mounted on a nearby fence post, one which
when pressed, will align the tracks with IF_VILLE. However,
since the trains in this metaphor have no brakes, and since
the button is really ~really~ small -- and since i couldn't
think of a more creative scenario! -- there is only one
creature who can press this button (TRUTHY_CLAWS!). And she
presses this button using one of her long pointy claws, and
thus, can send the train towards IF_VILLE.

TRUTHY_CLAWS: TruthyClaws (or "TC", as we like to call her)
is a mostly harmless anthropomorphized version of a
marsupial who's long claws only seem useful (at least upon
first sight) for causing a dreadful fright. But in reality,
these claws serve a vital purpose in our little metaphorical
world. You see, of ~all~ the characters in our little
universe, only TC (using one of her dreadfully long claws)
can press the little button on the TRACK_SWITCH and send us
along a path to IF-VILLE. And, every time TC takes a ride
with us in the train, she presses the little button for us,
and off we go to IF-VILLE (Hooray!). However, sometimes us
guys get a little rowdy and tell dirty jokes during the
trip, and TC, being uptight and all, tends to get offended,
and sometimes she refuses to ride with us. So, whenever TC
is with us, we always go to IF-VILLE, but if she's off
pouting somewhere, the train goes to ELSE-VILLE

THE_TRACK_DEVIL: The Track Devil is a supernatural being in
the mold of Loki who specializes in all forms of mischievous
pranks. And you nev

[RELEASE] Python 3.6.4rc1 and 3.7.0a3 now available for testing

2017-12-05 Thread Ned Deily
Announcing the immediate availability of Python 3.6.4 release candidate 1
and of Python 3.7.0 alpha 3!

Python 3.6.4rc1 is the first release candidate for Python 3.6.4, the next
maintenance release of Python 3.6.  While 3.6.4rc1 is a preview release and,
thus, not intended for production environments, we encourage you to explore
it and provide feedback via the Python bug tracker (https://bugs.python.org).
3.6.4 is planned for final release on 2017-12-18 with the next maintenance
release expected to follow in about 3 months.  You can find Python 3.6.4rc1
and more information here:
https://www.python.org/downloads/release/python-364rc1/

Python 3.7.0a3 is the third of four planned alpha releases of Python 3.7,
the next feature release of Python.  During the alpha phase, Python 3.7
remains under heavy development: additional features will be added
and existing features may be modified or deleted.  Please keep in mind
that this is a preview release and its use is not recommended for
production environments.  The next preview release, 3.7.0a4, is planned
for 2018-01-08. You can find Python 3.7.0a3 and more information here:
https://www.python.org/downloads/release/python-370a3/

--
  Ned Deily
  n...@python.org -- []

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-05 Thread Rustom Mody
On Wednesday, December 6, 2017 at 3:10:24 AM UTC+5:30, Igor Korot wrote:
> Hi, Tony,
> 
> On Tue, Dec 5, 2017 at 11:10 AM, Tony van der Hoff  wrote:
> > On 05/12/17 16:55, Igor Korot wrote:
> >> Hi,
> >>
> >> On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy wrote:
> >>> Sir,
> >>> I am b.tech student I would like to learn python. So please send 
> >>> the python software.
> >> Sorry, we don't send anything. You will have to go get it yourself. -)
> >>
> > Well, at least try to be helpful:
> > https://www.python.org/downloads/
> 
> This is LMGIFY.
> If they say they are tech students - they should know how to work with Google.
> 
> And I even tried to be polite. I should have probably write something like:
> 
> 1. Open the Web browser.
> 2. In the "Address Bar" type "www.pyton.org".
> 3. Find the link which reads "Downloads". Click on it.
> 4. Carefully read what version you need to install for your OS.
> 5. Apply the acquired knowledge and download the appropriate version.
> 6. Click on the installer (if on Windows).
> 7. Follow all the prompts.
> 8. Enjoy.
> 
> but this is too much for the tech student.

You are assuming that the strangeness of the request is about 'tech'
[engineering/tech existed centuries before computers]

Do remember one can be a tech-{student,professional} without
- ever having encountered free-software
- internet/USENET culture

… from which pov the request would not look so odd

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-05 Thread km
I dont know how these students are selected into b tech stream in India.
they are so dumb. All they know is a to open a program we need to double
click it and it runs.- windoze legacy. most of the time they pay huge
amount to a greedy college and get into tech stream.
Now that Java boom (jobs) is over in India and python is booming in AI and
machine learning these people want to learn python and get easy jobs
(software coolies). pls dont even entertain such posts.



On Wed, Dec 6, 2017 at 9:19 AM, Rustom Mody  wrote:

> On Wednesday, December 6, 2017 at 3:10:24 AM UTC+5:30, Igor Korot wrote:
> > Hi, Tony,
> >
> > On Tue, Dec 5, 2017 at 11:10 AM, Tony van der Hoff  wrote:
> > > On 05/12/17 16:55, Igor Korot wrote:
> > >> Hi,
> > >>
> > >> On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy wrote:
> > >>> Sir,
> > >>> I am b.tech student I would like to learn python. So please
> send the python software.
> > >> Sorry, we don't send anything. You will have to go get it yourself. -)
> > >>
> > > Well, at least try to be helpful:
> > > https://www.python.org/downloads/
> >
> > This is LMGIFY.
> > If they say they are tech students - they should know how to work with
> Google.
> >
> > And I even tried to be polite. I should have probably write something
> like:
> >
> > 1. Open the Web browser.
> > 2. In the "Address Bar" type "www.pyton.org".
> > 3. Find the link which reads "Downloads". Click on it.
> > 4. Carefully read what version you need to install for your OS.
> > 5. Apply the acquired knowledge and download the appropriate version.
> > 6. Click on the installer (if on Windows).
> > 7. Follow all the prompts.
> > 8. Enjoy.
> >
> > but this is too much for the tech student.
>
> You are assuming that the strangeness of the request is about 'tech'
> [engineering/tech existed centuries before computers]
>
> Do remember one can be a tech-{student,professional} without
> - ever having encountered free-software
> - internet/USENET culture
>
> … from which pov the request would not look so odd
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-05 Thread Abhiram R
On Wed, Dec 6, 2017 at 10:08 AM, km  wrote:

> I dont know how these students are selected into b tech stream in India.
> they are so dumb. All they know is a to open a program we need to double
> click it and it runs.
>
> ​We were all once "dumb". We learnt it because someone Taught us. I'd
rather not entertain such or refrain from condescending replies that would
further discourage people from trying to get into the field. With all the
emphasis on the Python "community", it's important not to be so dismissive.


Thanks
Abhiram ​




>
>
> On Wed, Dec 6, 2017 at 9:19 AM, Rustom Mody  wrote:
>
> > On Wednesday, December 6, 2017 at 3:10:24 AM UTC+5:30, Igor Korot wrote:
> > > Hi, Tony,
> > >
> > > On Tue, Dec 5, 2017 at 11:10 AM, Tony van der Hoff  wrote:
> > > > On 05/12/17 16:55, Igor Korot wrote:
> > > >> Hi,
> > > >>
> > > >> On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy wrote:
> > > >>> Sir,
> > > >>> I am b.tech student I would like to learn python. So please
> > send the python software.
> > > >> Sorry, we don't send anything. You will have to go get it yourself.
> -)
> > > >>
> > > > Well, at least try to be helpful:
> > > > https://www.python.org/downloads/
> > >
> > > This is LMGIFY.
> > > If they say they are tech students - they should know how to work with
> > Google.
> > >
> > > And I even tried to be polite. I should have probably write something
> > like:
> > >
> > > 1. Open the Web browser.
> > > 2. In the "Address Bar" type "www.pyton.org".
> > > 3. Find the link which reads "Downloads". Click on it.
> > > 4. Carefully read what version you need to install for your OS.
> > > 5. Apply the acquired knowledge and download the appropriate version.
> > > 6. Click on the installer (if on Windows).
> > > 7. Follow all the prompts.
> > > 8. Enjoy.
> > >
> > > but this is too much for the tech student.
> >
> > You are assuming that the strangeness of the request is about 'tech'
> > [engineering/tech existed centuries before computers]
> >
> > Do remember one can be a tech-{student,professional} without
> > - ever having encountered free-software
> > - internet/USENET culture
> >
> > … from which pov the request would not look so odd
> >
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
-Abhiram R
ᐧ
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python homework

2017-12-05 Thread ssghotra1997
import random

def rollDie(num):
sides = {'One':0, 'Two':0,'Three':0,'Four':0,'Five':0,'Six':0}

for i in range(num):
rolls = int(random.randint(1, 6))
if rolls == 1:
sides['One'] += 1
if rolls == 2:
sides['Two'] += 1
if rolls == 3:
sides['Three'] += 1
if rolls == 4:
sides['Four'] += 1
if rolls == 5:
sides['Five'] += 1
if rolls == 6:
sides['Six'] += 1

return sides,max(sides,key=sides.get)

print(rollDie(50))


*** OUTPUT *
({'One': 10, 'Two': 7, 'Three': 7, 'Four': 11, 'Five': 7, 'Six': 8}, 'Four')
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-05 Thread km
Remember that you are wasting time of lakhs of  python subscribers by
asking such dumb questions being tech students.  You people can Google and
watch movies / songs online  and you can't find how to download and install
python ? That's ridiculous!

On Dec 6, 2017 10:15 AM, "Abhiram R"  wrote:

>
>
> On Wed, Dec 6, 2017 at 10:08 AM, km  wrote:
>
>> I dont know how these students are selected into b tech stream in India.
>> they are so dumb. All they know is a to open a program we need to double
>> click it and it runs.
>>
>> ​We were all once "dumb". We learnt it because someone Taught us. I'd
> rather not entertain such or refrain from condescending replies that would
> further discourage people from trying to get into the field. With all the
> emphasis on the Python "community", it's important not to be so dismissive.
>
>
> Thanks
> Abhiram ​
>
>
>
>
>>
>>
>> On Wed, Dec 6, 2017 at 9:19 AM, Rustom Mody 
>> wrote:
>>
>> > On Wednesday, December 6, 2017 at 3:10:24 AM UTC+5:30, Igor Korot wrote:
>> > > Hi, Tony,
>> > >
>> > > On Tue, Dec 5, 2017 at 11:10 AM, Tony van der Hoff  wrote:
>> > > > On 05/12/17 16:55, Igor Korot wrote:
>> > > >> Hi,
>> > > >>
>> > > >> On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy wrote:
>> > > >>> Sir,
>> > > >>> I am b.tech student I would like to learn python. So
>> please
>> > send the python software.
>> > > >> Sorry, we don't send anything. You will have to go get it
>> yourself. -)
>> > > >>
>> > > > Well, at least try to be helpful:
>> > > > https://www.python.org/downloads/
>> > >
>> > > This is LMGIFY.
>> > > If they say they are tech students - they should know how to work with
>> > Google.
>> > >
>> > > And I even tried to be polite. I should have probably write something
>> > like:
>> > >
>> > > 1. Open the Web browser.
>> > > 2. In the "Address Bar" type "www.pyton.org".
>> > > 3. Find the link which reads "Downloads". Click on it.
>> > > 4. Carefully read what version you need to install for your OS.
>> > > 5. Apply the acquired knowledge and download the appropriate version.
>> > > 6. Click on the installer (if on Windows).
>> > > 7. Follow all the prompts.
>> > > 8. Enjoy.
>> > >
>> > > but this is too much for the tech student.
>> >
>> > You are assuming that the strangeness of the request is about 'tech'
>> > [engineering/tech existed centuries before computers]
>> >
>> > Do remember one can be a tech-{student,professional} without
>> > - ever having encountered free-software
>> > - internet/USENET culture
>> >
>> > … from which pov the request would not look so odd
>> >
>> > --
>> > https://mail.python.org/mailman/listinfo/python-list
>> >
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
>
>
> --
> -Abhiram R
> ᐧ
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] [RELEASE] Python 3.6.4rc1 and 3.7.0a3 now available for testing

2017-12-05 Thread Hasan Diwan
Congrats to all involved! -- H​
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-05 Thread Chris Angelico
On Wed, Dec 6, 2017 at 4:27 PM, km  wrote:
> Remember that you are wasting time of lakhs of  python subscribers by
> asking such dumb questions being tech students.  You people can Google and
> watch movies / songs online  and you can't find how to download and install
> python ? That's ridiculous!
>

This attack is unwarranted. Please don't set fire to people simply
because they asked a question like this. You can be far more courteous
than this, even if you refuse to help. Particularly, the "you people"
sounds like a blanket statement, which is almost certainly not useful
to the discussion.

To the OP: Several people have suggested ways to get the software you
need, even if they've done it somewhat rudely. The best thing to do
here is to type "python" into your favourite search engine (Google,
DuckDuckGo, Bing, AltaVista, etc), and then read the web page for a
download link. You should be able to find it. If you've tried and
failed, or if something confuses you, come back to the list and ask a
specific question, and we'll be happy to answer.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: we want python software

2017-12-05 Thread Ethan Furman

On 12/05/2017 09:27 PM, km wrote:

[snip]

Many things in this world are frustrating, but being hateful will not solve 
anything.  Please control yourself.

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: f-string

2017-12-05 Thread Steve D'Aprano
On Wed, 6 Dec 2017 11:54 am, John Pote wrote:

[...]
> Ran above test file and got,
>  >>python36 compiletest.py
>  at 0x02120E40, file "", line 1>
> 
> 
> SPAM scrambled

Thanks everyone, that's what I wanted to see.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: csv.DictReader line skipping should be considered a bug?

2017-12-05 Thread Steve D'Aprano
On Wed, 6 Dec 2017 11:43 am, MRAB wrote:

> A blank line could be a record if there's only one field and it's empty.


That's technically correct, but if you have only one field, its barely a CSV
file at all.

Given that CSV technically requires at least two fields (in order to have a
separator between fields) I'm not too concerned by the inability to represent
a record consisting of only a single blank field. If there was an actual CSV
standard (rather than just a collection of implementations with slightly
different behaviour) I'd be more concerned at this design lack.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list