Re: Printing UTF-8 mail to terminal

2024-11-02 Thread Inada Naoki via Python-list
Try PYTHONUTF8=1 envver. 2024年11月2日(土) 0:36 Loris Bennett via Python-list : > Left Right writes: > > > There's quite a lot of misuse of terminology around terminal / console > > / shell. Please, correct me if I'm wrong, but it looks like you are > > printing that on MS Windows, right? MS Windo

Re: from __future__ import annotations bug?

2023-06-30 Thread Inada Naoki via Python-list
> but does this mean that even with PEP 649 that forward references will > still be needed? Yes. Both of PEP 563 and PEP 649 solves not all forward reference issues. -- Inada Naoki -- https://mail.python.org/mailman/listinfo/python-list

Re: Bug in io.TextIOWrapper?

2023-06-19 Thread Inada Naoki via Python-list
I checked TextIOWrapper source code and confirmed that it doesn't call encoder.write(text, finish=True) on close. Since TextIOWrapper allows random access, it is difficult to call it automatically. So please think it as just limitation rather than bug. Please use codec and binary file manually for

Re: Bug in io.TextIOWrapper?

2023-06-19 Thread Inada Naoki via Python-list
You can use file instead of BytesIO 2023年6月20日(火) 3:05 Peter J. Holzer via Python-list : > On 2023-06-20 02:15:00 +0900, Inada Naoki via Python-list wrote: > > stream.flush() doesn't mean final output. > > Try stream.close() > > After close() the value isn't availa

Re: Bug in io.TextIOWrapper?

2023-06-19 Thread Inada Naoki via Python-list
stream.flush() doesn't mean final output. Try stream.close() 2023年6月20日(火) 1:40 Jon Ribbens via Python-list : > io.TextIOWrapper() wraps a binary stream so you can write text to it. > It takes an 'encoding' parameter, which it uses to look up the codec > in the codecs registry, and then it uses t

Re: Compiling python on windows with vs

2023-06-15 Thread Inada Naoki via Python-list
doesn't support building on case sensitive directory. But I think it is a nice improvement if next Python supports it. Regards, -- Inada Naoki -- https://mail.python.org/mailman/listinfo/python-list

Re: Compiling python on windows with vs

2023-06-13 Thread Inada Naoki via Python-list
es\_io\_iomodule.h" but wont find "..\Modules\..." > > Since Git enables Windows NTFS case sensitivity while checking out > sources ... is it a bug or a "feature"? And: is there a simple > workaround available besides disabling case sensitivity (which will > break others)? > -- > Thomas > > -- > https://mail.python.org/mailman/listinfo/python-list > -- Inada Naoki -- https://mail.python.org/mailman/listinfo/python-list

Re: Strange UnicodeEncodeError in Windows image on Azure DevOps and Github

2022-11-11 Thread Inada Naoki
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

Re: Strange UnicodeEncodeError in Windows image on Azure DevOps and Github

2022-11-11 Thread Inada Naoki
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

Re: Asynchronous execution of synchronous functions

2022-09-26 Thread Inada Naoki
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

Re: Cpython: when to incref before insertdict

2022-03-05 Thread Inada Naoki
329 This is complete guide why/when INCREF/DECREF key/value. -- Inada Naoki -- https://mail.python.org/mailman/listinfo/python-list

Re: C API PyObject_Call segfaults with string

2022-02-09 Thread Inada Naoki
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

Re: C API PyObject_Call segfaults with string

2022-02-09 Thread Inada Naoki
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

Re: C API PyObject_Call segfaults with string

2022-02-09 Thread Inada Naoki
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: C API PyObject_Call segfaults with string

2022-02-09 Thread Inada Naoki
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

Re: How to implement freelists in dict 3.10 for previous versions?

2021-12-29 Thread Inada Naoki
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_

Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

2021-12-28 Thread 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

Re: Option for venv to upgrade pip automatically?

2021-12-28 Thread Inada Naoki
; 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

Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

2021-12-28 Thread Inada Naoki
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

Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

2021-12-27 Thread Inada Naoki
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

Re: Odd locale error that has disappeared on reboot.

2021-12-08 Thread Inada Naoki
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

Re: memory consumption

2021-03-31 Thread Inada Naoki
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

Re: memory consumption

2021-03-30 Thread Inada Naoki
in the stats). That is all I can advise. -- Inada Naoki -- https://mail.python.org/mailman/listinfo/python-list

Re: frozendict: an experiment

2020-07-20 Thread Inada Naoki
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

