Re: Lies in education [was Re: The "loop and a half"]

2017-10-10 Thread Marko Rauhamaa
Bill : > Steve D'Aprano wrote: >> Bjarne Stroustrup is famous for designing one of the most >> heavyweight, baraque, hard-to-understand, difficult-to-use >> programming languages in common use. While C++ has many excellent >> features, and is constrained by the need to be compatible with C, I >> d

[Q] days -> months

2017-10-10 Thread Byung-Hee HWANG (황병희, 黃炳熙)
In real life, i am breeding Hanwoo(Korean cattle), about 100 head of cattle. About 50 days ago, i got one young cattle. The name is "Bullseye". I love Bullseye. Until the Bullseye is released by butchery, i would like to maintain him with his age. So thus i did write some humble code to identify hi

Re: Lies in education [was Re: The "loop and a half"]

2017-10-10 Thread Bill
Dennis Lee Bieber wrote: On Tue, 10 Oct 2017 20:48:26 -0400, Bill declaimed the following: cast stones at C/C++. People started programming in C in the late 70's, and before that some were programming in B ("B Programming Language"), Preceded by BCPL (which leads to the joke that the

Re: FW: Printing to a file and a terminal at the same time

2017-10-10 Thread Michael Torrie
On 10/10/2017 10:09 AM, Vail, Rick wrote: > I have a script for Cisco devices that will do configuration or any CLI > command. What I would like to do is print the output to my terminal(windows) > and to a file. I can come up with stdout parameters > To print to a file but not to the screen and

Re: about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread Steve D'Aprano
On Wed, 11 Oct 2017 02:15 am, Paul Moore wrote: > These are all run-time behaviours, and so there's no way you can check > for them ahead of time. If you want to be sure setattr is allowed, you > need to handle possible exceptions: > > try: > setattr(o, name, value) > except Excep

Re: Lies in education [was Re: The "loop and a half"]

2017-10-10 Thread Bill
Steve D'Aprano wrote: On Tue, 10 Oct 2017 06:06 am, Stefan Ram wrote: In his book about programming, Bjarne Stroustrup writes: |We try hard to avoid "white lies"; that is, we refrain from |oversimplified explanations that are clear and easy to |understand, but not true in the context of real l

Re: Printing to a file and a terminal at the same time

2017-10-10 Thread MRAB
On 2017-10-10 17:00, Vail, Rick wrote: I have a script for Cisco devices that will do configuration or any CLI command. What I would like to do is print the output to my terminal(windows) and to a file. I can come up with stdout parameters To print to a file but not to the screen and when I re

Unable to run pip in Windows 10

2017-10-10 Thread Michael Cuddehe
I have tried multiple versions, 32 & 64 bit. Same problem. "This app can't run on your PC. To find a version for your PC, check with the software publisher." -- https://mail.python.org/mailman/listinfo/python-list

FW: Printing to a file and a terminal at the same time

