Hi,
https://docs.python.org/3/library/email.parser.html
It says "For MIME messages, the root object will return True from its
is_multipart() method, and the subparts can be accessed via the
payload manipulation methods, such as get_body(), iter_parts(), and
walk()."
But when I try the following
Hi,
https://www.fuzzingbook.org/html/Grammars.html
I am trying to follow an example on the above page. But it does not
show a figure. Could anybody let me know how to display the figure?
$ ipython3
Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27)
Type 'copyright', 'credits' or 'license'
Suppose that I use this to read from stdin. But `line` contains
decoded data in python 3. In python 2, it contains the original data.
What is the best way to get the original data in python 3? Thanks.
```
for line in sys.stdin:
...
```
--
Regards,
Peng
--
https://mail.python.org/mailman/list
Hi,
I'd like to tell what part is zlib.compress data in an input stream.
One way is to use some characters that never appear in zlib.compress
output to denote the boundary. Are there such characters? Thanks.
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-list
```
import requests
s = requests.Session()
import json
s.cookies.set_cookie(requests.utils.cookiejar_from_dict(json.load(sys.stdin)))
```
I used the above command to load cookies from a json file. But I got
the following error. Does anybody know how to fix the error? Thanks.
```
Traceback (most r
Hi,
I'd like to use a program to convert between basic regular expression
(BRE) and extended regular expression (ERE). (see man grep for the
definition of BRE and ERE). Does python has a module for this purpose?
Thanks.
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-list
Hi,
I got the following error. Does anybody know how to fix it? Thanks.
$ pip
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/pip",
line 7, in
from pip._internal import main
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python
Hi,
>>> import re
>>> prog=re.compile('[a-f]+')
>>> help(prog)
I can use the above command to access SRE_Pattern. But this involves
the creation of an object of the class.
I tried to directly access the class. But it does not work. Does
anybody know if there is a way to directly access the class
On Sat, Feb 24, 2018 at 1:08 PM, Peng Yu wrote:
> On Sat, Feb 24, 2018 at 12:45 PM, Wildman via Python-list
> wrote:
>> On Sat, 24 Feb 2018 11:41:32 -0600, Peng Yu wrote:
>>
>>> I would like to just get the escaped string without the single quotes.
>>
On Sat, Feb 24, 2018 at 12:45 PM, Wildman via Python-list
wrote:
> On Sat, 24 Feb 2018 11:41:32 -0600, Peng Yu wrote:
>
>> I would like to just get the escaped string without the single quotes.
>> Is there a way to do so? Thanks.
>>
>>>>> x='\n
I would like to just get the escaped string without the single quotes.
Is there a way to do so? Thanks.
>>> x='\n'
>>> print repr(x)
'\n'
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-list
Hi,
I can extracted the encoded value as bytes. But is there a way to
extracted the decoded value (for á, it is C1)? Thanks.
$ cat ./dumpunicode.py
#!/usr/bin/env python3
while True:
c = sys.stdin.read(1)
if c:
print(c)
print('0x' + ''.join(['%x' % x for x in reversed(byt
Here shows some code for reading Unicode characters one by one in
python2. Is it the best code for reading Unicode characters one by one
in python2?
https://rosettacode.org/wiki/Read_a_file_character_by_character/UTF8#Python
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-li
Hi,
I see _sre.SRE_Match is returned by re.match. But I don't find where
it is defined. Does anybody know how to get its help page within
python command line? Thanks.
>>> import re
>>> m = re.match('a', 'abc')
>>> print type(m)
>>> _sre.SRE_Match
Traceback (most recent call last):
File "", lin
> Just to be clear, TAB *only* appears in utf-8 as the encoding for the actual
> TAB character, not as a part of any other character's encoding. The only
> bytes that can appear in the utf-8 encoding of non-ascii characters are
> starting with 0xC2 through 0xF4, followed by one or more of 0x80 t
Hi,
I use the following code to process TSV input.
$ printf '%s\t%s\n' {1..10} | ./main.py
['1', '2']
['3', '4']
['5', '6']
['7', '8']
['9', '10']
$ cat main.py
#!/usr/bin/env python
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:
import sys
for line in sys.stdin
> When you use square brackets, you're creating a generator, as in your
> second example. Your first example is a slightly different beast
> called a "generator expression". If you search for that in the docs or
> on the web, you'll find what you want.
Thanks. Can the documentation be found by `he
Hi,
I see the following usage of list comprehension can generate a
generator. Does anybody know where this is documented? Thanks.
$ cat main.py
#!/usr/bin/env python
import sys
lines = (line.rstrip('\n') for line in sys.stdin)
print lines
lines = [line.rstrip('\n') for line in sys.stdin]
print
See for example this file.
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/rnn_cell.py
On Sat, Dec 23, 2017 at 12:03 AM, Steve D'Aprano
wrote:
> On Sat, 23 Dec 2017 04:38 pm, Peng Yu wrote:
>
>> Hi, I only can find the doc for @. What does @@ mean
Hi, I only can find the doc for @. What does @@ mean in python?
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-list
Where is it documented that __xor__ and ^ is the same as
symmetric_difference? Thanks.
BTW, I am using to Python 2, your help message is different from mine.
Do you use Python 3?
On Fri, Dec 22, 2017 at 9:41 PM, Dan Sommers wrote:
> On Fri, 22 Dec 2017 21:35:53 -0600, Peng Yu wrote:
>
&g
Hi, The following example shows that both locals() and globals() are
updated when x and f are defined. Shouldn't they be considered and
global variable and functions only? Why does it make sense to set
locals() as well? Thanks.
$ cat ./main.py
#!/usr/bin/env python
# vim: set noexpandtab tabstop=
Hi, I see the following two lines are the same. But I'd like to find
where ^ is documented via the help() function (I am not looking for
the document in html)? Does anybody know? Thanks.
s.symmetric_difference(t)
s ^ t
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-list
Hi,
R has the function edit() which allows the editing of the definition
of a function. Does python have something similar so that users can
edit python functions on the fly? Thanks.
https://www.rdocumentation.org/packages/utils/versions/3.4.3/topics/edit
--
Regards,
Peng
--
https://mail.pytho
Hi,
I would like to extract "a...@efg.hij.xyz". But it only shows ".hij".
Does anybody see what is wrong with it? Thanks.
$ cat main.py
#!/usr/bin/env python
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:
import re
email_regex = re.compile('[a-zA-Z0-9_.+-]+@[a-z
Hi, perl has __END__ which ignore all the lines below it.
Is there anything similar to __END__ in python? Thanks.
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-list
Where is `?reload=true` from? How to just get the redict URL that one
would get from the browser? Thanks.
> 'http://ieeexplore.ieee.org:80/document/771073/?reload=true'
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-list
Hi,
Does anybody know how only get the redirected URL but not the actual content?
I guess the request module probably should be used. But I am not sure
how to do it exactly.
Can somebody show me the best way to request
(https://doi.org/10.1109/5.771073) and get the URL
(http://ieeexplore.ieee.or
Hi, R has the functions head() and str() to show the brief content of
an object. Is there something similar in python for this purpose?
For example, I want to inspect the content of the variable "train".
What is the best way to do so? Thanks.
$ cat demo.py
from __future__ import division, print_f
Hi,
I got the following error when I try to eval the following code with
def. Does anybody know what is the correct way to evaluation python
code that contains `def`? Thanks.
$ cat ./main.py
#!/usr/bin/env python
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:
im
Hi, peekable from more-itertools only allow peeking an iterator. But
sometimes, one may want to take a look at an element, manipulate it,
then put it back to the iterator. Is there a class in python that can
help do this?
https://pypi.python.org/pypi/more-itertools/
--
Regards,
Peng
--
https://
On Tue, Sep 27, 2016 at 10:01 AM, Chris Angelico wrote:
> On Wed, Sep 28, 2016 at 12:01 AM, Peng Yu wrote:
>> Hi, In many other functional language, one can change the closure of a
>> function. Is it possible in python?
>>
>> http://ynniv.com/blog/2007/08/closures-in-
Hi, In many other functional language, one can change the closure of a
function. Is it possible in python?
http://ynniv.com/blog/2007/08/closures-in-python.html
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Sep 22, 2016 at 8:35 PM, Ben Finney wrote:
> Peng Yu writes:
>
>> On Wed, Sep 21, 2016 at 11:14 PM, Ben Finney
>> wrote:
>> > [Importing ‘*’ from a module] will also make the names in the code
>> > impossible to automatically match against where the
On Wed, Sep 21, 2016 at 11:14 PM, Ben Finney wrote:
> Peng Yu writes:
>
>> I want to import all the thing (or the ones available in the
>> respective __all__) defined in each of the file by putting the
>> following lines in __init__.py
>>
>> from file1 i
Hi, I want know where import is defined in the source code. Is it
implemented using __import__?
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-list
Hi,
Suppose that I have file1.py, ..., filen.py in a module directory.
I want to import all the thing (or the ones available in the
respective __all__) defined in each of the file by putting the
following lines in __init__.py
from file1 import *
from filen import *
However, I don't want to
On Sunday, September 18, 2016, Ned Batchelder wrote:
> On Saturday, September 17, 2016 at 11:09:04 PM UTC-4, Peng Yu wrote:
> > The manual says the following.
> >
> > "The trace function is invoked (with event set to 'call') whenever a
> > new local scop
./main.py Schöön
$ ./main.sh
Schoon
>> 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.
>
>
somehow settrace in one line and expect to
get the trace function being called in the next line.
So something like `set -v` in bash sounds not possible. Is it so?
On Sat, Sep 17, 2016 at 5:28 PM, Ned Batchelder wrote:
> On Saturday, September 17, 2016 at 4:41:32 PM UTC-4, Peng Yu wrote:
>
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
&g
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
--
> 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
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
OK. But it is documented somewhere in python doc?
On Fri, Sep 16, 2016 at 9:48 PM, Lawrence D’Oliveiro
wrote:
> On Saturday, September 17, 2016 at 2:05:49 PM UTC+12, Peng Yu wrote:
>> x, y = y, x
>
> It’s just syntactic sugar for
>
> (x, y) = (y, x)
> --
> http
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?
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-list
ew__ =
| T.__new__(S, ...) -> a new object with type S, a subtype of T
On Fri, Sep 16, 2016 at 9:13 PM, MRAB wrote:
> On 2016-09-17 03:05, Peng Yu wrote:
>>
>> Hi,
>>
>> I'm wondering where is the documentation for ',' as in the following
>&
Hi,
I'm wondering where is the documentation for ',' as in the following usage.
x = 1
y = 2
x, y = y, x
I tried help(','). But there are too many ',' in it and I don't see in
which section ',' is documented. Could anybody let me know? Thanks.
--
Regards,
Peng
--
https://mail.python.org/mailma
Hi, See the following example, I am not able to get the source code of
the actual function that does the calculation of partial_ratio. Does
anybody know what is the correct way of getting the source?
/tmp$ ./main.py
@functools.wraps(func)
def decorator(*args, **kwargs):
if args[0]
Hi, The following code shows that "Michał" is printed differently for
print(yaml.safe_dump(...)) and the direct print. Does anybody know how
to use yaml.safe_dump() so that "Michał" will be printed as is.
~$ cat main.py
#!/usr/bin/env python
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabsto
Hi,
I get the following error when I try to install pip. Does anybody know
what it is wrong and how to fix it? Thanks.
~/Downloads$ pip install dtrx
Downloading/unpacking dtrx
Could not find any downloads that satisfy the requirement dtrx
Some externally hosted files were ignored (use --allow
Hi,
I am trying to understand what does encode() do. What are the hex
representations of "u" in main.py? Why there is UnicodeEncodeError
when main.py is piped to xxd? Why there is no such error when it is
not piped? Thanks.
~$ cat main.py
#!/usr/bin/env python
u = unichr(40960) + u'abcd' + unich
On Tue, Apr 23, 2013 at 5:40 PM, R. Michael Weylandt
wrote:
> On Tue, Apr 23, 2013 at 6:36 PM, Peng Yu wrote:
>> Hi,
>>
>> I'm wondering if it possible to use pandoc instead of rst to document
>> python. Is there a documentation system support this format of py
Hi,
I'm wondering if it possible to use pandoc instead of rst to document
python. Is there a documentation system support this format of python
document?
--
Regards,
Peng
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
By default, setup.py will install everything in the source directory.
I want mask some directories so that they will not be installed. Is
there a way to do so in setup.py?
--
Regards,
Peng
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I don't quite understand how -m option is used. And it is difficult to
search for -m in google. Could anybody provide me with an example on
how to use this option? Thanks!
-m module-name
Searches sys.path for the named module and runs the
corresponding .py file as a scrip
On Sun, Mar 17, 2013 at 1:23 AM, Mark Shroyer wrote:
> I realize this isn't yet precisely what you're asking for, but look at the
> inspect and ast modules:
>
> import ast, inspect
>
> def indent_level():
> lineno = inspect.currentframe().f_back.f_lineno
>
> with open(__fi
On Mon, Mar 18, 2013 at 1:54 AM, Steven D'Aprano
wrote:
> On Sun, 17 Mar 2013 22:56:07 -0500, Peng Yu wrote:
>
>> Hi,
>>
>> man python says "If a script argument is given, the directory
>> containing the script is inserted in the path in front o
Hi,
man python says "If a script argument is given, the directory
containing the script is inserted in the path in front of $PYTHONPATH.
The search path can be manipulated from within a Python program as
the variable sys.path." Instead I want to have the current directory
inserted to the fron
Hi,
pprint can not print defaultdict one record per line. Is there some
other convenient way in python to print one record per line?
~/linux/test/python/man/library/pprint/function/pprint$ ./main.py
{'two': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], 'one': [0,
1, 2, 3, 4, 5, 6, 7, 8, 9]}
Hi,
I want to get the indent level within the code. For example, I want to
print 1 within the while loop as the line is indented 1 level. Is it
possible to get it within python?
while 1:
#print the level of indent, which is 1 here.
--
Regards,
Peng
--
http://mail.python.org/mailman/listinfo
Hi,
I'm not able to find the documentation on what locale is used for
sorted() when the 'cmp' argument is not specified. Could anybody let
me what the default is? If I always want LC_ALL=C, do I need to
explicitly set the locale? Or it is the default?
Regards,
Peng
--
http://mail.python.org/mail
Hi,
The empty() returns True even after put() has been called. Why it is
empty when there some items in it? Could anybody help me understand
it? Thanks!
~/linux/test/python/man/library/multiprocessing/Queue/empty$ cat
main.py
#!/usr/bin/env python
import multiprocessing
queue = multiprocessing.
> Try with just --trace?
>
>
> C:\ramit>python.exe -m trace test.py
> C:\ramit\Python27\lib\trace.py: must specify one of --trace, --count,
> --report, --listfuncs, or --trackcalls
>
> C:\ramit>python -m trace --trace test.py
> --- modulename: test, funcname:
> test.py(2): def f():
> test.py(5):
> Is this what you want?
> http://docs.python.org/2/library/trace.html
I'm not able to get the mixing of the python command screen output on
stdout. Is there a combination of options for this purpose?
~/linux/test/python/man/library/trace$ cat main1.py
#!/usr/bin/env python
def f():
print "Hel
Hi,
In bash, set -v will print the command executed. For example, the
following screen output shows that the "echo" command is printed
automatically. Is there a similar thing in python?
~/linux/test/bash/man/builtin/set/-v$ cat main.sh
#!/usr/bin/env bash
set -v
echo "Hello World!"
~/linux/test/
Hi,
reference.pdf from python document has the following description. It
is not accessible from help() in the command line. Is there an
alternative so that I can quickly access these class attributes or
method names from the command line?
object.__call__(self [, args... ])
Called when the instanc
Hi,
I installed Python using python-2.7.3-macosx10.6.dmg on my Mac OS
10.8.2.
When try to use pip to install packages, I get the following message.
Then the installation fails.
gcc-4.2 not found, using clang instead
I then create a link from /usr/bin/gcc to gcc-4.2. Then I run pip
again, I get
Hi,
In [2]: sum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1])
Out[2]: 0.
In ipython, I got the above output. But I got a different output from
"print". Is there a way to print exact what I saw in ipython?
~/linux/test/python/man/library/math/fsum$ cat main.py
#!/usr/bin/env python
pr
> Documentation that takes ten pages to say something is just as bad as
> documentation that leaves stuff out, because it's almost guaranteed
> that it won't be read.
That's the point. If a simple example (6 lines) can demonstrate the
concept, why spending "ten pages" to explain it. My experience
Hi Terry,
Thank you for you detailed email.
> If two collections are equal, should the iteration order be the same? It has
> always been true that if hash values collide, insertion order matters.
> However, a good hash function avoids hash collisions as much as possible in
> practical use cases.
On Fri, May 4, 2012 at 6:12 PM, Cameron Simpson wrote:
> On 04May2012 15:08, Peng Yu wrote:
> | On Fri, May 4, 2012 at 12:43 PM, Terry Reedy wrote:
> | > On 5/4/2012 8:00 AM, Peng Yu wrote:
> | >> On Fri, May 4, 2012 at 6:21 AM, Chris Angelico wrote:
> | >>&g
On Fri, May 4, 2012 at 12:43 PM, Terry Reedy wrote:
> On 5/4/2012 8:00 AM, Peng Yu wrote:
>>
>> On Fri, May 4, 2012 at 6:21 AM, Chris Angelico wrote:
>>>
>>> On Fri, May 4, 2012 at 8:14 PM, Peng Yu wrote:
>>>>
>>>> Thanks. This is what I
On Fri, May 4, 2012 at 6:21 AM, Chris Angelico wrote:
> On Fri, May 4, 2012 at 8:14 PM, Peng Yu wrote:
>> Thanks. This is what I'm looking for. I think that this should be
>> added to the python document as a manifestation (but nonnormalized) of
>> what "A set ob
On Thu, May 3, 2012 at 11:16 PM, Terry Reedy wrote:
> On 5/3/2012 8:36 PM, Peng Yu wrote:
>>
>> Hi,
>>
>> list(a_set)
>>
>> When convert two sets with the same elements to two lists, are the
>> lists always going to be the same (i.e., the elements
Hi,
list(a_set)
When convert two sets with the same elements to two lists, are the
lists always going to be the same (i.e., the elements in each list are
ordered the same)? Is it documented anywhere?
--
Regards,
Peng
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
The following example demonstrates the variable 'v' used in the list
comprehension is accessible out site the list comprehension.
I think that 'v' should be strictly local. Does anybody know where
this behavior is documented and why it is designed this way?
~/linux/test/python/man/library/__
On Apr 11, 10:25 am, John Gordon wrote:
> In <2900f481-fbe9-4da3-a7ca-5485d1ceb...@m13g2000yqc.googlegroups.com> Peng
> Yu writes:
>
> > It is confusing to me what the best workflow is for python module
> > development. There is setup.py, egg. Also, pip, easy_install
Hi,
It is confusing to me what the best workflow is for python module
development. There is setup.py, egg. Also, pip, easy_install.
Could any expert suggest an authoritative and complete guide for
developing python modules? Thanks!
Regards,
Peng
--
http://mail.python.org/mailman/listinfo/python
Hi,
The following code doesn't give me error, even I don't specify the
value of filename from the command line arguments. filename gets
'None'. I checked the manual, but I don't see a way to let
OptionParser fail if an argument's value (which has no default
explicitly specified) is not specified.
Hi,
The following attributes does not include the class name. Is there a
way to add class name to the format string? Thanks!
http://docs.python.org/library/logging.html#logrecord-attributes
--
Regards,
Peng
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Suppose that I have strings like the following
test(a b)a b
test(xy uv)xy uv
...
I want to change them to
test(a)a test(b)b
test(xy)xy test(uv)uv
...
The problem is that I don't know how to capture pattern that repeat
itself (like 'a' and 'xy' in the example). I could use 'test\((\w+)
(\w
I know the library reference webpage for re.MatchObject is at
http://docs.python.org/library/re.html#re.MatchObject
But I don't find such a help page in python help(). Does anybody know
how to get it in help()?
>>> help(re.MatchObject)
Traceback (most recent call last):
File "", line 1, in
Att
Hi,
R_HOME is set in my shell (bash). But os.environ doesn't have it. I'm
not sure what it does when os module is imported. But it seems that
os.environ doesn't capture all the environment variable from the
shell. Could anybody let me know what is the correct way to inherent
all the environment va
This webpage http://www.python.org/dev/peps/pep-0008/ recommends the
following. It looks to me that both styles are fine. Could anybody let
me know what the rationale is behind this recommendation?
- Use spaces around arithmetic operators:
Yes:
i = i + 1
submitted +
Hi
I'm still kind of confused about the terminology on classes in python.
Could you please let me know what the equivalent terms for the
following C++ terms?
constructor
destructor
member function
member variable
virtual member function
function
I think that C++ "function" is equivalent to pyth
My Python is installed in the following location.
~/utility/linux/opt/Python-2.6.5/
I then installed SCons (http://www.scons.org/) using the command
"python setup.py install", which install it at
~/utility/linux/opt/Python-2.6.5/lib/scons-2.0.0.final.0
sys.path doesn't have the above directory. I
On Fri, Jul 16, 2010 at 5:42 PM, Terry Reedy wrote:
> On 7/16/2010 1:01 PM, Peng Yu wrote:
>>
>> I mean to get the man page for '[' like in the following code.
>>
>> x=[1,2,3]
>
> You might find my Python symbol glossary useful.
> https://
On Fri, Jul 16, 2010 at 3:10 PM, MRAB wrote:
> Peng Yu wrote:
>>
>> Hi,
>>
>> I see that there are help topics that are capitalized, which I think
>> in general are related with languages syntax. I want to see the
>> complete list of such help topics. Would
Hi,
I see that there are help topics that are capitalized, which I think
in general are related with languages syntax. I want to see the
complete list of such help topics. Would you please let me know if
there is a command to do so?
>>> help('SUBSCRIPTS')
Related help topics: SEQUENCEMETHODS1
>
I mean to get the man page for '[' like in the following code.
x=[1,2,3]
But help('[') doesn't seem to give the above usage.
###
Mutable Sequence Types
**
List objects support additional operations that allow in-place
modification of the object. Other mutable sequen
http://psyco.sourceforge.net/
The above package can improve python program on 32 bit library. But I
need to run on 64 bit library. Is there any other module that can help
improving the performance of python on 64 bit?
--
Regards,
Peng
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Jun 22, 2010 at 12:13 PM, Stephen Hansen
wrote:
> On 6/22/10 9:44 AM, Peng Yu wrote:
>> Also, always importing the inspect module and getting the frame and
>> accessing the lineno from the frame is not very convenient to type. Is
>> there a shorter way to access
I want to print filename and line number for debugging purpose. So far
I only find how to print the line number but not how to print
filename.
import inspect
print inspect.currentframe().f_lineno
I found inspect.getsourcefile(), but I have to supply a class name to
it. I have searched online, but
Hi,
It seems I don't completely understand how getsource works, as I
expect that I should get the source code of class A. But I don't.
Would you please let me know what I am wrong?
$ cat main.py
#!/usr/bin/env python
import inspect
class A:
pass
a=A()
print inspect.getsource(a)
$ ./main.py
Hi,
'open' is not a function according to inspect module. But according to
help(open), it is a function. Is there something wrong with inspect
module?
$ cat main.py
#!/usr/bin/env python
import inspect
def hello():
print "Hello World!"
return
print inspect.isfunction(str)
print inspect.isf
pydoc xrange says:
Help on class xrange in module __builtin__:
class xrange(object)
python_2.6.5_library.pdf says:
Objects of type xrange are similar to buffers
Are type and class synonyms? It seems that they are at least according
to some webpages that I read. But I'm not completely sure. Cou
help(help) gives me the following explanation.
##
Help on _Helper in module site object:
class _Helper(__builtin__.object)
| Define the built-in 'help'.
| This is a wrapper around pydoc.help (with a twist).
|
| Methods defined here:
|
| __call__(self, *args, **kwds)
|
I mainly check online python manual. But I feel that it would be nice
if there is command line manual available (just like perl command line
manual). Could you please let me know if such command line manual
available?
--
Regards,
Peng
--
http://mail.python.org/mailman/listinfo/python-list
After starting pdb.set_trace(), python doens't show line number. Could
you let me know how to print the number by default so that I know
where the current line is?
--
Regards,
Peng
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 243 matches
Mail list logo