Re: From JoyceUlysses.txt -- words occurring exactly once

2024-05-31 Thread Pieter van Oostrum via Python-list
That is a famous Unix task : (Sorry, no Python) grep -o '\w*' JoyceUlysses.txt | sort | uniq -c | sort -n -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: A technique from a chatbot

2024-04-03 Thread Pieter van Oostrum via Python-list
uot;something_to_be_done_at_the_end_of_this_function()") -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Are Floating Point Numbers still a Can of Worms?

2022-10-23 Thread Pieter van Oostrum
t(2.718281828459045b0) - bfloat(%e); (%o10) - 2.35360287471352802147785151603b-16 Fricas: (1) -> 2.718281828459045^0.8618974796837966 (1) 2.367648_98319 (2) -> exp(0.8618974796837966) (2) 2.367649_00086 -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999

[issue47251] Merge BINARY_SUBSCR_LIST_INT with BINARY_SUBSCR_LIST_TUPLE

2022-04-07 Thread Pieter Eendebak
Change by Pieter Eendebak : -- keywords: +patch pull_requests: +30429 stage: -> patch review pull_request: https://github.com/python/cpython/pull/32404 ___ Python tracker <https://bugs.python.org/issu

[issue47251] Merge BINARY_SUBSCR_LIST_INT with BINARY_SUBSCR_LIST_TUPLE

2022-04-07 Thread Pieter Eendebak
New submission from Pieter Eendebak : The implementations of BINARY_SUBSCR_LIST_INT and BINARY_SUBSCR_TUPLE_INT are almost identical. They can be merged, so there is one opcode less and the code is shared. -- components: Interpreter Core messages: 416937 nosy: pieter.eendebak

[issue47116] Use _PyLong_FromUnsignedChar in bytearrayobject.c

2022-03-25 Thread Pieter Eendebak
Change by Pieter Eendebak : -- keywords: +patch pull_requests: +30187 stage: -> patch review pull_request: https://github.com/python/cpython/pull/32110 ___ Python tracker <https://bugs.python.org/issu

[issue47116] Use _PyLong_FromUnsignedChar in bytearrayobject.c

2022-03-25 Thread Pieter Eendebak
New submission from Pieter Eendebak : In https://github.com/python/cpython/pull/31867 the method _PyLong_FromUnsignedChar was introduced for faster conversion of byteaarray elements. We can use the method in more places -- components: Interpreter Core messages: 415991 nosy

[issue47110] Refactor bytearray strip methods

2022-03-24 Thread Pieter Eendebak
Change by Pieter Eendebak : -- keywords: +patch pull_requests: +30180 stage: -> patch review pull_request: https://github.com/python/cpython/pull/32096 ___ Python tracker <https://bugs.python.org/issu

[issue47110] Refactor bytearray strip methods

2022-03-24 Thread Pieter Eendebak
New submission from Pieter Eendebak : The bytearray strip, lstrip and rstrip methods contain a lot of duplicated code. -- components: Interpreter Core messages: 415939 nosy: pieter.eendebak priority: normal severity: normal status: open title: Refactor bytearray strip methods versions

[issue47091] Improve performance of list and tuple repeat methods

2022-03-22 Thread Pieter Eendebak
Pieter Eendebak added the comment: The special case of a repeat with n=1 does not use memcpy. An implementation with it showed no performance improvement. -- ___ Python tracker <https://bugs.python.org/issue47

[issue47091] Improve performance of list and tuple repeat methods

2022-03-22 Thread Pieter Eendebak
Change by Pieter Eendebak : -- keywords: +patch pull_requests: +30135 stage: -> patch review pull_request: https://github.com/python/cpython/pull/32045 ___ Python tracker <https://bugs.python.org/issu

[issue47091] Improve performance of list and tuple repeat methods