2017-10-10 Thread Vail, Rick
Rick Vail | Network Engineer Presidio (NASDAQ: PSDO) | www.presidio.com 12272 Hancock St, Carmel, IN 46032 D: 317.428.6399 | C: 317.847.0493 | rv...@presidio.com [Future. Built.] Follow us: [Follow Presidio on Tw

RE: Printing to a file and a terminal at the same time

2017-10-10 Thread Vail, Rick
I have a script for Cisco devices that will do configuration or any CLI command. What I would like to do is print the output to my terminal(windows) and to a file. I can come up with stdout parameters To print to a file but not to the screen and when I remove the stdout part it prints to the sc

Re: about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread Ned Batchelder
On 10/10/17 11:00 AM, Stefan Ram wrote: xieyuheng writes: 1. 'setattr(o, name, value)' can be used for what kind of objects ? It takes three objects as arguments. The first object should have an attribute named by the value of »name« that should allow this attribute to be set to »

Re: about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread Thomas Jollans
On 2017-10-10 16:37, xieyuheng wrote: >> Some callables may not be introspectable in certain implementations of > Python. >> For example, in CPython, some built-in functions defined in C >> provide no metadata about their arguments. > >this is depends on implementation, so I ask f

Re: about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread Terry Reedy
On 10/10/2017 10:37 AM, xieyuheng wrote: 2. what kind of functions does not have signature, so that 'inspect.signature(f)' can be used for them ? When .signature was added, it may not have been usable with *any* C-coded function. About the same, a mechanism was added to make signatures

Keyboard Input [was: The "loop and a half"]

2017-10-10 Thread Mikhail V
Chris Angelico wrote: > On Mon, Oct 9, 2017 at 7:05 PM, Mikhail V wrote: > > The first thing a developer should provide - the keys and mouse input > > should be > > *customizable* by the user. It is so by most serious application I have > > ever used. > > And they most certainly are. Often, in so

Re: Python GUI application embedding a web browser - Options?

2017-10-10 Thread Paul Moore
On 10 October 2017 at 16:07, oliver wrote: > Can you elaborate what is not sufficient with Qt's web components? I can't, sorry. Douglas was resurrecting a thread from a year ago. At the time I was trying to do a quick proof of concept project and asked for help on here. The project never really w

Re: about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread Paul Moore
On 10 October 2017 at 15:37, xieyuheng wrote: > 1. 'setattr(o, name, value)' can be used for what kind of objects ? > >section '2. Built-in Functions' >of the official documentation says : > >> The function assigns the value to the attribute, provided the object > allows it. Anything

Re: Python GUI application embedding a web browser - Options?

2017-10-10 Thread oliver
Can you elaborate what is not sufficient with Qt's web components? http://doc.qt.io/qt-5/topics-web-content.html. This allows for HTML, CSS, Javascript, via either native C++ Qt, QML, or Python (PyQt) or mixtures of these 3. That said, I have not yet used Qt`s web engine so I don`t know how full-fe

about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread xieyuheng
in CPython, instead of trying each object and function, is there any rules can help me answer the following questions ? or is there any third part documentations [community driven docs ? wiki ?] that can answer them ? 1. 'setattr(o, name, value)' can be used for what kind of objects ? secti

about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread xieyuheng
in CPython, instead of trying each object and function, is there any rules can help me answer the following questions ? or is there any third part documentations [community driven docs ? wiki ?] that can answer them ? 1. 'setattr(o, name, value)' can be used for what kind of objects ? secti

Re: pathlib PurePosixPath

2017-10-10 Thread eryk sun
On Tue, Oct 10, 2017 at 11:18 AM, Tim Golden wrote: > On 2017-10-10 10:58, Chris Angelico wrote: >> On Tue, Oct 10, 2017 at 8:56 PM, Tim Golden wrote: >> >>> In fact its presence in that filename creates a (usually hidden) data >>> stream piggybacked onto that file which has the name "abc" into w

Re: The "loop and a half"

2017-10-10 Thread Paul Moore
On 10 October 2017 at 13:44, bartc wrote: >> Can you not see how frustrating this is for people who >> have spent good chunks of their lives trying to do the best they can >> on these software systems? > > Only if they concede I might have a point. I haven't seen much sign of that! You have a poi

Re: The "loop and a half"

2017-10-10 Thread bartc
On 09/10/2017 01:37, boB Stepp wrote: On Sun, Oct 8, 2017 at 5:36 AM, bartc wrote: And Bart, when large numbers of technical experts in their fields have spent many hours/months/years, yea, even several decades, developing these software systems, why do you think that you, all by yourself, kn

Re: on = style

2017-10-10 Thread sjmsoft
Being an old-timer, I was brought up on languages like COBOL, where programmers love to line up MOVE, COMPUTE and some other statements. I still do that when I write COBOL, as it is expected by other programmers and somehow just seems right. But I resist the urge in Python and never do it. Pr

Re: Lies in education [was Re: The "loop and a half"]

2017-10-10 Thread Bill
Rhodri James wrote: On 09/10/17 20:06, Stefan Ram wrote: r...@zedat.fu-berlin.de (Stefan Ram) writes: Steve D'Aprano writes: At various stages of education, we teach many lies-to-children, including: Many of those lies can be perfectly true in some sense. I pick some examples: Another n

Re: on = style

2017-10-10 Thread Rhodri James
On 09/10/17 08:46, Steve D'Aprano wrote: I truly believe that, with*very* few exceptions (*ALL* of which are some form of in-line data table, and even then only rarely) any programmer who worries about lining up assignments on different lines like this is just engaged in a time-wasting exercise

Re: Lies in education [was Re: The "loop and a half"]

2017-10-10 Thread Rhodri James
On 09/10/17 20:06, Stefan Ram wrote: r...@zedat.fu-berlin.de (Stefan Ram) writes: Steve D'Aprano writes: At various stages of education, we teach many lies-to-children, including: Many of those lies can be perfectly true in some sense. I pick some examples: Another noun phrase with "lie"

Re: pathlib PurePosixPath

2017-10-10 Thread Tim Golden
On 2017-10-10 10:58, Chris Angelico wrote: On Tue, Oct 10, 2017 at 8:56 PM, Tim Golden wrote: My understanding of the document you linked to is that the colon still has special meaning, and thus you can't use it in arbitrary file names. In fact its presence in that filename creates a (usua

Re: pathlib PurePosixPath

2017-10-10 Thread Chris Angelico
On Tue, Oct 10, 2017 at 8:56 PM, Tim Golden wrote: >> My understanding of the document you linked to >> is that the colon still has special meaning, and thus you can't use it >> in arbitrary file names. > > > In fact its presence in that filename creates a (usually hidden) data stream > piggybacke

Re: pathlib PurePosixPath

2017-10-10 Thread Tim Golden
On 2017-10-10 10:28, Chris Angelico wrote: On Tue, Oct 10, 2017 at 8:22 PM, Tim Golden wrote: On 2017-10-10 08:29, Chris Angelico wrote: On Tue, Oct 10, 2017 at 6:21 PM, Sayth Renshaw wrote: Hi How do I create a valid file name and directory with pathlib? When I create it using PurePos

Re: pathlib PurePosixPath

2017-10-10 Thread Chris Angelico
On Tue, Oct 10, 2017 at 8:22 PM, Tim Golden wrote: > On 2017-10-10 08:29, Chris Angelico wrote: >> >> On Tue, Oct 10, 2017 at 6:21 PM, Sayth Renshaw >> wrote: >>> >>> Hi >>> >>> How do I create a valid file name and directory with pathlib? >>> >>> When I create it using PurePosixPath I end up wit

Re: pathlib PurePosixPath

2017-10-10 Thread Tim Golden
On 2017-10-10 08:29, Chris Angelico wrote: On Tue, Oct 10, 2017 at 6:21 PM, Sayth Renshaw wrote: Hi How do I create a valid file name and directory with pathlib? When I create it using PurePosixPath I end up with an OSError due to an obvously invlaid path being created. You're on Windows.

Re: pathlib PurePosixPath

2017-10-10 Thread Thomas Jollans
On 2017-10-10 09:44, Sayth Renshaw wrote: > >>> Hi >>> >>> How do I create a valid file name and directory with pathlib? >>> >>> When I create it using PurePosixPath I end up with an OSError due to an >>> obvously invlaid path being created. >> >> You're on Windows. The rules for POSIX paths don'

Re: Introducing the "for" loop

2017-10-10 Thread Peter Otten
Stefan Ram wrote: > Which advice do you refer to? Teach the parts that are most useful first, i. e. for loops over anything but range rather than while loops. -- https://mail.python.org/mailman/listinfo/python-list

Re: pathlib PurePosixPath

2017-10-10 Thread Peter Otten
Sayth Renshaw wrote: > Thanks. Updated the script. But shouldn't it create the file if it doesn't > exist? Which none of them will. > pathlib.PurePath(r'C:\Users\Sayth\Projects\results', file_name) > with open(result_path, 'a') as f: > f.write(data) > ##Output > File

Re: pathlib PurePosixPath

2017-10-10 Thread BlindAnagram
On 10/10/2017 08:44, Sayth Renshaw wrote: > >>> Hi >>> >>> How do I create a valid file name and directory with pathlib? >>> >>> When I create it using PurePosixPath I end up with an OSError due to an >>> obvously invlaid path being created. >> >> You're on Windows. The rules for POSIX paths don'

Re: The "loop and a half"

2017-10-10 Thread Paul Moore
On 9 October 2017 at 01:37, boB Stepp wrote: > I follow this list in an effort to learn as much as I can even though > I am usually a fish out of water here. But this thread in all its > twists and turns and various subject line changes seems to have gotten > totally out of hand. Even though I a

Re: pathlib PurePosixPath

2017-10-10 Thread Sayth Renshaw
> > Hi > > > > How do I create a valid file name and directory with pathlib? > > > > When I create it using PurePosixPath I end up with an OSError due to an > > obvously invlaid path being created. > > You're on Windows. The rules for POSIX paths don't apply to your file > system, and... > > >

Re: pathlib PurePosixPath

2017-10-10 Thread Chris Angelico
On Tue, Oct 10, 2017 at 6:21 PM, Sayth Renshaw wrote: > Hi > > How do I create a valid file name and directory with pathlib? > > When I create it using PurePosixPath I end up with an OSError due to an > obvously invlaid path being created. You're on Windows. The rules for POSIX paths don't apply

pathlib PurePosixPath

2017-10-10 Thread Sayth Renshaw
Hi How do I create a valid file name and directory with pathlib? When I create it using PurePosixPath I end up with an OSError due to an obvously invlaid path being created. import pathlib for dates in fullUrl: # print(dates) time.sleep(0.3) r = requests.get(dates) data = r.jso

Re: Is there a way to globally set the print function separator?

2017-10-10 Thread Steve D'Aprano
On Tue, 10 Oct 2017 03:05 pm, John Black wrote: >> functools.partial(print, sep='') is the winner, IMO. > > Ok, I got that working too after someone told me I have to import > functools. Can you explain what it means? It looks like it is not > defining another function like the other solutions