Re: frozendict: an experiment

2020-07-18 Thread Inada Naoki
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

Re: frozendict: an experiment

2020-07-18 Thread Inada Naoki
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

Re: frozendict: an experiment

2020-07-16 Thread Inada Naoki
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

Re: frozendict: an experiment

2020-07-15 Thread Inada Naoki
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

Re: frozendict: an experiment

2020-07-14 Thread Inada Naoki
;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

Re: Ram memory not freed after executing python script on ubuntu system (rmlibre)

2020-05-28 Thread Inada Naoki
. 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

Re: Pickle caching objects?

2019-12-16 Thread Inada Naoki
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: mysqlclient==1.4.6 none wheel doesn't work on ubuntu 18

2019-12-12 Thread Inada Naoki
wn environment. Regards, -- Inada Naoki -- https://mail.python.org/mailman/listinfo/python-list

Re: fileinput

2019-10-29 Thread Inada Naoki
| 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

Re: pymysql.err.InterfaceError after some hours of usage

2019-10-02 Thread Inada Naoki
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 > >

Re: pymysql.err.InterfaceError after some hours of usage

2019-10-01 Thread Inada Naoki
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

Re: MySQLdb for 3.6 on RHEL7

2019-08-13 Thread Inada Naoki
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

Re: MySQLdb for 3.6 on RHEL7

2019-08-13 Thread Inada Naoki
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

Re: write function call _io_BufferedWriter_write_impl twice?

2019-05-30 Thread Inada Naoki
/_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

Re: Duplicate function in thread_pthread.h

2019-05-27 Thread Inada Naoki
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

Re: CPython compiled failed in macOS

2019-05-21 Thread Inada Naoki
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

Re: Python 3.8 new deprecations

2019-05-21 Thread Inada Naoki
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

Re: Import module from a different subdirectory

2019-05-16 Thread Inada Naoki
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

Re: DeprecationWarning in Python 3.6 and 3.7

2019-04-02 Thread Inada Naoki
. 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

Re: DeprecationWarning in Python 3.6 and 3.7

2019-04-02 Thread Inada Naoki
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

Re: subprocess.Popen(['/sbin/ldconfig', '-p'], stdin=PIPE) itself hangs/deadlocks (Linux)

2018-11-23 Thread INADA Naoki
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/

Re: Non-unicode file names

2018-08-08 Thread INADA Naoki
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

Re: functions vs methods

2018-07-22 Thread INADA Naoki
> > 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