2022-03-22 Thread Pieter Eendebak
New submission from Pieter Eendebak : Approach is similar to https://github.com/python/cpython/pull/31856 and https://github.com/python/cpython/pull/31999 -- components: Interpreter Core messages: 415762 nosy: pieter.eendebak priority: normal severity: normal status: open title

[issue47070] Improve performance of array_inplace_repeat

2022-03-19 Thread Pieter Eendebak
Change by Pieter Eendebak : -- keywords: +patch pull_requests: +30088 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31999 ___ Python tracker <https://bugs.python.org/issu

[issue47070] Improve performance of array_inplace_repeat

2022-03-19 Thread Pieter Eendebak
New submission from Pieter Eendebak : The array_inplace_repeat is inefficient for small arrays and a high number of repeats. This can be improved by using the same approach as in https://bugs.python.org/issue47005 -- components: Interpreter Core messages: 415572 nosy: pieter.eendebak

[issue47005] Improve performance of bytes_repeat

2022-03-13 Thread Pieter Eendebak
New submission from Pieter Eendebak : The bytearray_repeat and bytearray_irepeat are inefficient for small arrays and a high number of repeats. This can be improved by using the same approach is in the corresponding bytes_repeat method. Microbenchmark: python -m pyperf timeit "b=byte

Re: jupyter console vs. ipython in Emacs

2021-12-20 Thread Pieter van Oostrum
Pieter van Oostrum writes: > My Python development environment is Emacs. I used to use 'jupyter > console --simple-prompt' (driven by Emacs comint) to do interactive > work, but it has the disadvantage that it doesn't work properly with > multiline input, including pastes. &g

jupyter console vs. ipython in Emacs

2021-12-19 Thread Pieter van Oostrum
' in Emacs does work with multiline statements. No idea why jupyter console doesn't. Is there any advantage in using jupyter console over ipython? -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: HTML extraction

2021-12-08 Thread Pieter van Oostrum
oc File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult File "src/lxml/parser.pxi", line 654, in lxml.etree._raiseParseError File "", line 1 XMLSyntaxError: Premature end of data in tag hr line 1, line 1, column 13 -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Negative subscripts

2021-11-26 Thread Pieter van Oostrum
only > alternative to use if...then...else to cater for y = 0? If you put it in a function with x and y as parameters, then both x and y are just a simple identifier inside the function. And then you can then even eliminate the if with for item in x[:len(x)-y]: -- Pieter van Oostrum www: http://

Re: Recursion on list

2021-11-04 Thread Pieter van Oostrum
ast writes: >> li = [] >> li.append(li) >> li > [[...]] > >>li[0][0][0][0] > [[...]] > > That's funny > You made a list whose only element is itself. In [1]: li = [] In [3]: li.append(li) In [4]: li[0] is li Out[4]: True -- Pieter van Oostrum

Re: Python 2.7 and 3.9

2021-02-18 Thread Pieter van Oostrum
and readability counts. :) The separator line should be '-- ' (without quotes), i.e. with a trailing space. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Jupyter notebooks to A4 (again)

2021-01-31 Thread Pieter van Oostrum
t: Find out where nbconvert expects user templates. Issue the shell command: bash-3.2$ jupyter --paths Look up the data part: ... data: /Users/pieter/Library/Jupyter ... The first one is your personal directory in my case ~/Library/Jupyter. In this directory create the directory nbconver

Re: Jupyter notebooks to A4 (again)

2021-01-28 Thread Pieter van Oostrum
Martin Schöön writes: > Hello all, > > Some years ago I asked about exporting notebooks to pdf in > A4 rather than US Letter. I got help, rather detailed > instructions from you in general and Piet von Oostrum in Who now calls himself Pieter van Oostrum, just like hi

Re: news.bbs.nz is spewing duplicates to comp.lang.python

2020-04-22 Thread Pieter van Oostrum
;head" ("Injection-Info: news.bbs.nz" -1002 nil s)) i.e. each message that contains "news.bbs.nz" in the "Injection-Info" header will be made invisible. This solved the problem for me. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Why is a generator expression called a expression?

