The reference says:
The truth of x==y does not imply that x!=y is false.
Accordingly, when defining __eq__(), one should also
define __ne__() so that the operators will behave as expected.
(http://docs.python.org/3/reference/datamodel.html#object.__eq__)
But I saw different behavior on 3.3
Thanks a million!
On Fri, Dec 7, 2012 at 3:47 PM, Chris Rebert wrote:
> On Thursday, December 6, 2012, INADA Naoki wrote:
>
>> The reference says:
>>
>> The truth of x==y does not imply that x!=y is false.
>> Accordingly, when defining __eq__(), one should als
I have 4 py files like below. Two __init__.py is empty file.
$ find foo -name "*.py"
foo/lib/lib.py
foo/lib/__init__.py
foo/__init__.py
foo/foo.py
$ cat foo/lib/lib.py
from __future__ import absolute_import
print('lib.py', __name__)
from .. import foo
#import foo.foo
$ cat foo/foo.py
from __futu
I found it is a bug http://bugs.python.org/issue13187
--
http://mail.python.org/mailman/listinfo/python-list
python"
command means Python 3 on Debian and Ubuntu.
Regards,
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
is predefined.
In other words, I strongly prefer comprehension to map+lambda.
Regards,
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
2017/09/13 午前3:04 "Rick Johnson" :
alister wrote:
> [...]
> were i to be less generous I would suggest that you had
> deliberately picked the worst python method you could think
> of to make the point
Feel free to offer a better solution if you like. INADA
Naoki offer
g hard to move Python 3 as default.
Most packages depends on Python 3, not 2.
When installing Ubuntu, there are no "python" command.
Python 3 is installed as default, but Python 2 not.
Regards,
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
s diminished).
> >
> > In my own code I'm obviously quite capable of defining a function p()
> > which does whatever I want in terms of printing etc. But where this bites
> > me the most is in the interactive interpreter. Yes, I'm aware I can add
> > things to site.py etc. etc. My point would still be that I'm working
> around
> > a change which appears to be solving a problem I didn't have!
> >
> > TJG
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
Python is nice REPL and it has parenthee free function call.
I recommend you to use it if you're not happy with builtin REPL.
Regards,
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
k.
You can overwrite `bool`.
def bool(x):
return !x
if 0:
print("not shown")
if bool(0) == True:
print("shown")
But my point is only readability. I don't agree `if bool(x) == True:` is
clear
than `if x:`.
Regards,
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
ut changing language behavior.
> But my point is only readability. I don't agree `if
> > bool(x) == True:` is clear than `if x:`.
>
> You certainly have a right to your opinion. And i do
> appreciate you presenting this argument in a respectful
> manner.
>
> I
ue` doesn't give
> > any information than `if x:`. Both mean just `if x is
> > truthy`. No more information. Redundant code is just a
> > noise.
>
> So what about:
>
> if bool(x):
> # blah
>
>
I don't accept it too. It only explains `if x is truthy value`, and it's
exactly same to `if x:`.
There are no additional information about what this code assumes. bool()
is just noise.
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
typing's primary intention is "static" typing with tools like mypy.
Introspection is not primary usage.
Adding such information for every class, module, etc makes
Python slower and fatter.
But I want to make Python more swift and slim.
INADA Naoki
On Wed, Dec 27, 2017 at
FYI: https://bugs.python.org/issue31558
INADA Naoki
On Mon, Jan 1, 2018 at 12:39 AM, wrote:
> An interesting write up on something that is incorporated into Python 3.7
> https://engineering.instagram.com/copy-on-write-friendly-python-garbage-collection-ad6ed5233ddf
>
> --
>
pty!)
I found uritemplate.py has same issue. Maybe pip's behavior was
changed after migration of uritemplate.py to uritemplate.
Now what can I do for smooth transition?
I don't want to back to msgpack-python again.
[1] https://pypi.python.org/pypi/uritemplate.py
Regards,
INADA
t;Pupun"]
>
> for name in Names:
>for c in name:
>print(c)
>
> instead use:
>
> for c in name in Names:
> print(c)
> --
> https://mail.python.org/mailman/listinfo/python-list
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
nge is "Can we removing all possible reference
cycles?".
Even if you can't agree some examples explained is "practical",
it can be enough reason for we don't go to proposed RAII way.
Regards,
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
https://github.com/Homebrew/homebrew-core/pull/24604
/use/local/bin/python is symlink to python3.
vim is built with python3. You can install it from bottle.
Thanks to Homebrew maintainers!!
--
https://mail.python.org/mailman/listinfo/python-list
xpected, but
> > require IPC and pickable objects in and out.
>
> yes, that became a problem.
>
> So, I revoke my question. Went out to redesign the whole approach.
>
> Thanks for reply!
>
> Axy.
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
for writing to pipe.
And PowerShell uses OutputEncoding for reading from pipe.
If you want to use UTF-8 on PowerShell in Windows,
* Set PYTHONUTF8=1 (Python uses UTF-8 for writing into pipe).
* Set `$OutputEncoding =
[System.Text.Encoding]::GetEncoding('utf-8')` in PowerShell profile.
Rega
On Sat, Nov 12, 2022 at 11:53 AM Inada Naoki wrote:
>
> On Sat, Nov 12, 2022 at 10:21 AM 12Jessicasmith34
> <12jessicasmit...@gmail.com> wrote:
> >
> >
> > Two questions: any idea why this would be happening in this situation?
> > AFAIK, stdout *is* a co
in the
stats).
That is all I can advise.
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
y malloc().
You should try jemalloc. Trying jemalloc is not hard. You don't need
to rebuild Python.
Google " jemalloc LD_PRELOAD".
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
ibilities.
* You set the wrong PYTHONHOME
PYTHONHOME is very rarely useful. It shouldn't be used if you can
not solve this kind of problem.
* Your Python installation is broken.
Some files are deleted or overwritten. You need to *clean* install
Python again.
Bets,
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
only for optimization based on *current* Python internals.
That's why it is not a public API. If we expose it as public API, it
makes harder to change Python's GC internals.
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
has special optimization which tightly coupled with
current CPython implementation.
So you need to use private APIs for MAINTAIN_TRACKING.
But PyObject_GC_Track() is a public API.
Regards,
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
; pip install -U pip
>
> Can't venv have an option for doing this automatically or, better, a
> config file where you can put commands that will be launched every
> time after you create a venv?
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Inada Naoki
ython improvements.
If Python changed its GC to mark-and-sweep, PyObject_GC_IsTracked()
can return true always.
Regards,
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
nsion module will work
well in Python 3.11.
> I would implement it also for a C extension that uses CPython < 3.10.
> How can I achieve this?
See PyModule_GetState() to have per-interpreter module state instead
of static variables.
https://docs.python.org/3/c-api/module.html#c.PyModule_
tly. I also tried it with "O" and it doesn't
> segfault but it returns 0x0.
>
> I'm new to using the C API. Thanks for any help.
>
> Jen
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
Bests,
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
l_EvalCodeWithName ()
> from /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0
>
> My guess is the problem is in Py_BuildValue, which returns a pointer but it
> may not be constructed correctly. I also tried it with "O" and it doesn't
> segfault but it returns 0x0.
>
> I'm new to using the C API. Thanks for any help.
>
> Jen
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
>
> Bests,
>
> --
> Inada Naoki
>
>
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
re.
> Read https://docs.python.org/3/c-api/arg.html#c.Py_BuildValue
>
> The final line segfaults:
> Program received signal SIGSEGV, Segmentation fault.
> 0x76e4e8d5 in _PyEval_EvalCodeWithName ()
> from /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0
>
> My guess is the p
f you are writing Python/C function, return NULL (e.g. `if (pSents ==
NULL) return NULL`)
Then Python show the exception and traceback for you.
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
329
This is complete guide why/when INCREF/DECREF key/value.
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
>
> I did that only for the debug reasons :-)
That's bad for debugging too.
Real Exception and Stacktrace are far better than print('Error')
on all time. Never do it even for debugging.
--
https://mail.python.org/mailman/listinfo/python-list
1 3 3 1
> 1 4 6 4 1
> 1 5 10 10 5 1
> 1 6 15 20 15 6 1
> 1 7 21 35 35 21 7 1
> 1 8 28 56 70 56 28 8 1
> 1 9 36 84 126 126 84 36 9 1
>
> $ pascal2 fail
> 1
> 1 1
> 1 2 1
> 1 3 3 1
> 1 4 4 4 1
> 1 5 10 10 5 1
> 1 6 12 12 12 6 1
> 1 7 21 21 21 21 7 1
> 1
> How do I fix this?
Maybe:
$ brew uninstall python3
$ brew install python3
--
https://mail.python.org/mailman/listinfo/python-list
Pillow 3.4.2 provides binary wheel for Python 3.5, but not for 3.6.
So your pip can just install wheel on Python 3.5, but it is required to build
on Python 3.6. And your machine doesn't have zlib which is required
to build Pillow.
Easiest solution may just update your requirements to Pillow==4.0
Hi, Chris.
They are "builtin" module.
python executable contains the modules already.
But I don't know it's safe to remove them from setup.py.
There are so many platforms and special build of Python.
$ ./python
Python 3.7.0a0 (default:9f7d16266928, Jan 18 2017, 23:59:22)
[GCC 6.2.0 20161005] on
It's fixed already in Python 3.
Please use Python 3 when teaching to students.
$ python3
Python 3.6.0 (default, Dec 24 2016, 00:01:50)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> True = "foo"
File
/mail.priorweb.be/!ENTRY-tbz'
> rest = None
> self =
>
> Frame ntransfercmd in /usr/lib/python2.7/ftplib.py at line 352
> cmd = 'STOR
> home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be/!ENTRY-tbz'
>
FYI, they reverted python->python3 symlink. python command is now
Python 2 again.
https://discourse.brew.sh/t/python-and-pep-394/1813
Even though this revert, it is significant step:
* many formulas dropped `depends_on "python"`. Python 2 was installed
often by dependency before
but it's rare
> expected = {"foo", "bar", "spam"}
> missing = expected - set(json.keys())
>
dict.keys() returns set-like object.
So `missing = expected - json.keys()` works fine, and it's more efficient.
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
I agree with you.
Async IO is more efficient than threading for **waiting** I/O.
When there are thousands of idle connections, async I/O is best idea.
On the other hand, async I/O uses more system calls for busy I/O.
For example, when building chat application which handles thousands
WebSocket c
quot;, line 390, in __init__
> errread, errwrite)
> File "/usr/lib/python2.7/subprocess.py", line 917, in _execute_child
> self.pid = os.fork()
> OSError: [Errno 11] Resource temporarily unavailable
>
>
> anything hit similar issue?
> --
> https://mail.python.org/mailman/listinfo/python-list
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, May 6, 2018 at 1:22 AM joseph pareti wrote:
> thanks for the hint, virtualenv looks like an interesting option, however
> in my case I need to rely on several components that are already installed
> in the VM in Azure, including tensorflow, etc.
> If I use virtualenv, do I need to start
7;t it's reasonable.
You can use multiprocessing.ThreadPool instead.
> Another option might be making `as_completed` work with map results too
> (which was my original intention).
I don't like this idea.
Regards,
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
, what is the difference between the two error
> messages?
2nd error will happen when internal hash table is rebuilt while iterating.
If you read C source code, you can expect when it happens.
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
>
> So working backwards, I have solved the first problem. I am no nearer to
> figuring out why it fails intermittently in my live program. The message
> from INADA Naoki suggests that it could be inherent in CPython, but I am
not
> ready to accept that as an answer yet. I will kee
bited, and behavior is
**undefined**.
There are no "what should happen".
Python interpreters may or may not raise error. And any error
(RuntimeError,
MemoryError, interpreter freeze) may happen.
Python programmer shouldn't rely on the behavior.
Regards,
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
> 1st is this script is from a library module online open source
If it's open source, why didn't you show the link to the soruce?
I assume your code is this:
https://github.com/siddharth2010/String-Search/blob/6770c7a1e811a5d812e7f9f7c5c83a12e5b28877/createIndex.py
And self.collFile is opened h
tion.
>
> How do I do a thread-safe insertion if, and only if, the key isn't
> already there?
>
>
>
> Thanks in advance,
>
>
>
> --
> Steven D'Aprano
> "Ever since I learned about confirmation bias, I've been seeing
> it everywhere." -- Jon Ronson
>
> --
> https://mail.python.org/mailman/listinfo/python-list
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
y default is better
than explicit 'surrogateescape' error handler" like Go?
(It's 2010s languages with UTF-8 based string too, but accept invalid
UTF-8).
Regards,
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
ng explicitly and string is not byte-transparent; C#, Java, ECMAScript,
(including families like TypeScript), Rust, Swift, Julia, and more.
I can't agree that it's cult-like behavior. I think it's practical
design decision.
Regards,
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
"Cult-like behavior" in mail subject was misleading
when discussing about byte-transparent string vs unicode string.
Such powerful words may make people more defensive, and
heat non productive discussion.
(I know it's not you start using "cult-like behavior" in subject.
I don
>
> Your particular question is itself a FAQ
> https://docs.python.org/3/faq/design.html#why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list>.
>
Please don't refer the FAQ entry.
See this: https://bugs.python.org/issue27
Please use Python 3.7.
Python 3.7 has several improvements on this area.
* When PEP 538 or 540 is used, default error handler for stdio is
surrogateescape
* You can sys.stdout.reconfigure(errors='surrogateescape')
For Python 3.6, I think best way to allow arbitrary bytes on stdout is using
`PYTH
iso-8859-1 but with no
> results.
>
> I have stored database records successfully in greek via CMD, but when i
> try to do the opposite in CMD again via ORM i get strange characters. Any
> kind of help?
>
>
> Regards
> Kostas Asimakopoulos
> --
> https://mail.pyth
#x27;t.
>
> Is anyone able to demonstrate a replicable performance impact due to
> garbage
> collection?
>
>
>
> --
> Steven
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
uot;python setup.py egg_info" failed with error code 1 in
> /tmp/pip-build-rrhl9079/MySQL-python/
> (env) ubuntu@ip-172-31-56-59:~/clearapp$
> --
> https://mail.python.org/mailman/listinfo/python-list
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
2^64, that's
> what I don't understand.
>
> Does anyone have some ideas of it?
>
>
> The versions of the components I used:
>
> Python: 2.7.6
> MySQL 5.7.11
> MySQLdb 1.2.5
>
>
> Thanks
> --
> https://mail.python.org/mailman/listinfo/python-list
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
Thank you for a very informative report.
> PS. This is my first post to this list - please let me know if I
> should send to another forum instead.
Would you send this report to the issue tracker?
https://bugs.python.org/
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/
The DeprecationWarning is raised for virtualenv's distutils.
It is fixed already. Use latest virtualenv.
Links:
https://github.com/pypa/virtualenv/pull/1289
https://virtualenv.pypa.io/en/latest/changes/#v16-4-0-2019-02-09
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
.
Install latest virtualenv in virtualenv *created by* old virtualenv is
not enough.
On Wed, Apr 3, 2019 at 11:35 AM אורי wrote:
>
>
> אורי
> u...@speedy.net
>
>
> On Wed, Apr 3, 2019 at 2:50 AM Inada Naoki wrote:
>>
>> The DeprecationWarning is raised for virtu
ory in your project!)
So abusing namespace package will bite you at some point.
Regards,
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
I plan to remove int support in Python 3.10.
If this warning is ignored, the extension module will be broken silently
from 3.10.
It is because C is not typesafe here.
Regards,
2019年5月22日(水) 0:56 Robin Becker :
> Marius Gedminas has kindly been doing some work with reportlab and python
> 3.8a1
flag in _testembed.o
> _test_preinit_isolated1 in _testembed.o
> _test_preinit_isolated2 in _testembed.o
> _test_preinit_parse_argv in _testembed.o
> ...
> "__Py_InitializeMain", referenced from:
> _test_init_main in _testembed.o
> "__Py_PreInitialize", referenced from:
> _test_init_from_config in _testembed.o
> _test_init_dont_configure_locale in _testembed.o
> _test_preinit_isolated1 in _testembed.o
> _test_preinit_isolated2 in _testembed.o
> _check_preinit_isolated_config in _testembed.o
> _check_init_python_config in _testembed.o
> "__Py_PreInitializeFromWideArgs", referenced from:
> _test_preinit_dont_parse_argv in _testembed.o
> "__Py_RunMain", referenced from:
> _test_init_run_main in _testembed.o
> _test_init_main in _testembed.o
> _test_run_main in _testembed.o
> ld: symbol(s) not found for architecture x86_64
> clangclang: : errorerror: : linker command failed with exit code 1
> (use -v to see invocation)linker command failed with exit code 1 (use
> -v to see invocation)
>
> make: *** [Programs/_testembed] Error 1
> make: *** Waiting for unfinished jobs
> make: *** [python.exe] Error 1
>
> I tried run *make distclean* and reset my terminal but still not working.
> Thank you for helping.
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
o why we have functions with the same name and args?
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
/_io/bufferedio.c#L1910>
> had
> been called twice which I expected only once. The second time it changed
> self->pos to an unexpected value too.
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
Why do you use RHEL?
I believe people use RHEL to get support from Red Hat, instead of community
support.
2019年8月13日(火) 22:32 Larry Martell :
> I am trying to install MySQLdb (https://pypi.org/project/mysqlclient/)
> for python3.6 on RHEL7.
>
> When I import it, it fails:
>
> # python3.6
> Pytho
y. You need to
report about it, at least:
* How did you installed C mysql client library.
* The output of the `mysql_config`
* The output of the `ldd
/usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so`
Regards,
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
t;
> conn = pymysql.connect( host='localhost', user='user', password='pass',
> db='counters' )
> cur = conn.cursor()
>
> Then i execute insert and update sql statements but i never close the
> connection. I presume python closes the connection when the script ends.
> Doesn't it?
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
2019年10月3日(木) 0:56 Νίκος Βέργος :
> Τη Τετάρτη, 2 Οκτωβρίου 2019 - 8:26:38 π.μ. UTC+3, ο χρήστης Inada Naoki
> έγραψε:
> > MySQL connection can be closed automatically by various reasons.
> > For example, `wait_timeout` is the most common but not only reason for
> >
| because we have much more sophisticated
> > | | | h...@hjp.at | management tools.
> > __/ | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>
>
> you're right, the log file came from Windows and was encoded in iso-8859-1,
> but my question was about the difference in result between reading a file and
> reading from stdin.
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
wn environment.
Regards,
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
Memory usage: 3441451008
> ---
>
> Notice that memory usage increases noticeably specially on files 4 and
> 5, the biggest ones, and doesn't come down as I would expect it to. But
> the loading time is constant, so I think I can disregard any pickle
> caching mechanisms.
>
> So I guess now my question is: can anyone give me any pointers as to why
> is this happening? Any help is appreciated.
>
> Thanks,
>
> --
> José María (Chema) Mateos || https://rinzewind.org/
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
. Re: Ram memory not freed after executing python script on
> > ubuntu system (Rahul Gupta)
> >9. Re: Ram memory not freed after executing python script on
> > ubuntu system (Chris Angelico)
> > 10. Re: Behaviour of os.path.join (BlindAnagram)
> > 11. Constructing mime image attachment (Joseph L. Casale)
> > 12. Re: Behaviour of os.path.join (Eryk Sun)
> > 13. Re: Behaviour of os.path.join (Eryk Sun)
> > 14. Re: Behaviour of os.path.join (BlindAnagram)
> > 15. Re: Behaviour of os.path.join (Eryk Sun)
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
;s not needed for an
> immutable one. frozendict could create lazily an object that contains
> all its keys and cache it.
I don't think so. The view objects are useful when we need a set-like
operation. (e.g. `assert d.keys() == {"spam", "egg"}`)
There is no difference between mutable and immutable dicts.
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Jul 16, 2020 at 2:32 AM Marco Sulla
wrote:
>
> On Wed, 15 Jul 2020 at 08:07, Inada Naoki wrote:
> > I don't think so. The view objects are useful when we need a set-like
> > operation. (e.g. `assert d.keys() == {"spam", "egg"}`)
>
> Yes
On Fri, Jul 17, 2020 at 2:16 AM Marco Sulla
wrote:
>
> On Thu, 16 Jul 2020 at 06:11, Inada Naoki wrote:
> > On Thu, Jul 16, 2020 at 2:32 AM Marco Sulla
> > wrote:
> > > Yes, but, instead of creating a view, you can create and cache the
> > > pointer of a &qu
uses PyDictObject for kwargs. Since dicts are
> mutable, it's a problem to cache them properly.
>
On caller side, Python doesn't use dict at all.
On callee side, dict is used for `**kwargs`. But changing it to frozendict is
backward incompatible change.
> On Fri, 17 Jul 2020 a
On Sun, Jul 19, 2020 at 6:38 AM Marco Sulla
wrote:
>
> On Sat, 18 Jul 2020 at 10:02, Inada Naoki wrote:
>>
>> On Sat, Jul 18, 2020 at 7:05 AM Marco Sulla
>> wrote:
>> > For what I know, CPython uses PyDictObject for kwargs. Since dicts are
>> > muta
find use case that you can
share many keys.
In general, combined dict is little faster and much efficient.
--
Inada Naoki
--
https://mail.python.org/mailman/listinfo/python-list
les Stross, 2010-05-09 |
> Ben Finney
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
en the BDFL has warned that Python4 cannot introduce as
> many backwards incompatible changes as python3. So obviously,
> he is admitting that Python3 was a disaster.
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
Have you tried socket.makefile() method?
--
https://mail.python.org/mailman/listinfo/python-list
tracemalloc module may help you to investigate leaks.
2016/02/14 午後4:05 "Paulo da Silva" :
> I was unable to reproduce the situation using a simple program just
> walking through all files>4K, with or without the seek, and computing
> their shasums.
> Only some fluctuations of about 500MB in memor
aside from the change to integer division, most of the
> changes won't benefit small-to-medium scripts either. The biggest
> advantage (Unicode by default) really only shows itself by sparing you
> hassles later on - it's not going to make your life easier in the
> short term, ergo it's not going to make the language easier to learn.
> Py3 isn't so much easier as _better_. There are specific situations
> where it's massively better, but for the most part, they're about on
> par.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
>
>
> Does it mean that asyncmongo does not work with Python 3?
>
>
Yes.
I recommend you to use motor [1].
* [1] https://github.com/mongodb/motor
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
>
>
> class C:
> def method(self):
> if (result is None
> or self.some_condition()
> or len(some_sequence) > 100
> or some_other_condition
> or page_count < 5
> ):
> do_processing()
>
>
> Looks fine
>
>
> Indeed. I don't understand why, when splitting a condition such as this,
> people tend to put the operator at the end of each line.
>
>
Because PEP8 says:
> The preferred place to break around a binary operator is after the
operator, not before it.
http://pep8.org/#maximum-line-length
--
ht
saves Python memory
consumption (and
MySQL server can't release some resource until client fetches all rows.)
To use SScursor:
cur = db.cursor()
>
cur = db.cursor(MySQLdb.cursors.SSCursor)
for row in cur.fetchall():
>
for row in cur:
--
INADA Naoki
--
https://mail.py
On Fri, Mar 11, 2016 at 8:48 AM, Fillmore
wrote:
> On 3/10/2016 5:16 PM, Ian Kelly wrote:
>
>>
>> Interesting, both of these are probably worth bringing up as issues on
>> the bugs.python.org tracker. I'm not sure that the behavior should be
>> changed (if we get an error, we shouldn't just swall
>
>
> For those curious, here's left-pad in all its glory:
>
> module.exports = leftpad;
> function leftpad (str, len, ch) {
> str = String(str);
> var i = -1;
> if (!ch && ch !== 0) ch = ' ';
> len = len - str.length;
> while (++i < len) {
> str = ch + str;
> }
> return str;
> }
Tips: Since True == 1, sum() can count Trues.
>>> def count_even(seq):
... return sum(i%2 == 0 for i in seq)
>>> count_even(range(100))
50
--
https://mail.python.org/mailman/listinfo/python-list
etting the following error
> File "/usr/lib64/python2.6/subprocess.py", line 589, in __init__
> raise TypeError("bufsize must be an integer")
> TypeError: bufsize must be an integer
>
>
> Can you tell me why and whats the sol?
> --
> https://mail.python.org/mailman/listinfo/python-list
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
gt;
The first argument is list of string only when `shell=False` (default).
When `shell=True`, you should one string as the argument.
--
INADA Naoki
--
https://mail.python.org/mailman/listinfo/python-list
PyPI parses your README strictly.
$ rst2html.py --strict README.rst
README.rst:700: (INFO/1) Duplicate implicit target name: "fingerprint".
Exiting due to level-1 (INFO) system message.
But I don't know how to avoid this error when converting from markdown.
On Mon, Mar 2, 2015 at 6:35 PM Leonard
nd at this time.
>
> http://bugs.python.org/issue23476
>
>
> Pickle:
>
> As I just posted recently, CPickle on Python 3.4 seems to
> have a memory corruption bug. Pure-Python Pickle is fine.
> So a workaround is possible. Bug report submitted.
>
> http://bugs.py
1 - 100 of 145 matches
Mail list logo