Is __ne__ method autogenerated?

2012-12-06 Thread INADA Naoki
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

Re: Is __ne__ method autogenerated?

2012-12-06 Thread INADA Naoki
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

Why this recursive import fails?

2012-03-06 Thread INADA Naoki
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

Re: Why this recursive import fails?

2012-03-07 Thread INADA Naoki
I found it is a bug http://bugs.python.org/issue13187 -- http://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: [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

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: 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: 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: 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: [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: [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-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: 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: 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 > > -- >

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: 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

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

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: 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: 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: 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: 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: 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: 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: 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: 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: 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
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: 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: 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: 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
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
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: 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: Python non blocking multi-client service

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

Re: a *= b not equivalent to a = a*b

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

Re: pip3 : command not found

2016-10-30 Thread INADA Naoki
> How do I fix this? Maybe: $ brew uninstall python3 $ brew install python3 -- https://mail.python.org/mailman/listinfo/python-list

Re: pip install -r requirements.txt fails with Python 3.6 on Windows 10

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

Re: Odd message while building Python from tip

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

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

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' >

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: 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: 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: 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: 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: 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: 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: 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 - 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: 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: 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: 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: 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

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: 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

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: MySQL - Django can not display international characters

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

Re: Performance with and without the garbage collector

2016-05-14 Thread INADA Naoki
#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

Re: not able to install mysqldb-python

2016-06-23 Thread INADA Naoki
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

Re: Convert from unsigned long long to PyLong

2016-07-24 Thread INADA Naoki
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

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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-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-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-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-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: Faviourite improvements in Python 3.5 (was: Python 3 virtualenvs)

2015-11-27 Thread INADA Naoki
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

Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO

2016-02-06 Thread INADA Naoki
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

Re: tarfile : read from a socket?

2016-02-11 Thread INADA Naoki
Have you tried socket.makefile() method? -- https://mail.python.org/mailman/listinfo/python-list

Re: What is heating the memory here? hashlib?

2016-02-14 Thread INADA Naoki
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

Re: Guido on python3 for beginners

2016-02-18 Thread INADA Naoki
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

Re: asyncmongo + python 3: No module named 'errors'

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

Re: Continuing indentation

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

Re: Continuing indentation

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

Re: Review Request of Python Code

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

Re: Other difference with Perl: Python scripts in a pipe

2016-03-10 Thread INADA Naoki
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

Re: [Not actually OT] Trouble in node.js land

2016-03-23 Thread INADA Naoki
> > > 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; > }

Re: 0 equals False, was Re: (unknown)

2016-03-23 Thread INADA Naoki
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

Re: bufsize must be an integer in subprocess.Popen

2015-02-23 Thread INADA Naoki
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

Re: bufsize must be an integer in subprocess.Popen

2015-02-23 Thread INADA Naoki
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

Re: PyPI, reStructuredText and readthedocs problems

2015-03-02 Thread INADA Naoki
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

Re: Python 2 to 3 conversion - embrace the pain

2015-03-13 Thread INADA Naoki
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   2   >