2020-04-21 Thread Pieter van Oostrum
] ")" comprehension ::= expression comp_for The last part is the inner part (i.e. without the parentheses) of generator_expression. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Floating point problem

2020-04-21 Thread Pieter van Oostrum
ep, floating point is fun. > > That assumed top 1 bit is always there, except when it isn't. Because > denormal numbers are a thing. They don't have that implied 1 bit. Yes, for subnormal numbers the implicit bit *is* stored. They are characterized by the biased exponent being 0. So the

Re: Floating point problem

2020-04-19 Thread Pieter van Oostrum
the 0.4 followed by 6 more digits. > Anything further is, in effect, up for grabs. > Most Python implementations use 64-bit doubles (53 bits of precision). See https://docs.python.org/3.8/tutorial/floatingpoint.html -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Helping Windows first time users

2020-04-19 Thread Pieter van Oostrum
t HTML page describing the first steps to start using Python. It could mention the command line (py) to be used with a text editor (some recommendations) and IDLE. And how not to double click .py files :) -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Python launcher

2020-04-15 Thread Pieter van Oostrum
is displayed immediately after installation of in some other way is prominently displayed. I am not on Windows myself, so I am afraid I will not be of much help in this respect. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to inheret a metaclass.

2020-04-11 Thread Pieter van Oostrum
Pieter van Oostrum writes: > Your Pardon is not a class, it is a function. Class A is created by > type(cls, *args), so 'type' is the metaclass of A, and therefore also of > B. > Creation of B does not call Pardon. With a class it *does* work: In [74]: class Pardon(type):

Re: Is it possible to inheret a metaclass.

2020-04-10 Thread Pieter van Oostrum
a function as metaclass. But that seems to be part of the specification. The function result is what the 'class' becomes. You can even have it return something else. Then the 'class' wouldn't really be a class. In [65]: def meta(cls, *args): return 1 In [66]: class A(metaclass=meta): pass In [67]: A Out[67]: 1 -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: python script to give a list of prime no.

2020-04-05 Thread Pieter van Oostrum
s_prime: print(a) a = a + 2 Further optimizations are possible, for example use range(2,a/2) or even range (2, sqrt(a)). -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: dynamic import of dynamically created modules failes

2020-03-31 Thread Pieter van Oostrum
Pieter van Oostrum writes: > > The first import creates a file __pycache__ in the directory p1. That should be 'a directory __pycache__' > To remove it use rmtree(path.join(P1,'__pycache__')) > Then the second import will succeed. > -- > Pieter van Oostrum > www: http://

Re: dynamic import of dynamically created modules failes

2020-03-31 Thread Pieter van Oostrum
file __pycache__ in the directory p1. To remove it use rmtree(path.join(P1,'__pycache__')) Then the second import will succeed. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: 0x80070643 python download error

2020-03-30 Thread Pieter van Oostrum
rror appears. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: PEP Idea: Multi-get for lists/tuples and dictionaries (inspired in NumPy)

2020-03-19 Thread Pieter van Oostrum
'fal...@ibm.com'} In [38]: d['email'] Out[38]: 'fal...@ibm.com' In [39]: d[['first_name', 'last_name']] Out[39]: ['Frances', 'Allen'] The implementation of other methods, like __setitem__ and __init__, and maybe some more subtle details like exceptions, is left as an exercise for the reader. --

Re: Why is the program not printing three lines?

2020-03-19 Thread Pieter van Oostrum
'From first' is the result of the class definition. 'from second' is the result of first.second(). And first() doesn't produce any output. Your problem is probably that you think that the call first() executes all the statements in the class definition. It doesn't. That's not how Python class de

Re: Why is the program not printing three lines?

2020-03-19 Thread Pieter van Oostrum
doesn't print anything, because the print statement is not part of the class __init__ code. In [28]: first.second() >From second That's expected. In [29]: first.second() >From second Again. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Can you help me solve this?

