Re: Is there something similar to `set -v` of bash in python

2016-09-17 Thread Thorsten Kampe
* Peng Yu (Fri, 16 Sep 2016 21:31:37 -0500) > > Hi, `set -v` in bash allows the print of the command before print the > output of the command. > > I want to do the similar thing --- print a python command and then > print the output of the command. Is it possible with python? Rather easily. I've

Re: Is there something similar to `set -v` of bash in python

2016-09-17 Thread Thorsten Kampe
* Thorsten Kampe (Sat, 17 Sep 2016 12:25:05 +0200) > > * Peng Yu (Fri, 16 Sep 2016 21:31:37 -0500) > > > > Hi, `set -v` in bash allows the print of the command before print the > > output of the command. > > > > I want to do the similar thing --- print a python command and then > > print the out

Re: array.itemsize: Documentation Versus Reality

2016-09-17 Thread Christian Heimes
On 2016-09-17 05:47, Lawrence D’Oliveiro wrote: > >>> a = array.array("I", (0,)) > >>> a.itemsize > 4 > >>> a = array.array("L", (0,)) > >>> a.itemsize > 8 > > According to , the “minimum > size” should be 2 and 4 respectively.

Re: Is there something similar to `set -v` of bash in python

2016-09-17 Thread Ned Batchelder
On Saturday, September 17, 2016 at 2:37:42 AM UTC-4, Steve D'Aprano wrote: > On Sat, 17 Sep 2016 12:31 pm, Peng Yu wrote: > > > Hi, `set -v` in bash allows the print of the command before print the > > output of the command. > > > > I want to do the similar thing --- print a python command and th

Re: Expression can be simplified on list

2016-09-17 Thread Piet van Oostrum
Daiyue Weng writes: > Hi, I found that when I tried to make an equality test on empty like, > > if errors == []: > > PyCharm always warns me, > > Expression can be simplified. > > I am wondering what's wrong and how to fix this? > It is not wrong, but it can be simplified to just: if errors: Th

How to convert 'ö' to 'oe' or 'o' (or other similar things) in a string?

2016-09-17 Thread Peng Yu
Hi, I want to convert strings in which the characters with accents should be converted to the ones without accents. Here is my current code. $ cat main.sh #!/usr/bin/env bash # vim: set noexpandtab tabstop=2: set -v ./main.py Förstemann ./main.py Frédér8ic@ $ cat main.p

Re: How to convert 'ö' to 'oe' or 'o' (or other similar things) in a string?

2016-09-17 Thread Kouli
Hello, try the Unidecode module - https://pypi.python.org/pypi/Unidecode. Kouli On Sat, Sep 17, 2016 at 6:12 PM, Peng Yu wrote: > Hi, I want to convert strings in which the characters with accents > should be converted to the ones without accents. Here is my current > code. > > =

Re: How to convert 'ö' to 'oe' or 'o' (or other similar things) in a string?

2016-09-17 Thread Martin Schöön
Den 2016-09-17 skrev Kouli : > Hello, try the Unidecode module - https://pypi.python.org/pypi/Unidecode. > > Kouli > > On Sat, Sep 17, 2016 at 6:12 PM, Peng Yu wrote: >> Hi, I want to convert strings in which the characters with accents >> should be converted to the ones without accents. Here is m

Re: Is there something similar to `set -v` of bash in python

2016-09-17 Thread Peng Yu
> python -m trace -t yourprogram.py If I want to add some command in yourprogram.py to show the commands used it instead of calling trace from the command line, can it be done? -- Regards, Peng -- https://mail.python.org/mailman/listinfo/python-list

Re: How to convert 'ö' to 'oe' or 'o' (or other similar things) in a string?