What "cult-like behavior" meant (was: Re: Glyphs and graphemes

2018-07-17 Thread INADA Naoki
"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&#

Re: Glyphs and graphemes [was Re: Cult-like behaviour]

2018-07-17 Thread INADA Naoki
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

Re: Glyphs and graphemes [was Re: Cult-like behaviour]

2018-07-16 Thread INADA Naoki
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

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-06 Thread INADA Naoki
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

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-06-13 Thread INADA Naoki
​> 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

Re: Problem with OrderedDict - progress report

2018-06-01 Thread INADA Naoki
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

Re: Problem with OrderedDict

2018-05-30 Thread INADA Naoki
> > 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

Re: Problem with OrderedDict

2018-05-30 Thread INADA Naoki
, 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

Re: Possible bug in ThreadPoolExecutor, or just misinterpretation

2018-05-27 Thread INADA Naoki
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

Re: ImportError: cannot import name _remove_dead_weakref

2018-05-05 Thread INADA Naoki
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

Re: install MySQL-python failed ....

2018-04-05 Thread INADA Naoki
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

Re: Asynchronous processing is more efficient -- surely not?

2018-04-04 Thread INADA Naoki
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

Re: Keys in dict and keys not in dict

2018-03-19 Thread INADA Naoki
> 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

Re: Homebrew changed default Python to python 3!

2018-03-15 Thread INADA Naoki
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

Re: socket: Did I find a bug?

2018-03-08 Thread INADA Naoki
/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' >

Homebrew changed default Python to python 3!

2018-03-01 Thread INADA Naoki
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

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread INADA Naoki
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

Re: For Loop Dilema [python-list]

2018-02-25 Thread INADA Naoki
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

How to create "transitional" package?

2018-01-08 Thread INADA Naoki
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

Re: Copy-on-write friendly Python garbage collection

2018-01-01 Thread INADA Naoki
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 > > -- >

Re: Default annotations for variables

2017-12-27 Thread INADA Naoki
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

Re: [Tutor] beginning to code

2017-09-19 Thread INADA Naoki
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

Re: [Tutor] beginning to code

2017-09-18 Thread INADA Naoki
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&#

Re: [Tutor] beginning to code

2017-09-17 Thread INADA Naoki
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

Re: Old Man Yells At Cloud

2017-09-17 Thread INADA Naoki
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

Re: Old Man Yells At Cloud

2017-09-17 Thread INADA Naoki
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

Re: The Incredible Growth of Python (stackoverflow.blog)

2017-09-13 Thread INADA Naoki
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

Re: [Tutor] beginning to code

2017-09-12 Thread INADA Naoki
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

Re: [Tutor] beginning to code

2017-09-12 Thread INADA Naoki
is predefined. In other words, I strongly prefer comprehension to map+lambda. Regards, INADA Naoki -- https://mail.python.org/mailman/listinfo/python-list

People choosing Python 3

2017-09-10 Thread INADA Naoki
python" command means Python 3 on Debian and Ubuntu. Regards, INADA Naoki -- https://mail.python.org/mailman/listinfo/python-list

Re: Compiling Python 3.6.1 on macOS 10.12.5

2017-07-10 Thread INADA Naoki
> Killed: 9 It looks like not segmentation fault. Maybe, RAM shortage? INADA Naoki On Mon, Jul 10, 2017 at 10:24 PM, Nigel Palmer wrote: > Hi > > I am trying to compile Python 3.6.1 on macOS 10.12.5 with xcode 8.8.3 using > the instructions at > https://docs.p

Re: getting memory usage of varaibles

2017-05-02 Thread INADA Naoki
I recommend tracemalloc. Start with PYTHONTRACEMALLOC=3, and increase depth only when stack trace is too short. 2017/05/03 午後0:50 "Larry Martell" : > On Tue, May 2, 2017 at 7:01 PM, Erik wrote: > > On 02/05/17 23:28, Larry Martell wrote: > > Anyone have any thoughts on how I can monit

Re: OrderedDict with kwds

2017-04-22 Thread INADA Naoki
On Sat, Apr 22, 2017 at 10:41 PM, Ben Finney wrote: > INADA Naoki writes: > >> From Python 3.6, keyword arguments are ordered. So the docstring is >> outdated. > > (Thank you, Inada-san, for the implementation!) > > The announcement of the change specifies that w

Re: OrderedDict with kwds

2017-04-22 Thread INADA Naoki
On Sat, Apr 22, 2017 at 3:08 AM, Albert-Jan Roskam wrote: > For regular dicts I like to use the dict() function because the code is > easier to write and read. But OrderedDict() is not equivalent to dict(): > In the docstring of collections.OrderedDict it says "keyword arguments are > not recomm

Re: Improve Python + Influxdb import performance

2017-04-03 Thread INADA Naoki
You can reuse connection, instead of creating for each request. (HTTP keep-alive). On Tue, Apr 4, 2017 at 1:11 AM, Prathamesh wrote: > Hello World > > The following script is an extract from > > https://github.com/RittmanMead/obi-metrics-agent/blob/master/obi-metrics-agent.py > > <> > > import ca

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-30 Thread INADA Naoki
FYI, this small patch may fix your issue: https://gist.github.com/methane/8faf12621cdb2166019bbcee65987e99 -- https://mail.python.org/mailman/listinfo/python-list

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-30 Thread INADA Naoki
Filed an issue: https://bugs.python.org/issue29949 Thanks for your report, Jan. On Fri, Mar 31, 2017 at 3:04 AM, INADA Naoki wrote: > Maybe, this commit make this regression. > > https://github.com/python/cpython/commit/4897300276d870f99459c82b937f0ac22450f0b6 > > Old: > m

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-30 Thread INADA Naoki
ange(10)) >>> sys.getsizeof(frozenset(s)) 736 >>> $ python3 Python 3.6.0 (default, Dec 30 2016, 20:49:54) [GCC 6.2.0 20161005] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> s

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-30 Thread INADA Naoki
I reproduced the issue. This is very usual, memory usage issue. Slashing is just a result of large memory usage. After 1st pass of optimization, RAM usage is 20GB+ on Python 3.5 and 30GB on Python 3.6. And Python 3.6 starts slashing in 2nd optimization pass. I enabled tracemalloc while 1st pass.

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-30 Thread INADA Naoki
> > Running further trials indicate that the problem actually is related to > swapping. If I reduce the model size in the benchmark slightly so that > everything fits into the main memory, the problem disappears. Only when the > memory usage exceeds the 32GB that I have, Python 3.6 will acquire way

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-28 Thread INADA Naoki
On Wed, Mar 29, 2017 at 12:29 AM, Jan Gosmann wrote: > On 28 Mar 2017, at 6:11, INADA Naoki wrote: > >> I managed to install pyopencl and run the script. It takes more than >> 2 hours, and uses only 7GB RAM. >> Maybe, some faster backend for OpenCL is required? >

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-28 Thread INADA Naoki
I can't reproduce it. I managed to install pyopencl and run the script. It takes more than 2 hours, and uses only 7GB RAM. Maybe, some faster backend for OpenCL is required? I used Microsoft Azure Compute, Standard_A4m_v2 (4 cores, 32 GB memory) instance. More easy way to reproduce is needed...

Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread INADA Naoki
> i dont have to update table set column1 = this value, column2=that value and > so on Why do you think so? Did you really read the manual? mysql> create table test_update (a int primary key, b int, c int); Query OK, 0 rows affected (0.02 sec) mysql> insert into test_update values (1, 2, 3); Qu

Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread INADA Naoki
Read my mail again. > This error came from MySQL. If there are no logs in error_log, it's > your configuration issue. > See https://dev.mysql.com/doc/refman/5.7/en/update.html for Update > statement syntax. -- https://mail.python.org/mailman/listinfo/python-list

Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread INADA Naoki
ich wont work > within like > > How would you type it without space as in "%%s%" ? > > Στις Κυρ, 26 Μαρ 2017 στις 5:32 μ.μ., ο/η INADA Naoki > έγραψε: >> >> > I MEAN HOW TO DIFFERENTIATE '%S' FROM LITERAL '%' character. >> &

Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread INADA Naoki
> I MEAN HOW TO DIFFERENTIATE '%S' FROM LITERAL '%' character. > >>> '%% %s %%s' % (42,) '% 42 %s' Use %% -- https://mail.python.org/mailman/listinfo/python-list

Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread INADA Naoki
On Sun, Mar 26, 2017 at 10:34 PM, Νίκος Βέργος wrote: > with import cgitb; cgitb.enable() > > ProgrammingError(1064, "You have an error in your SQL syntax; check the > manual that corresponds to your MariaDB server version for the right syntax > to use near '(pagesID, host, ref, location, useros

Re: asyncio does not always show the full traceback

2017-03-02 Thread INADA Naoki
FYI, you can easily find this changelog of Python 3.6rc1: - bpo-28843: Fix asyncio C Task to handle exceptions __traceback__. See also: https://bugs.python.org/issue28843 On Fri, Mar 3, 2017 at 1:11 AM, INADA Naoki wrote: >> For completeness, if I place '1/0' in aenum(), I get

Re: asyncio does not always show the full traceback

2017-03-02 Thread INADA Naoki
> For completeness, if I place '1/0' in aenum(), I get exactly the same > traceback as the first one above. > I can't reproduce it too. Did you 3.6.0 this time? Or did you used 3.6b4 again? Please don't use beta when asking question or reporting bug. -- https://mail.python.org/mailman/listinfo/p

Re: asyncio does not always show the full traceback

2017-03-02 Thread INADA Naoki
Could you use 3.6.0 instead of b4? I added 1/0 at: ... async def main(): 1/0 await aenum() ... then: $ pyenv/versions/3.6.0/bin/python3 -VV Python 3.6.0 (default, Jan 16 2017, 19:41:10) [GCC 6.2.0 20161005] $ pyenv/versions/3.6.0/bin/python3 a.py Traceback (most recent call last): File

Re: asyncio does not always show the full traceback

2017-03-02 Thread INADA Naoki
I can't reproduce it on Linux. Maybe, it's windows specific bug? On Wed, Mar 1, 2017 at 11:25 PM, Frank Millman wrote: > "Frank Millman" wrote in message news:o93vs2$smi$1...@blaine.gmane.org... >> >> >> I use asyncio in my project, so most of my functions start with 'async' >> and > > most of m

Re: Python replace multiple strings (m*n) combination

2017-02-25 Thread INADA Naoki
If you can use third party library, I think you can use Aho-Corasick algorithm. https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm https://pypi.python.org/pypi/pyahocorasick/ On Sat, Feb 25, 2017 at 3:54 AM, wrote: > I have a task to search for multiple patterns in incoming string an

Re: Overriding True and False ?

2017-01-29 Thread INADA Naoki
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

  1   2   >