2020-03-16 Thread Pieter van Oostrum
Pieter van Oostrum writes: > Joseph Nail writes: > >> Hello, >> I have one problem. Somehow in my function when I wrote y=x, they are the >> same variable and then it also changes age or height (which were x) in the >> main program. See more in attached fil

Re: Can you help me solve this?

2020-03-16 Thread Pieter van Oostrum
you write y = x, then they are not the same variable, but they point to (the proper Python language is they are bound to) the same object. Now if you say x.age = 20, then y.age will also be 20 (it's the same object). -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE179

Re: using classes

2020-03-13 Thread Pieter van Oostrum
rself. Your arguments are bez, ge, ins. class PKW(Fahrzeug):     def __init__(self, bez, ge, ins): -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: using classes

2020-03-12 Thread Pieter van Oostrum
econd way can be used in Python 3. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: iterate through an irregular nested list in Python

2020-03-07 Thread Pieter van Oostrum
This gives you an extra comma at the end, unfortunately. But it is the pattern for other types of processing. Or use it like this: print (','.join(str(i) for i in reclist(aList))) -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: iterate through an irregular nested list in Python

2020-03-06 Thread Pieter van Oostrum
This gives you an extra comma at the end, unfortunately. But it is the pattern for other types of processing. Or use it like this: print (','.join(str(i) for i in reclist(aList))) -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: ÿ in Unicode

2020-03-06 Thread Pieter van Oostrum
id you have a question? >> No, only a comment >> >> This buggy language is very amusing. > > What's the bug, or source of amusement? The bug is in the mental world of the OP. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: ÿ in Unicode

2020-03-06 Thread Pieter van Oostrum
>> > b'\xff\x00' >>> >>>> 'Ä¿'.encode('utf-32-le') >>> > b'\xff\x00\x00\x00' >> >>> That all looks as expected. >> Yes >> >>>Is there something about the output that puzzles you? >> No >> >>>Did you have a q

Re: iterate through an irregular nested list in Python

2020-03-06 Thread Pieter van Oostrum
This gives you an extra comma at the end, unfortunately. But it is the pattern for other types of processing. Or use it like this: print (','.join(str(i) for i in reclist(aList))) -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: iterate through an irregular nested list in Python

2020-03-06 Thread Pieter van Oostrum
This gives you an extra comma at the end, unfortunately. But it is the pattern for other types of processing. Or use it like this: print (','.join(str(i) for i in reclist(aList))) -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: ÿ in Unicode

2020-03-06 Thread Pieter van Oostrum
;>> > b'\xff\x00' >>> >>>> 'ÿ'.encode('utf-32-le') >>> > b'\xff\x00\x00\x00' >> >>> That all looks as expected. >> Yes >> >>>Is there something about the output that puzzles you? >> No >> >>>Did you have a qu

Re: How to compare in python an input value with an hashed value in mysql table?

2020-01-16 Thread Pieter van Oostrum
me with open(secretfile, 'rb') as fd: secret = fd.read() key = 'goldQ3T8-1QRD-5QBI-9F22' bkey = key.encode('ascii') h = hmac.new(secret, bkey, hashlib.sha256) print('hd (hex): ', h.hexdigest()) -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] --

Re: Help

2020-01-16 Thread Pieter van Oostrum
kiran chawan writes: > Whenever Iam trying to run this 'New latest version python software 3.8.4 > python ' but it doesn't show any install option and it say ' modify set up > ' So tell what to do sir plz help me out. There is no Python 3.8.4. -- Pieter van Oostrum

Re: How to compare in python an input value with an hashed value in mysql table?

