Re: Checking if email is valid

2023-11-01 Thread Ian Hobson via Python-list
like a bad idea to me and the other options I found required paying for third party services. Could someone push me in the right direction please? I just want to find out if a string is a valid email address. Thank you. Simon. -- Ian Hobson Tel (+66) 626 544 695 -- https://mail.python.org

Re: Getty fully qualified class name from class object

2023-08-23 Thread Ian Pilcher via Python-list
On 8/22/23 11:13, Greg Ewing via Python-list wrote: Classes have a __module__ attribute: >>> logging.Handler.__module__ 'logging' Not sure why I didn't think to look for such a thing. Looks like it's as simple as f'{cls.__module__}.{cls.__qualname__}'. Thanks! --

Getty fully qualified class name from class object

2023-08-22 Thread Ian Pilcher via Python-list
How can I programmatically get the fully qualified name of a class from its class object? (I'm referring to the name that is shown when str() or repr() is called on the class object.) Neither the __name__ or __qualname__ class attributes include the module. For example: >>> import logging

Which more Pythonic - self.__class__ or type(self)?

2023-03-02 Thread Ian Pilcher
Seems like an FAQ, and I've found a few things on StackOverflow that discuss the technical differences in edge cases, but I haven't found anything that talks about which form is considered to be more Pythonic in those situations where there's no functional difference. Is there any consensus? --

Re: Tool that can document private inner class?

2023-02-08 Thread Ian Pilcher
On 2/8/23 08:25, Weatherby,Gerard wrote: No. I interpreted your query as “is there something that can read docstrings of dunder methods?” Have you tried the Sphinx specific support forums? https://www.sphinx-doc.org/en/master/support.html Yes. I've posted to both the -user and -dev

Re: Tool that can document private inner class?

2023-02-07 Thread Ian Pilcher
On 2/7/23 14:53, Weatherby,Gerard wrote: Yes. Inspect module import inspect class Mine: def __init__(self): self.__value = 7 def __getvalue(self): /"""Gets seven""" /return self.__value mine = Mine() data = inspect.getdoc(mine) for m in inspect.getmembers(mine): if '__getvalue' in m[0]:

Tool that can document private inner class?

2023-02-07 Thread Ian Pilcher
I've been banging my head on Sphinx for a couple of days now, trying to get it to include the docstrings of a private (name starts with two underscores) inner class. All I've managed to do is convince myself that it really can't do it. See https://github.com/sphinx-doc/sphinx/issues/11181. Is

Re: set.add() doesn't replace equal element

2022-12-31 Thread Ian Pilcher
On 12/30/22 17:00, Paul Bryan wrote: It seems to me like you have to ideas of what "equal" means. You want to update a "non-equal/equal" value in the set (because of a different time stamp). If you truly considered them equal, the time stamp would be irrelevant and updating the value in the

Re: set.add() doesn't replace equal element

2022-12-30 Thread Ian Pilcher
On 12/30/22 15:47, Paul Bryan wrote: What kind of elements are being added to the set? Can you show reproducible sample code? The objects in question are DHCP leases. I consider them "equal" if the lease address (or IPv6 prefix) is equal, even if the timestamps have changed. That code is not

set.add() doesn't replace equal element

2022-12-30 Thread Ian Pilcher
I just discovered this behavior, which is problematic for my particular use. Is there a different set API (or operator) that can be used to add an element to a set, and replace any equal element? If not, am I correct that I should call set.discard() before calling set.add() to achieve the

Re: Calling pselect/ppoll/epoll_pwait

2022-12-13 Thread Ian Pilcher
On 12/2/22 14:00, Ian Pilcher wrote: Does Python provide any way to call the "p" variants of the I/O multiplexing functions? Just to close this out ... As others suggested, there's no easy way to call the "p" variants of the I/O multiplexing functions, but this

Calling pselect/ppoll/epoll_pwait

2022-12-02 Thread Ian Pilcher
Does Python provide any way to call the "p" variants of the I/O multiplexing functions? Looking at the documentation of the select[1] and selectors[2] modules, it appears that they expose only the "non-p" variants. [1] https://docs.python.org/3/library/select.html [2]

Re: Dealing with non-callable classmethod objects

2022-11-12 Thread Ian Pilcher
On 11/12/22 14:57, Cameron Simpson wrote: You shouldn't need a throwaway class, just use the name "classmethod" directly - it's the type!     if not callable(factory):     if type(factory) is classmethod:     # replace fctory with a function calling factory.__func__    

Re: Dealing with non-callable classmethod objects

2022-11-12 Thread Ian Pilcher
On 11/11/22 16:47, Cameron Simpson wrote: On 11Nov2022 15:29, Ian Pilcher wrote: * Can I improve the 'if callable(factory):' test above?  This treats  all non-callable objects as classmethods, which is obviously not  correct.  Ideally, I would check specifically for a classmethod

Re: Superclass static method name from subclass

2022-11-11 Thread Ian Pilcher
On 11/11/22 11:02, Thomas Passin wrote: You can define a classmethod in SubClass that seems to do the job: class SuperClass(object):   @staticmethod   def spam():  # "spam" and "eggs" are a Python tradition   print('spam from SuperClass') class SubClass(SuperClass):    

Re: Superclass static method name from subclass

2022-11-11 Thread Ian Pilcher
On 11/11/22 11:29, Dieter Maurer wrote: Ian Pilcher wrote at 2022-11-11 10:21 -0600: class SuperClass(object): @staticmethod def foo(): pass class SubClass(SuperClass): bar = SuperClass.foo ^^ Is there a way to do this without

Dealing with non-callable classmethod objects

2022-11-11 Thread Ian Pilcher
I am trying to figure out a way to gracefully deal with uncallable classmethod objects. The class hierarchy below illustrates the issue. (Unfortunately, I haven't been able to come up with a shorter example.) import datetime class DUID(object): _subclasses = {} def

Superclass static method name from subclass

2022-11-11 Thread Ian Pilcher
Is it possible to access the name of a superclass static method, when defining a subclass attribute, without specifically naming the super- class? Contrived example: class SuperClass(object): @staticmethod def foo(): pass class SubClass(SuperClass): bar =

Re: Comparing sequences with range objects

2022-04-09 Thread Ian Hobson
are equal and key data for both is present 2) Sort the data using the comparator function. 3) Run through the data with a trailing enumeration loop, merging matching records together. 4) If there are no records copied out with missing key data, then you are done, so exit. 5) Choose a new key and r