2016-09-17 Thread Marko Rauhamaa
Martin Schöön : > Related anecdote from Phoenix AZ. By now you have noticed my family > name: Schöön. On airline tickets and boarding passes in the U.S. it > gets spelled Schoeoen. Do Swedes do that German thing, too? If you have to write Finnish without ä and ö, you simply leave out the dots. (On

Re: array.itemsize: Documentation Versus Reality

2016-09-17 Thread Lawrence D’Oliveiro
On Saturday, September 17, 2016 at 11:54:10 PM UTC+12, Christian Heimes wrote: > > ... on Windows (32 and 64bit), a long is always 32bit and an array with > datatype "L" has itemsize 4. Ah, I forgot the LLP64 nonsense... -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there something similar to `set -v` of bash in python

2016-09-17 Thread Ned Batchelder
On Saturday, September 17, 2016 at 4:41:32 PM UTC-4, Peng Yu wrote: > > python -m trace -t yourprogram.py > > If I want to add some command in yourprogram.py to show the commands > used it instead of calling trace from the command line, can it be > done? I don't know of a way to do that, but

Re: array.itemsize: Documentation Versus Reality

2016-09-17 Thread Lawrence D’Oliveiro
On Saturday, September 17, 2016 at 3:47:15 PM UTC+12, I wrote: > >>> a = array.array("I", (0,)) > >>> a.itemsize > 4 > >>> a = array.array("L", (0,)) > >>> a.itemsize > 8 Let me rephrase the question. It seems clear that “l” a

Is the content available in the html doc available in help()?

2016-09-17 Thread Peng Yu
Hi, I want to get the same content as the html doc from help(). I am not sure if this is possible (as I tried help(inspect) which does not give the same content). Could anybody confirm if there is a way to get the same content from help()? Thanks. https://docs.python.org/2/library/inspect.html --

Official Python documentation lookup while programming (was: Is the content available in the html doc available in help()?)

2016-09-17 Thread Ben Finney
Peng Yu writes: > Hi, I want to get the same content as the html doc from help(). That's not what the ‘help’ function does, so I don't think that's feasible. Moreover, the Python interpreter does not have any notion of where the HTML documentation is stored, nor how to access it, nor how to pre

Re: Is the content available in the html doc available in help()?

2016-09-17 Thread Lawrence D’Oliveiro
On Sunday, September 18, 2016 at 12:51:11 PM UTC+12, Peng Yu wrote: > I want to get the same content as the html doc from help(). ldo@theon:~> pydoc3 inspect Help on module inspect: NAME inspect - Get useful information from live Python objects. MODULE REFERENCE h

Re: Is the content available in the html doc available in help()?

2016-09-17 Thread Peng Yu
Sorry. I am still referring to python2. On Sat, Sep 17, 2016 at 8:45 PM, Lawrence D’Oliveiro wrote: > On Sunday, September 18, 2016 at 12:51:11 PM UTC+12, Peng Yu wrote: >> I want to get the same content as the html doc from help(). > > ldo@theon:~> pydoc3 inspect > Help on module inspect

Re: array.itemsize: Documentation Versus Reality

2016-09-17 Thread eryk sun
On Sun, Sep 18, 2016 at 12:17 AM, Lawrence D’Oliveiro wrote: > > why does the documentation suggest that “i” and “I” could have an item size > of 2? SHRT_MAX <= INT_MAX <= LONG_MAX <= LLONG_MAX. short int and int ("h" and "i") are at least 16-bit. long int ("l") is at least 32-bit. long long in

Re: Is there something similar to `set -v` of bash in python

2016-09-17 Thread Peng Yu
The manual says the following. "The trace function is invoked (with event set to 'call') whenever a new local scope is entered; it should return a reference to a local trace function to be used that scope, or None if the scope shouldn’t be traced." It means that one can not somehow settrace in on

Re: array.itemsize: Documentation Versus Reality

2016-09-17 Thread Lawrence D’Oliveiro
On Sunday, September 18, 2016 at 2:34:46 PM UTC+12, eryk sun wrote: > However, I see that MicroPython [1] has been ported to 16-bit > PIC microcontrollers. An int should be 16-bit in that case. > > [1]: https://github.com/micropython/micropython From the readme: “MicroPython implements the entire

Re: Is the content available in the html doc available in help()?

2016-09-17 Thread Steve D'Aprano
On Sun, 18 Sep 2016 10:50 am, Peng Yu wrote: > Hi, I want to get the same content as the html doc from help(). I am > not sure if this is possible (as I tried help(inspect) which does not > give the same content). Could anybody confirm if there is a way to get > the same content from help()? Thank

Re: How to convert 'ö' to 'oe' or 'o' (or other similar things) in a string?

2016-09-17 Thread Peng Yu
On Sat, Sep 17, 2016 at 3:20 PM, Martin Schöön wrote: > Den 2016-09-17 skrev Kouli : >> Hello, try the Unidecode module - https://pypi.python.org/pypi/Unidecode. I don't find a way to make it print oe for ö. Could anybody please advise what is the correct way to do it? ==> main.py <== #!/usr/bin

Re: How to convert 'ö' to 'oe' or 'o' (or other similar things) in a string?

2016-09-17 Thread Steve D'Aprano
On Sun, 18 Sep 2016 07:19 am, Thomas 'PointedEars' Lahn wrote: > AFAIK, “ä”, “ö”, and “ü” are not accented characters in any natural > language, but characters of their own (umlauts). Are you saying that English is not a natural language? -- Steve “Cheer up,” they said, “things could be wo

Re: Is there something similar to `set -v` of bash in python

2016-09-17 Thread Chris Angelico
On Sun, Sep 18, 2016 at 1:08 PM, Peng Yu wrote: > The manual says the following. > > "The trace function is invoked (with event set to 'call') whenever a > new local scope is entered; it should return a reference to a local > trace function to be used that scope, or None if the scope shouldn’t > b

Re: array.itemsize: Documentation Versus Reality

2016-09-17 Thread Chris Angelico
On Sun, Sep 18, 2016 at 1:16 PM, Lawrence D’Oliveiro wrote: > On Sunday, September 18, 2016 at 2:34:46 PM UTC+12, eryk sun wrote: >> However, I see that MicroPython [1] has been ported to 16-bit >> PIC microcontrollers. An int should be 16-bit in that case. >> >> [1]: https://github.com/micropytho

Re: how to automate java application in window using python

2016-09-17 Thread Gregory Ewing
Lawrence D’Oliveiro wrote: On Friday, September 16, 2016 at 10:22:34 PM UTC+12, Christian Gollwitzer wrote: "How do I automate a Java application using Python?" Which is really a meaningless question. “Automation” is what computer programs do. It's not meaningless. The term "automation" is

Re: array.itemsize: Documentation Versus Reality

2016-09-17 Thread eryk sun
On Sun, Sep 18, 2016 at 3:55 AM, Chris Angelico wrote: > On Sun, Sep 18, 2016 at 1:16 PM, Lawrence D’Oliveiro > wrote: >> On Sunday, September 18, 2016 at 2:34:46 PM UTC+12, eryk sun wrote: >>> However, I see that MicroPython [1] has been ported to 16-bit >>> PIC microcontrollers. An int should b

Re: how to automate java application in window using python

2016-09-17 Thread Lawrence D’Oliveiro
On Sunday, September 18, 2016 at 4:11:49 PM UTC+12, Gregory Ewing wrote: > The term "automation" is frequently used in the Windows world to mean > programming something that you would otherwise do manually through a GUI... Which is not something that GUIs are designed for. Therefore it is at best

Re: Is the content available in the html doc available in help()?

2016-09-17 Thread eryk sun
On Sun, Sep 18, 2016 at 3:26 AM, Steve D'Aprano wrote: > help() does *not* return the same documentation as on the website. The > website usually includes a lot more detail. > > The help() function introspects the python source code and formats the > docstrings found, so it will often be very much

Re: How to convert 'ö' to 'oe' or 'o' (or other si =?utf-8?Q?milar_things)_in_a_string??=

2016-09-17 Thread Thorsten Kampe
* Martin Schöön (17 Sep 2016 20:20:12 GMT) > > Den 2016-09-17 skrev Kouli : > > Hello, try the Unidecode module - https://pypi.python.org/pypi/Unidecode. > > > > Kouli > > > > On Sat, Sep 17, 2016 at 6:12 PM, Peng Yu wrote: > >> Hi, I want to convert strings in which the characters with accents >

Re: how to automate java application in window using python

2016-09-17 Thread Steven D'Aprano
On Sunday 18 September 2016 14:53, Lawrence D’Oliveiro wrote: > On Sunday, September 18, 2016 at 4:11:49 PM UTC+12, Gregory Ewing wrote: >> The term "automation" is frequently used in the Windows world to mean >> programming something that you would otherwise do manually through a GUI... > > Whic

Re: How to convert 'ö' to 'oe' or 'o' (or other similar things) in a string?

2016-09-17 Thread Steven D'Aprano
On Sunday 18 September 2016 13:30, Peng Yu wrote: > On Sat, Sep 17, 2016 at 3:20 PM, Martin Schöön > wrote: >> Den 2016-09-17 skrev Kouli : >>> Hello, try the Unidecode module - https://pypi.python.org/pypi/Unidecode. > > I don't find a way to make it print oe for ö. Could anybody please > advis

Re: How to convert 'ö' to 'oe' or 'o' (or other similar things) in a string?

2016-09-17 Thread Steven D'Aprano
On Sunday 18 September 2016 15:59, Thorsten Kampe wrote: > * Martin Schöön (17 Sep 2016 20:20:12 GMT) >> >> Den 2016-09-17 skrev Kouli : >> > Hello, try the Unidecode module - https://pypi.python.org/pypi/Unidecode. >> > >> > Kouli >> > >> > On Sat, Sep 17, 2016 at 6:12 PM, Peng Yu wrote: >> >>