2020-01-14 Thread Pieter van Oostrum
only works if that stored hash has been calculated in the same way from the same key. On Python 2 (which you shouldn't use) you can leave out the "key = bytes(key, 'ascii')" part. You can of course make it more sophisticated, for example by using a salt. Unless your keys are extremel

Re: Relative import cannot find .so submodule?

2020-01-13 Thread Pieter van Oostrum
import system. Are you running python 3.6? I tried this on python 3.7 and it worked, but the file is called _rtmidi.cpython-37m-darwin.so there (37 for python3.7, and the d is missing, I don't know what that indicates). -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: I need to create .odt or .rtf documents in Python3. what is the best tool to do this....

2020-01-12 Thread Pieter van Oostrum
anyone have any suggestions? > > chris https://github.com/eea/odfpy -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: looking for git with a solution - merge many pdfs to 1 pdf (no matter what language)

2020-01-08 Thread Pieter van Oostrum
alon.naj...@gmail.com writes: > hi > looking for git with a solution - merge many pdfs to 1 pdf (no matter what > language) There is a clone of pdftk on github: https://github.com/ericmason/pdftk Another possibility is mupdf: http://git.ghostscript.com/?p=mupdf.git -- Pieter van Oo

Re: name 'sys' is not defined

2019-12-30 Thread Pieter van Oostrum
s is used in the imported module, that module has to import sys. Importing it in the calling code doesn't help. So I would say this is a bug in the module. You should report the bug to its author. In the meantime you can correct your own copy at ~/opt/miniconda3/envs/py3/lib/python3.6/s

Re: urllib unqoute providing string mismatch between string found using os.walk (Python3)

2019-12-21 Thread Pieter van Oostrum
N SMALL LETTER O WITH ACUTE. In (a) it is composed of the letter o and the accent "́" (Unicode 0x301). So you would have to do Unicode normalisation before comparing. For example: In [16]: from unicodedata import normalize In [17]: a == b Out[17]: False In [18]: normalize('NFC', a)

Re: hexdump module installation error

2019-12-19 Thread Pieter van Oostrum
@USERnoMacBook-Air LibraBrowser % Could it be that your pip3 belongs to a different Python than the one above (for example a Python 3.8 or 3.6)? What is the output of 'pip3 --version' (without quotes)? -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https

Re: INHERITANCE in python3

2019-12-19 Thread Pieter van Oostrum
next time, supply a properly indented Python source, with only normal ASCII spaces, not no-break spaces, i.e. exactly like in your Python source code. > > The Username class also needs to call super(). In general, super() is > intended to be used with all classes that might be part of a m

Re: os.system vs subrocess.call

2019-11-28 Thread Pieter van Oostrum
gt; Why would you do that, splitting './Test.py' in two parts? That doesn't work. > Is there a simple way to use subprocess in this usecase? > subprocess.call(['./Test.py']) -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Global variable is undefined at the module level

2019-11-23 Thread Pieter van Oostrum
() >>> globvar Traceback (most recent call last): File "", line 1, in NameError: name 'globvar' is not defined >>> def testfunc(): ... global globvar ... globvar = 1 ... >>> globvar Traceback (most recent call last): File "", line

Re: revise "([^/]+)$" into '([^/]+)$' in a lot of files under a directory.

2019-11-18 Thread Pieter van Oostrum
Hongyi Zhao writes: > On Sun, 17 Nov 2019 20:28:55 +0100, Pieter van Oostrum wrote: > >> To be honest, I myself would use Emacs, with rgrep and wgrep to do this. > > Are these tools superior to grep? They are based on grep. But rgrep does a grep through a whole directory tre

Re: revise "([^/]+)$" into '([^/]+)$' in a lot of files under a directory.

2019-11-17 Thread Pieter van Oostrum
Pieter van Oostrum writes: > It isn't that difficult with sed, only you have to chose a different > character than / in the substitute command, one that is not present in > both texts, e.g instead of s/a/b/ use s=a=b=. > > And then the special characters " ' () [ a

Re: revise "([^/]+)$" into '([^/]+)$' in a lot of files under a directory.

2019-11-17 Thread Pieter van Oostrum
acters " ' () [ and $ must be escaped for the shell, and [ and $ also for the regexp. Then it comes down to sed -e s=\"\(\\[^/]+\)\\$\"=\'\(\[^/]+\)\$\'= file -- Pieter van Oostrum WWW: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: nonlocal fails ?

2019-11-15 Thread Pieter van Oostrum
and if it is called from Func2, it uses MyVar from Func2? If that is what you mean, that would be dynamic scope. -- Pieter van Oostrum WWW: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Funny behavior of IDLE 3.7.0

2019-11-12 Thread Pieter van Oostrum
xpression. When you remove the »f«, it becomes a normal string, where the {} don't have a special meaning. -- Pieter van Oostrum WWW: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: __instancecheck__ metaclasses, how do they work: why do I get True when I tuple, why doesn't print run?

2019-11-05 Thread Pieter van Oostrum
lass MA(type): ...: def __instancecheck__(cls, inst): ...: print ("MA", cls, inst) ...: ...: class AM(list, metaclass = MA): pass ...: class AM2(AM): pass ...: ...: am = AM2() In [9]: isinstance(am, AM) MA [] Out[9]: False -- Pieter van Oostrum WWW: http://

[issue31369] re.RegexFlag is not included in __all__

2017-09-06 Thread Pieter-Jan Briers
Pieter-Jan Briers added the comment: I suppose it may be an implementation detail, though I wouldn't be amazed that had enum existed when re was written it'd have been used instead of constant integers at the time. Though I do suppose exposing it fully would add two ways to get the flags

[issue31369] re.RegexFlag is not included in __all__

2017-09-06 Thread Pieter-Jan Briers
New submission from Pieter-Jan Briers: It exists and its flags are exported, but not the direct classes itself. This seems inconsistent to me and fixing it would make things like using static typing on it just a little bit easier. -- components: Regular Expressions messages: 301516

PyQt icon problem

2009-06-06 Thread Pieter Provoost
Hi, My application has a QSystemTrayIcon, which needs to be changed once in a while. The PNG icons are converted into a module using pyrcc4. When I run the Python script on my Windows system everything works fine, but when run it on Ubuntu or when I use py2exe, the icons are not visible (there's

Re: PyQt icon problem

2009-06-06 Thread Pieter Provoost
Correction: when using py2exe, no icon, empty space or message is visible (the app is running though). On Ubuntu, there is an empty space but messages are not displayed. 2009/6/6 Pieter Provoost pieterprovo...@gmail.com Hi, My application has a QSystemTrayIcon, which needs to be changed once

How to use a Python function that returns a double array in C++.

2008-12-03 Thread pieter
code like above, and then passing them into an array in C++, but I would prefer a more elegant way of doing it, because my return variable could have hundreds, if not thousands, of values.. Can somebody help me please. Thanks Pieter Steenekamp. -- http://mail.python.org/mailman/listinfo/python-list

call python from c - pass and return arrays/lists

2008-04-10 Thread Pieter
as this: PyArg_Parse(ret,i#, my_long); But I hacve no idea how to parse python lists to a c-array? thanks a lot, Pieter -- Pieter Cogghe Ganzendries 186 9000 Gent 0487 10 14 21 -- http://mail.python.org/mailman/listinfo/python-list

Re: call python from c - pass and return arrays/lists

2008-04-10 Thread Pieter
); } } } kind regards, Pieter -- Doorgestuurd bericht -- From: Diez B. Roggisch [EMAIL PROTECTED] To: python-list@python.org Date: Thu, 10 Apr 2008 12:23:56 +0200 Subject: Re: call python from c - pass and return arrays/lists Pieter wrote: Hi all, I'm trying to call

please help a newbie

2007-06-05 Thread Pieter Potgieter
- but have C/C++ skills. Please supply/help me with an snippet or example Thanks Pieter -- http://mail.python.org/mailman/listinfo/python-list

Please help on Binary file manipulation

2007-06-05 Thread Pieter Potgieter
- but have C/C++ skills. Please supply/help me with an snippet or example Thanks Pieter *** Disclaimer: The information contained in this communication is confidential and may be legally privileged

Re: Access to raw command line?

2007-04-27 Thread Pieter Edelman
Yes, but I want to make it less difficult for my end users, not more difficult. I think the best is to require an extra switch for the photo files, as some of the people here suggested. On Apr 26, 6:27 pm, Grant Edwards [EMAIL PROTECTED] wrote: On 2007-04-26, Pieter Edelman [EMAIL PROTECTED

Re: Access to raw command line?

2007-04-27 Thread Pieter Edelman
Of course you're right about that. I think an optional GUI or wizard- like interface (in this particular case) would be best, but I was looking for an easy fix :) Thanks for the suggestion though. On Apr 26, 5:25 pm, Michele Simionato [EMAIL PROTECTED] wrote: On Apr 26, 9:04 am, Pieter Edelman

Access to raw command line?

2007-04-26 Thread Pieter Edelman
if it is possible to obtain the raw (unexpanded) command line? Alternatively, does anybody have suggestion of how to do this in a clean way? Thanks, Pieter -- http://mail.python.org/mailman/listinfo/python-list

Re: Access to raw command line?

2007-04-26 Thread Pieter Edelman
it is (at least for now). Everybody thanks for your insights, Pieter -- http://mail.python.org/mailman/listinfo/python-list

Re: Graph Data Structures

2006-11-25 Thread Pieter Swart
, and whether you demand exact alignment or whether missing/incorrect data etc. is allowed as part of the alignment problem. HTH Pieter Swart -- http://mail.python.org/mailman/listinfo/python-list

Type discrepancy using struct.unpack

2006-10-19 Thread Pieter Rautenbach
expect type 'long' in both cases. Why is this not so? Regards Pieter Rautenbach -- http://mail.python.org/mailman/listinfo/python-list

Re: Type discrepancy using struct.unpack

2006-10-19 Thread Pieter Rautenbach
Leo Kislov wrote: Pieter Rautenbach wrote: Hallo, I have a 64 bit server with CentOS 4.3 installed, running Python. [EMAIL PROTECTED] pymsnt-0.11.2]$ uname -a Linux lutetium.mxit.co.za 2.6.9-34.ELsmp #1 SMP Thu Mar 9 06:23:23 GMT 2006 x86_64 x86_64 x86_64 GNU/Linux Consider

Re: Using graphviz to visualize trace.py output, anybody?

2005-11-05 Thread Pieter Swart
the program under test runs so I have little idea what to expect. To mangle graphs and their drawing via graphviz on multilple platforms, you might also want to try networkx combined with pygraphviz (available from networkx.lanl.gov) Cheers, Pieter -- http://mail.python.org/mailman/listinfo

POST data with 401 authentication using urllib(2)

2005-03-25 Thread Pieter Edelman
, can anybody tell what I'm dowing wrong? Any help is greatly appreciated. Pieter Edelman -- http://mail.python.org/mailman/listinfo/python-list

Re: Delete first line from file

2005-03-01 Thread Pieter Claerhout
what about the following? f = open( 'file.txt', 'r' ) lines = f.readlines() f.close() f = open( 'file.txt'.'w' ) f.write( '\n'.join( lines[1:] ) ) f.close() cheers, pieter On Tue, 1 Mar 2005 12:42:00 +, Peter Nuttall [EMAIL PROTECTED] wrote: On Tue, Mar 01, 2005 at 01:27:27PM +0100, Tor

RE: Finding a script's home directory?

2005-01-24 Thread Pieter Claerhout
The following should work: os.path.split( os.path.realpath( sys.argv[0] ) )[0] Cheers, pieter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabriel Cooper Sent: 24 January 2005 16:40 To: python-list@python.org Subject: Finding a script's home