[issue38242] Revert the new asyncio Streams API

2022-03-22 Thread Ian Good
Change by Ian Good : -- nosy: +icgood nosy_count: 9.0 -> 10.0 pull_requests: +30142 pull_request: https://github.com/python/cpython/pull/13143 ___ Python tracker <https://bugs.python.org/issu

[issue46550] __slots__ updates despite being read-only

2022-01-28 Thread Ian Lee
Ian Lee added the comment: @ronaldoussoren - right, I agree that I think that raising the AttributeErrors is the right thing. The part that feels like a bug to me is that the exception is saying it is read only and yet it is not being treated it that way (even though as you point out

[issue46550] __slots__ updates despite being read-only

2022-01-27 Thread Ian Lee
Ian Lee added the comment: @sobolevn - Hmm, interesting.. I tested in python 3.9 which I had available, and I can reproduce your result, but I think it's different because you are using a tuple. If I use a list then I see my same reported behavior in 3.9: ```python Python 3.9.10 (main, Jan

[issue46550] __slots__ updates despite being read-only

2022-01-27 Thread Ian Lee
New submission from Ian Lee : Hi there - I admit that I don't really understand the internals here, so maybe there is a good reason for this, but I thought it was weird when I just ran across it. If I create a new class `A`, and set it's `__slots`: ```python ➜ ~ docker run -it python:3.10

[issue45677] [doc] improve sqlite3 docs

2021-11-21 Thread Ian Fisher
Ian Fisher added the comment: I think it would also be helpful to make the examples at the top simpler/more idiomatic, e.g. using a context manager for the connection and calling conn.execute directly instead of spawning a cursor. I think the information about the isolation_level parameter

[issue26651] Deprecate register_adapter() and register_converter() in sqlite3

2021-11-21 Thread Ian Fisher
Ian Fisher added the comment: See bpo-45858 for a more limited proposal to only deprecate the default converters. -- ___ Python tracker <https://bugs.python.org/issue26

[issue45858] Deprecate default converters in sqlite3

2021-11-21 Thread Ian Fisher
Ian Fisher added the comment: See also bpo-26651 for a related proposal to deprecate the converter/adapter infrastructure entirely. The proposal in this bug is more limited: remove the default converters (though I think the default adapters should stay), but continue to allow users

[issue45858] Deprecate default converters in sqlite3

2021-11-21 Thread Ian Fisher
New submission from Ian Fisher : Per discussion at https://discuss.python.org/t/fixing-sqlite-timestamp-converter-to-handle-utc-offsets/, the default converters in SQLite3 have several bugs and are probably not worth continuing to maintain, so I propose deprecating them and removing them

[issue45611] pprint - low width overrides depth folding

2021-10-26 Thread Ian Currie
New submission from Ian Currie : Reproducible example: >>> from pprint import pprint >>> data = [["aa"],[2],[3],[4],[5]] >>> pprint(data) [["aa"], [2], [3], [4], [5]] >>> pprint(data, depth=1) [[...], [...

[issue34798] pprint ignores the compact parameter for dicts

2021-10-25 Thread Ian
Ian added the comment: I came across this and was confused by it too. I also don't understand the justification with not having dicts to be affected by the `compact` parameter. If the "compact form" is having separate entries or elements on one line, instead of having each element

[issue45335] Default TIMESTAMP converter in sqlite3 ignores UTC offset

2021-10-24 Thread Ian Fisher
Change by Ian Fisher : -- keywords: +patch pull_requests: +27469 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29200 ___ Python tracker <https://bugs.python.org/issu

[issue19065] sqlite3 timestamp adapter chokes on timezones

2021-10-07 Thread Ian Fisher
Change by Ian Fisher : -- nosy: +iafisher ___ Python tracker <https://bugs.python.org/issue19065> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26651] Deprecate register_adapter() and register_converter() in sqlite3

2021-10-07 Thread Ian Fisher
Change by Ian Fisher : -- nosy: +iafisher ___ Python tracker <https://bugs.python.org/issue26651> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45335] Default TIMESTAMP converter in sqlite3 ignores UTC offset

2021-10-05 Thread Ian Fisher
Ian Fisher added the comment: Okay, I started a discussion here: https://discuss.python.org/t/fixing-sqlite-timestamp-converter-to-handle-utc-offsets/10985 -- ___ Python tracker <https://bugs.python.org/issue45

[issue45335] Default TIMESTAMP converter in sqlite3 ignores UTC offset

2021-10-05 Thread Ian Fisher
Ian Fisher added the comment: > Another option could be to deprecate the current behaviour and then change it > to being timezone aware in Python 3.13. This sounds like the simplest option. I'd be interested in working on this myself, if you think it's something that a new C

[issue45335] Default TIMESTAMP converter in sqlite3 ignores UTC offset

2021-10-04 Thread Ian Fisher
Ian Fisher added the comment: Unfortunately fixing this will have to be considered a backwards-incompatible change, since Python doesn't allow naive and aware datetime objects to be compared, so if sqlite3 starts returning aware datetimes, existing code might break. Alternatively, perhaps

[issue45335] Default TIMESTAMP converter in sqlite3 ignores time zone

2021-10-02 Thread Ian Fisher
Ian Fisher added the comment: Substitute "UTC offset" for "time zone" in my comment above. I have attached a minimal Python program demonstrating data loss from this bug. -- Added file: https://bugs.python.org/file50324/timestamp.py __

[issue45335] Default TIMESTAMP converter in sqlite3 ignores time zone

2021-09-30 Thread Ian Fisher
New submission from Ian Fisher : The SQLite converter that the sqlite3 library automatically registers for TIMESTAMP columns (https://github.com/python/cpython/blob/main/Lib/sqlite3/dbapi2.py#L66) ignores the time zone even if it is present and always returns a naive datetime object. I

[issue45241] python REPL leaks local variables when an exception is thrown

2021-09-19 Thread Ian Henderson
Ian Henderson added the comment: Ah, you're right -- it looks like the 'objs' global is what's keeping these objects alive. Sorry for the noise. -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/i

[issue45241] python REPL leaks local variables when an exception is thrown

2021-09-19 Thread Ian Henderson
New submission from Ian Henderson : To reproduce, copy the following code: import gc gc.collect() objs = gc.get_objects() for obj in objs: try: if isinstance(obj, X): print(obj) except NameError: class X: pass def f(): x = X() raise

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-12 Thread Ian Good
Ian Good added the comment: Julian, That is certainly a workaround, however the behavior you are describing is inconsistent with PEP-544 in both word and intention. From the PEP: > To explicitly declare that a certain class implements a given protocol, it > can be used as a regula

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-11 Thread Ian Good
Ian Good added the comment: I believe this was a deeper issue that affected all classes inheriting Protocol, causing a TypeError on even the most basic case (see attached): Traceback (most recent call last): File "/.../test.py", line 14, in MyClass() File "/.../te

Re: neoPython : Fastest Python Implementation: Coming Soon

2021-05-05 Thread Ian Clark
I wish you best of luck, on top of everything else it looks like the neopython namespace has already been eaten up by some crypto project On Wed, May 5, 2021 at 11:18 AM Benjamin Schollnick < bscholln...@schollnick.net> wrote: > > Why? The currently extant Python implementations contribute to

[issue43895] Unnecessary Cache of Shared Object Handles

2021-04-23 Thread Ian H
Change by Ian H : -- keywords: +patch pull_requests: +24282 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25487 ___ Python tracker <https://bugs.python.org/issu

[issue43895] Unnecessary Cache of Shared Object Handles

2021-04-20 Thread Ian H
Ian H added the comment: Proposed patch is in https://github.com/python/cpython/pull/25487. -- ___ Python tracker <https://bugs.python.org/issue43895> ___ ___

[issue43895] Unnecessary Cache of Shared Object Handles

2021-04-20 Thread Ian H
New submission from Ian H : While working on another project I noticed that there's a cache of shared object handles kept inside _PyImport_FindSharedFuncptr. See https://github.com/python/cpython/blob/b2b6cd00c6329426fc3b34700f2e22155b44168c/Python/dynload_shlib.c#L51-L55. It appears

[issue43870] C API Functions Bypass __import__ Override

2021-04-16 Thread Ian H
New submission from Ian H : Some of the import-related C API functions are documented as bypassing an override to builtins.__import__. This appears to be the case, but the documentation is incomplete in this regard. For example, PyImport_ImportModule is implemented by calling PyImport_Import

[issue43819] ExtensionFileLoader Does Not Implement invalidate_caches

2021-04-12 Thread Ian H
New submission from Ian H : Currently there's no easy way to get at the internal cache of module spec objects for compiled extension modules. See https://github.com/python/cpython/blob/20ac34772aa9805ccbf082e700f2b033291ff5d2/Python/import.c#L401-L415. For example, these module spec objects

[issue43749] venv module does not copy the correct python exe

2021-04-06 Thread Ian Norton
Change by Ian Norton : -- keywords: +patch pull_requests: +23954 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25216 ___ Python tracker <https://bugs.python.org/issu

[issue43749] venv module does not copy the correct python exe

2021-04-06 Thread Ian Norton
Ian Norton added the comment: This may also cause https://bugs.python.org/issue35644 -- ___ Python tracker <https://bugs.python.org/issue43749> ___ ___ Pytho

[issue43749] venv module does not copy the correct python exe

2021-04-06 Thread Ian Norton
New submission from Ian Norton : On windows, the venv module does not copy the correct python exe if the current running exe (eg sys.executable) has been renamed (eg, named python3.exe) venv will only make copies of python.exe, pythonw.exe, python_d.exe or pythonw_d.exe. If for example

[issue43047] logging.config formatters documentation is out of sync with code

2021-01-27 Thread Ian Wienand
Change by Ian Wienand : -- keywords: +patch pull_requests: +23182 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24358 ___ Python tracker <https://bugs.python.org/issu

[issue43047] logging.config formatters documentation is out of sync with code

2021-01-27 Thread Ian Wienand
New submission from Ian Wienand : The dict based configuration does not mention the "class" option, and neither the ini-file or dict sections mention the style tag. -- components: Library (Lib) messages: 385825 nosy: iwienand priority: normal severity: normal status:

[issue42442] Tarfile to stdout documentation example

2020-11-23 Thread Ian Laughlin
New submission from Ian Laughlin : Recommend adding example to tarfile documentation to provide example of writing a tarfile to stdout. example: files = [(file_1, filename_1), (file_2, filename_2)] with tarfile.open(fileobj=sys.stdout.buffer, mode = 'w|gz') as tar: for file, filename

[issue42225] Tkinter hangs or crashes when displaying astral chars

2020-11-08 Thread Ian Strawbridge
Ian Strawbridge added the comment: On Ubuntu, Tk version is showing as 8.6.10 On Windows 10, Tk version is showing as 8.6.9 -- ___ Python tracker <https://bugs.python.org/issue42

[issue42225] Tkinter hangs or crashes when displaying astral chars

2020-11-08 Thread Ian Strawbridge
Ian Strawbridge added the comment: Further to the information I posted on Stack Overflow (referred to above) relating to reproducing emoticon characters from Idle under Ubuntu, I have done more testing. Based on some of the code/comments above, I tried modifications which I hoped might

_pydoc.css

2020-10-25 Thread Ian Gay
The default colors of pydoc are truly horrendous! Has anyone written a _pydoc.css file to produce something reasonable? (running 3.6 on OpenSuse 15.1) Ian -- *** To reply by e-mail, make w single in address ** -- https://mail.python.org/mailman/listinfo/python-list

[issue41883] ctypes pointee goes out of scope, then pointer in struct dangles and crashes

2020-09-30 Thread Ian M. Hoffman
Ian M. Hoffman added the comment: I agree with you. When I wrote "desired behavior" I intended it to mean "my selfishly desired outcome of not loading my struct with a dangling pointer." This issue seems to have descended into workarounds that treat the symptoms;

[issue41883] ctypes pointee goes out of scope, then pointer in struct dangles and crashes

2020-09-29 Thread Ian M. Hoffman
Ian M. Hoffman added the comment: You are correct. After further review, I found an older ctypes issue #12836 which was then enshrined in a workaround in the numpy.ndarray.ctypes interface to vanilla ctypes. https://numpy.org/doc/stable/reference/generated/numpy.ndarray.ctypes.html Numpy

[issue41883] ctypes pointee goes out of scope, then pointer in struct dangles and crashes

2020-09-28 Thread Ian M. Hoffman
New submission from Ian M. Hoffman : A description of the problem, complete example code for reproducing it, and a work-around are available on SO at the link: https://stackoverflow.com/questions/64083376/python-memory-corruption-after-successful-return-from-a-ctypes-foreign-function

Re: What kind of magic do I need to get python to talk to Excel xlsm file?

2020-09-03 Thread Ian Hill
If you don't need to do any specific data analysis using pandas, try openpyxl. It will read xlsm files and it quite straight forward to use. https://openpyxl.readthedocs.io/en/stable/ pip install openpyxl. Ian -- https://mail.python.org/mailman/listinfo/python-list

Re: Silly question, where is read() documented?

2020-08-29 Thread Ian Hobson
not a built-in function and it's not documented with (for example) the file type object sys.stdin. So where is it documented? :-) -- Ian Hobson -- This email has been checked for viruses by AVG. https://www.avg.com -- https://mail.python.org/mailman/listinfo/python-list

Re: LittleRookie

2020-08-19 Thread Ian Hill
You can access Dr.Chuck's Python for Everybody course here https://www.py4e.com/ or you need to be on the audit track on Coursera. R. ushills -- https://mail.python.org/mailman/listinfo/python-list

[issue41389] Garbage Collector Ignoring Some (Not All) Circular References of Identical Type

2020-07-27 Thread Ian O'Shaughnessy
Ian O'Shaughnessy added the comment: >I don't know of any language that guarantees all garbage will be collected >"right away". Do you? I'm not an expert in this domain, so, no. I am however attempting to find a way to mitigate this issue. Do you have any suggestions

[issue41389] Garbage Collector Ignoring Some (Not All) Circular References of Identical Type

2020-07-27 Thread Ian O'Shaughnessy
Ian O'Shaughnessy added the comment: "Leak" was likely the wrong word. It does appear problematic though. The loop is using a fixed number of variables (yes, there are repeated dynamic allocations, but they fall out of scope with each iteration), only one of these variables oc

[issue41389] Garbage Collector Ignoring Some (Not All) Circular References of Identical Type

2020-07-24 Thread Ian O'Shaughnessy
Ian O'Shaughnessy added the comment: For a long running process (greatly exceeding a million iterations) the uncollected garbage will become too large for the system (many gigabytes). A manual execution of the gc would be required. That seems flawed given that Python is a garbage collected

[issue41389] Garbage Collector Ignoring Some (Not All) Circular References of Identical Type

2020-07-24 Thread Ian O'Shaughnessy
New submission from Ian O'Shaughnessy : Using a script that has two classes A and B which contain a circular reference variable, it is possible to cause a memory leak that is not captured by default gc collection. Only by running gc.collect() manually do the circular references get collected

[issue35786] get_lock() method is not present for Values created using multiprocessing.Manager()

2020-07-06 Thread Ian Jacob Bertolacci
Ian Jacob Bertolacci added the comment: What's being done about this? I would say this is less "misleading documentation" and more "incorrect implementation" There is also not an obvious temporary work-around. -- nosy: +IanBertolacci __

[issue39619] os.chroot is not enabled on HP-UX builds

2020-02-12 Thread Ian Norton
New submission from Ian Norton : When building on HP-UX using: The configure stage fails to detect chroot(). This is due to setting _XOPEN_SOURCE to a value higher than 500. The fix for this is to not set _XOPEN_SOURCE when configuring for HP-UX -- components: Interpreter Core

[issue39480] referendum reference is needlessly annoying

2020-01-28 Thread Ian Jackson
New submission from Ian Jackson : The section "Fancier Output Formatting" has the example below. This will remind many UK readers of the 2016 EU referendum. About half of those readers will be quite annoyed. This annoyance seems entirely avoidable; a different example which did

[issue38869] Unexpectedly variable result

2019-11-20 Thread Ian Carr-de Avelon
New submission from Ian Carr-de Avelon : I can't understand why the result of changes() in the example file changes. I get: [[6.90642211e-310] [1.01702662e-316] [1.58101007e-322]] [[0.] [0.] [0.]] with an Ubuntu 14 system that has had a lot of changes made. I've checked the same happens

Re: Any socket library to communicate with kernel via netlink?

2019-11-20 Thread Ian Pilcher
in, but always found library called netlinkg but it actually does something like modify network address or check network card... Any idea is welcome https://pypi.org/project/pyroute2/ -- Ian Pilcher

Distutils - bdist_rpm - specify python interpretter location

2019-10-30 Thread Ian Pilcher
FILES Is there a way to tell Distutils to use 'python2'? Thanks! -- ======== Ian Pilcher arequip...@gmail.com "I grew up before

[issue34975] start_tls() difficult when using asyncio.start_server()

2019-10-28 Thread Ian Good
Ian Good added the comment: #36889 was reverted, so this is not resolved. I'm guessing this needs to be moved to 3.9 now too. Is my original PR worth revisiting? https://github.com/python/cpython/pull/13143/files -- resolution: fixed -> status: closed ->

Re: What's the purpose the hook method showing in a class definition?

2019-10-20 Thread Ian Hobson
, to look for a magic method, and starts again at B. When the magic method is found in Object, you get the "not found" error. If you implement the magic method in A or B it will be run instead. Regards Ian -- This email has been checked for viruses by AVG. https://www.avg.com

Re: Get __name__ in C extension module

2019-10-07 Thread Ian Pilcher
actually is a logger. Doing that validation (by using an "O!" unit in the PyArg_ParseTuple format string) requires access to the logging.Logger type object, and I was unable to find a way to access that object by name. -- ======

Re: Get __name__ in C extension module

2019-10-06 Thread Ian Pilcher
nd you get memory leaks of worse crash python. Well, I like driving cars with manual transmissions, so ... -- ======== Ian Pilcher arequip...@gmail.com "I grew up before Mark Zuck

Re: Get __name__ in C extension module

2019-10-06 Thread Ian Pilcher
in one of my extension functions? The only thing I can think of would be to save it in a static variable, but static variables seem to be a no-no in extensions. -- Ian Pilcher arequip

Re: Get __name__ in C extension module

2019-10-06 Thread Ian Pilcher
On 10/5/19 12:55 PM, Ian Pilcher wrote: This is straightforward, except that I cannot figure out how to retrieve the __name__. Making progress. I can get a __name__ value with: PyDict_GetItemString(PyEval_GetGlobals(), "__name__") I say "a __name__ value" becaus

Get __name__ in C extension module

2019-10-05 Thread Ian Pilcher
On 10/4/19 4:30 PM, Ian Pilcher wrote: Ideally, I would pass my existing Logging.logger object into my C function and use PyObject_CallMethod to call the appropriate method on it (info, debug, etc.). As I've researched this further, I've realized that this isn't the correct approach. My

Using a logging.Logger in a C extension

2019-10-04 Thread Ian Pilcher
.). PyArg_ParseTuple should be able to handle this with an "O!" format unit, but I can't figure out how to retrieve the type object for logging.Logger. Any hints, links, etc. appreciated. Thanks! -- ======== I

[issue38300] Documentation says destuction of TemporaryDirectory object will also delete it, but it does not.

2019-09-27 Thread Ian
Ian added the comment: I'm sorry, I should've thought to check my python version. I was on 3.6.3 which it would not be deleted, updated to 3.6.8 and it works as intended. -- resolution: -> not a bug stage: -> resolved status: open -> closed versions: -P

[issue38300] Documentation says destuction of TemporaryDirectory object will also delete it, but it does not.

2019-09-27 Thread Ian
New submission from Ian : The documentation found here https://docs.python.org/3.7/library/tempfile.html#tempfile.TemporaryDirectory states the following "On completion of the context or destruction of the temporary directory object the newly created temporary directory and all its con

Irritating bytearray behavior

2019-09-16 Thread Ian Pilcher
of ip.packed into the bytearray without changing its size? TIA -- Ian Pilcher arequip...@gmail.com "I grew up before Mark Zuckerberg invented frien

Re: ``if var'' and ``if var is not None''

2019-09-01 Thread Ian Kelly
On Sun, Sep 1, 2019, 8:58 AM Terry Reedy wrote: > On 9/1/2019 2:12 AM, Hongyi Zhao wrote: > > > The following two forms are always equivalent: > > ``if var'' and ``if var is not None'' > > Aside from the fact that this is false, why would you post such a thing? > Trolling? Did you hit [Send]

Re: itertools cycle() docs question

2019-08-21 Thread Ian Kelly
On Wed, Aug 21, 2019 at 12:36 PM Calvin Spealman wrote: > > The point is to demonstrate the effect, not the specific implementation. But still yes, that's pretty much exactly what it does. The main difference between the "roughly equivalent to" code and the actual implementation is that the

Re: Enumerate - int object not subscriptable

2019-08-20 Thread Ian Kelly
Or use the "pairwise" recipe from the itertools docs: from itertools import tee def pairwise(iterable): "s -> (s0,s1), (s1,s2), (s2, s3), ..." a, b = tee(iterable) next(b, None) return zip(a, b) for num1, num2 in pairwise(a): print(num1, num2) On Tue, Aug 20, 2019 at 7:42

Re: Remote/Pair-Programming in-the-cloud

2019-08-04 Thread Ian Kelly
On Sat, Aug 3, 2019, 9:25 AM Bryon Tjanaka wrote: > Depending on how often you need to run the code, you could use a google doc > and copy the code over when you need to run. Of course, if you need linters > and other tools to run frequently this would not work. > I've conducted a number of

Re: if bytes != str:

2019-08-04 Thread Ian Kelly
On Sun, Aug 4, 2019, 9:02 AM Hongyi Zhao wrote: > Hi, > > I read and learn the the following code now: > > https://github.com/shadowsocksr-backup/shadowsocksr-libev/blob/master/src/ > ssrlink.py > > > In this

Re: super or not super?

2019-07-16 Thread Ian Kelly
On Tue, Jul 16, 2019 at 1:21 AM Chris Angelico wrote: > > On Tue, Jul 16, 2019 at 3:32 PM Ian Kelly wrote: > > > > Just using super() is not enough. You need to take steps if you want to > > ensure that you class plays nicely with MI. For example, consider the > &g

Re: super or not super?

2019-07-15 Thread Ian Kelly
On Sun, Jul 14, 2019 at 7:14 PM Chris Angelico wrote: > > On Mon, Jul 15, 2019 at 10:51 AM Paulo da Silva > wrote: > > > > Às 15:30 de 12/07/19, Thomas Jollans escreveu: > > > On 12/07/2019 16.12, Paulo da Silva wrote: > > >> Hi all! > > >> > > >> Is there any difference between using the base

Re: How Do You Replace Variables With Their Values?

2019-07-14 Thread Ian Kelly
On Thu, Jul 11, 2019 at 11:10 PM Chris Angelico wrote: > > On Fri, Jul 12, 2019 at 2:30 PM Aldwin Pollefeyt > wrote: > > > > Wow, I'm so sorry I answered on the question : "How do you replace a > > variable with its value". For what i understood with the example values, > > CrazyVideoGamez wants

Re: Seeking help regarding Python code

2019-07-11 Thread Ian Hobson
will come after you understand exactly what to achieve, and how a computer could do it. Regards Ian (Another one). -- https://mail.python.org/mailman/listinfo/python-list

[issue36889] Merge StreamWriter and StreamReader into just asyncio.Stream

2019-05-16 Thread Ian Good
Change by Ian Good : -- nosy: +icgood ___ Python tracker <https://bugs.python.org/issue36889> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34975] start_tls() difficult when using asyncio.start_server()

2019-05-09 Thread Ian Good
Ian Good added the comment: I added start_tls() to StreamWriter. My implementation returns a new StreamWriter that should be used from then on, but it could be adapted to modify the current writer in-place (let me know). I've added docs, an integration test, and done some additional "

Re: Conway's game of Life, just because.

2019-05-07 Thread Ian Kelly
On Tue, May 7, 2019 at 1:00 PM MRAB wrote: > > On 2019-05-07 19:29, Eli the Bearded wrote: > > In comp.lang.python, Paul Rubin wrote: > > > > Thanks for posting this. I'm learning python and am very familiar with > > this "game". > > > >> #!/usr/bin/python3 > >> from itertools import chain > >>

[issue34975] start_tls() difficult when using asyncio.start_server()

2019-05-06 Thread Ian Good
Change by Ian Good : -- keywords: +patch pull_requests: +13056 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34975> ___ ___ Python-

Re: Syntax for one-line "nonymous" functions in "declaration style"

2019-04-02 Thread Ian Kelly
On Tue, Apr 2, 2019 at 1:43 AM Alexey Muranov wrote: > > > On Mon, Apr 1, 2019 at 3:52 PM Alexey Muranov > gmail.com> > > wrote: > > > > > > I only see a superficial analogy with `super()`, but perhaps it is > > > because you did not give much details of you suggestion. > > > > No, it's because

Re: Syntax for one-line "nonymous" functions in "declaration style"

2019-04-02 Thread Ian Kelly
On Mon, Apr 1, 2019 at 3:52 PM Alexey Muranov wrote: > > I only see a superficial analogy with `super()`, but perhaps it is > because you did not give much details of you suggestion. No, it's because the analogy was not meant to be anything more than superficial. Both are constructs of syntactic

Re: Syntax for one-line "nonymous" functions in "declaration style"

2019-03-31 Thread Ian Kelly
On Sun, Mar 31, 2019 at 1:09 PM Alexey Muranov wrote: > > On dim., Mar 31, 2019 at 6:00 PM, python-list-requ...@python.org wrote: > > On Sat, Mar 30, 2019, 5:32 AM Alexey Muranov > > > > wrote: > > > >> > >> On ven., Mar 29, 2019 at 4:51 PM, python-list-requ...@python.org > >> wrote: > >> > >

Re: Syntax for one-line "nonymous" functions in "declaration style"

2019-03-30 Thread Ian Kelly
On Sat, Mar 30, 2019, 5:32 AM Alexey Muranov wrote: > > On ven., Mar 29, 2019 at 4:51 PM, python-list-requ...@python.org wrote: > > > > There could perhaps be a special case for lambda expressions such > > that, > > when they are directly assigned to a variable, Python would use the > >

  1   2   3   4   5   6   7   8   9   10   >