New submission from João Henrique Pimentel :
The second parameter (classinfo) of the issubclass built-in function can be a
Tuple and, starting from 3.10, it can be a Union Type as well.
The documentation states that in these cases "every entry in classinfo will be
checked", but
João Marcos added the comment:
Thanks for the replies!.
Here's the link for discussion in the Python Ideas:
https://discuss.python.org/t/adding-the-method-find-to-list/4113
--
___
Python tracker
<https://bugs.python.org/issue40
João Marcos added the comment:
This is my first issue, is this the right place to discuss enhancements?
--
components: +Library (Lib)
___
Python tracker
<https://bugs.python.org/issue40
New submission from João Marcos :
"""
PROBLEM:
When trying to search the position of an element inside a list, we should use
the `in` operator to first check if the element exists, and then use the
`index` method to obtain the index.
`in` (__contains__) runs a linear s
João Eiras added the comment:
On a related note, after inspecting the UnicodeEror C code, the exception
object keeps explicit references to 'encoding', 'object', 'start', 'end' and
'reason'. That means that if those properties are set (the C code does have
setters) then the properties stored
João Eiras added the comment:
Hi.
It's perfectly fine for classes to have their public APIs and intended uses.
But then unpickling would be the worst place to complain, specially when
running 40 parallel processes while an unhandled stacktrace appears between a
couple hundred thousand lines
New submission from João Eiras :
Hi.
When one of the processes in a multiprocessing.pool picks up a task then then
somehow crashes (and by crash I mean crashing the python process with something
like a SEGV) or is killed, the pool in the main process will notice one of the
workers died
Change by João Eiras :
--
type: -> crash
___
Python tracker
<https://bugs.python.org/issue39751>
___
___
Python-bugs-list mailing list
Unsubscrib
New submission from João Eiras :
The multiprocessing module uses pickles to send data between processes.
If a blob fails to unpickle (bad implementation of __setstate__, invalid
payload from __reduce__, random crash in __init__) when the multiprocessing
module will crash inside
New submission from João Eiras :
Given some exception `ex`, you can append data like
ex.args += (value1, value2, ...)
and then re-raise.
This is something I do in my projects to sometime propagate context when errors
are raised, e.g., stacktraces across process boundaries or blobs of text
João Eiras added the comment:
Hi.
I ask for this to be reconsidered. The "recommended" approach of using
"getLogger(__name__)" comes with some downsides.
In my projects I often have many many files (in one particularly I have
hundreds) and creating Logger object for eac
Change by João Eiras :
--
nosy: -João Eiras
___
Python tracker
<https://bugs.python.org/issue9625>
___
___
Python-bugs-list mailing list
Unsubscribe:
João Eiras added the comment:
Another workaround for who might ever need it. The benefit of this solution
comparing to a custom type is that argparse will generate the help string
properly with the choices, and this solution does workaround the place when the
bug happens:
class Choices
João Bernardo added the comment:
Don't keep your hopes up. People here don't like implementing features they
don't understand about even if they could verify elsewhere it works well.
My solution at the time was to create a decent "Condition" class based on the
original one (s
João Sebastião de Oliveira Bueno <gwid...@gmail.com> added the comment:
This discussion is fresh, so maybe it is worth asking here prior to
python-ideas:
In Python we can change any global variable, object attribute or mapping-value
with function calls. Locals and nonlocals are th
João Bernardo added the comment:
Being the OP, at that time I felt it was important to have a vars() function
that worked on __slots__ to ease something I was developing. The truth for me
is: __slots__ is not really relevant anymore. The benefits it brings are not
enough to make the feature
New submission from João Sebastião de Oliveira Bueno:
There is an specific Python behavior on object instantiation that is "expected"
but not explicit, even for avanced users:
When a custom class defines `__init__` with extra parameters, but do not
overrides `__new__`, it si
New submission from João Ferreira:
The usage that is printed by argparse with the --help argument is slightly
incorrect when using mutually exclusive groups. This happens in version 3.4.3
but did not happen in version 3.4.0.
I have this minimal example:
import argparse
p
João Guerra added the comment:
Yes.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22276
___
___
Python-bugs-list mailing list
Unsubscribe
New submission from João Guerra:
Both fnmatch and glob support the */ glob. However, pathlib does not seem to
handle this kind of globs correctly.
dir = Path(/a/directory/)
file = Path(/a/file)
print(dir.match(*/)) # True
print(file.match(*/)) # True
The / is being discarded by the match
João Bernardo added the comment:
ping?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18159
___
___
Python-bugs-list mailing list
Unsubscribe
João Bernardo added the comment:
I don't understand. There's already a way to make round return an integer:
don't pass a second argument.
If this function were to be written in Python, it would be something like:
def round(number, ndigits=0):
...
or
def round(number
João Bernardo added the comment:
Anyway, why not round(1.2) - 1.0 in the first place? Just curious.
It was the behavior on Python 2.x, but somehow when they changed the rounding
method to nearest even number this happened... I think it's too late to change
back the return type
João Bernardo added the comment:
Not really. Just consistency:
For the same reason
' foo '.strip(None)
works... To avoid special casing the function call when you already have a
variable to hold the argument.
--
___
Python tracker rep
New submission from João Bernardo:
From the docs for built-in function round:
If ndigits is omitted, it defaults to zero
(http://docs.python.org/3/library/functions.html#round)
But, the only way to get an integer from `round` is by not having the second
argument (ndigits):
round
João Bernardo added the comment:
Seems like just because I never used I don't support. Boost C++ libraries has
a wait_for_any functionality to synchronize futures. C# has a WaitAny in the
WaitHandle class (like our Condition).
Another problem is: the Condition class cannot be easily
João Bernardo added the comment:
I've been thinking about returning a list on wait_for_any, but that way you
will not be able to implement wait_for using it!
wait_for will return False on timeouts while wait_for_any will return a
list with some conditions(evaluates to True).
Also, wait_for
João Bernardo added the comment:
ping.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18078
___
___
Python-bugs-list mailing list
Unsubscribe
João Bernardo added the comment:
Charles-François's point about the algorithmic complexity is
legitimate, so I think he was actually waiting for you to amend
your patch ;)
This doesn't seems to be the actual issue as it would require a big change for
something that wasn't proven important
João Bernardo added the comment:
1) It should check all predicates.
OK. Maybe later there could be an option for customization?
2) It should return a list of ready conditions.
OK.
3) It should *not* accept a list of conditions.
The list option would be to simplify the wait method
João Bernardo added the comment:
Was the patch accepted yet? Looks good to me
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18159
João Bernardo added the comment:
(ping)
It would be nice to have the feature on 3.4.
What changes should I do to the patch? Is anyone else working on that?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18078
João Bernardo added the comment:
Overriding __getattr__ doesn't look like the best solution
Another idea would be to allow the proxy class to be selectable, but this would
require the user to do much more coding for this simple thing...
I believe a proxy should be dynamic enough to avoid
New submission from João Bernardo:
The configparser.RawConfigParser class implements some `get` methods:
get, getint, getfloat, getboolean
but if any of these get overridden on a subclass(with other arguments) or new
ones are added (e.g. getlist), there's no way a SectionProxy instance
João Bernardo added the comment:
I'm not convinced it's really useful.
It doesn't seem a lot useful until you *really* need it. I've got 2 highly
parallel programs that took advantage of this pattern.
the wait is O(C) (appending to C wait queues) and wakeup
is O(CT) (C removal from a T
João Bernardo added the comment:
BTW, I think it would be better to have wait_for_any()
return a list of ready conditions rather than a boolean.
That was the original idea until I realized `wait` and `wait_for` were just
specializations of `wait_for_any`.
This can probably be done
João Bernardo added the comment:
Here, removing a thread
from a wait queue other than the one from which it was signalled is
O(waiting threads).
To be fair, You will probably never have more than a few hundred/thousand
threads on a process. Usually you'll work under a few dozen threads
João Bernardo added the comment:
Hi,
This code is working quite well on my system, but I'm still not sure if the
behavior of multiple predicates is the one other people want. So, for the
thread start running again:
- Should it test only the predicates from the awakened Conditions an accept
João Bernardo added the comment:
I did what @Richard Oudkerk said and created the wait_for_any classmethod for
the Condition class.
Other Changes:
- I had to refactor wait and wait_for to be specializations of
wait_for_any.
- try...except on notify because the inner lock might have been
João Bernardo added the comment:
I usually have hundreds of threads waiting on a single Condition object and I
wake them with .notify_all()
Sometimes, I want a specific thread to wake from this condition and finish
their job apart from the others.
The problem is that I have 2 conditions
João Bernardo added the comment:
But it might be nice to be able to wait on multiple conditions at
once, assuming they are associated with the same lock. Maybe we could
have a static method
This could solve the waiting problem for the thread, but also may keep the
other Condition objs
João Bernardo added the comment:
It would be for waiting for several conditions associated with the
same lock, not for waiting for several locks.
A Condition uses a 2 lock mechanism:
- outer lock: one for all the waiters to access the Condition object
- inner lock: one for each waiter
João Bernardo added the comment:
Condition.wait_for_any() would create a single inner lock and add it
to the _waiters list for each of the condition variables
Now I see your point!
Could it also have one (optional) argument so I can provide this lock myself?
while expr
New submission from João Bernardo:
If users could provide an inner lock for `threading.Condition` acquire when
making a thread wait, it would allow for notifying a specific waiter.
Because of race conditions, using:
cond.notify(1)
may not wake the thread I want. Also, I may not want
New submission from João Bernardo:
This is actually a proposition for a behavior change caused by a bugfix.
I have a project dealing with a metaclass factory and the next thing in the
TODO list was to add multiple inheritance support.
For my surprise, I tried and there was no metaclass
João Bernardo jbv...@gmail.com added the comment:
Of course `nan` and `inf` are part of the syntax! The `ast.parse` function
recognize them as `Name`.
So that works:
ast.dump(ast.parse('True'))
Module(body=[Expr(value=Name(id='True', ctx=Load()))])
ast.dump(ast.parse('inf'))
Module(body
Changes by João Bernardo jbv...@gmail.com:
--
keywords: +patch
Added file: http://bugs.python.org/file26262/ast.py.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15245
João Bernardo jbv...@gmail.com added the comment:
Ellipsis in this context is `_ast.Ellipsis`, not the original one...
There's no TypeError there as `_ast.Ellipsis` is a class.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org
Changes by João Bernardo jbv...@gmail.com:
Added file: http://bugs.python.org/file26264/ast.py_with_tests.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15245
João Bernardo jbv...@gmail.com added the comment:
Just to be sure: What's a doc update? The `.rst` files are updated
automatically with the doc strings?
The adding another argument should require a:
Changed in version 3.x: Accepts a second argument
Changes by João Bernardo jbv...@gmail.com:
Added file: http://bugs.python.org/file26266/ast.py_tests_doc.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15245
João Bernardo jbv...@gmail.com added the comment:
That's what I said by `nan` and `inf` are not literals, but their
representations look like they should be.
One solution could be to add another argument to allow some extra names. Maybe
a mapping, as `eval
New submission from João Bernardo jbv...@gmail.com:
`ast.literal_eval` is very strict on names, so it seems to lack some literals
that may be result of `repr` on built-in objects.
- Obvious cases:
ast.literal_eval('...')
ast.literal_eval('Ellipsis')
both result on ValueError.
- Not so
New submission from João Bernardo jbv...@gmail.com:
Hi, I'm working on a class which implements the __contains__ method but the way
I would like it to work is by generating an object that will be evaluated later.
It'll return a custom object instead of True/False
class C:
def
João Bernardo jbv...@gmail.com added the comment:
@Georg Brandl
Oh sorry, now I see... true != True
But still, why is that the default behavior? Shouldn't it use whatever the
method returns?
--
type: enhancement - behavior
versions: +Python 3.2
Changes by João Bernardo jbv...@gmail.com:
--
type: behavior - enhancement
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13667
___
___
Python-bugs
João Bernardo jbv...@gmail.com added the comment:
I see that every other comparison operator (, , =, =, ==, !=) except for
`is` work the way I expect and is able to return anything.
e.g.
numpy.arange(5) 3
array([ True, True, True, False, False], dtype=bool)
I didn't checked the code
João Bernardo jbv...@gmail.com added the comment:
Using my poor grep abilities I found that on Objects/typeobject.c
(I replaced some declarations/error checking from the code with ...)
static int
slot_sq_contains(PyObject *self, PyObject *value) {
...
func = lookup_maybe(self
João Bernardo jbv...@gmail.com added the comment:
The problem with `not in` is because it must evaluate the result. It's not just
another operator like == and !=.
Looks like we're suffering from premature optimization and now it would break a
lot of code to make it good.
For my application
João Bernardo jbv...@gmail.com added the comment:
Oh, sorry for the full file. Yes, I only changed after
d = PyObject_GetAttrString(v, __dict__);
if (d == NULL) {
I was searching for uses of slots other than __slots__ = (a, b) and I saw a guy
saying that dicts may have
New submission from João Bernardo jbv...@gmail.com:
I just realized the builtin function `vars` can't handle custom objects without
the __dict__ attribute.
It would be nice if it worked with objects that have __slots__ to make them
look more like normal objects and to make debugging easier
João Bernardo jbv...@gmail.com added the comment:
Just for comparison, on Python 2.7.1 (x32 on Windows 7) it's possible to paste
the char (but can't use it) and a nice error is given.
u'Ң'
Unsupported characters in input
So the problem was partially solved but something might have happened
João Bernardo jbv...@gmail.com added the comment:
Just to complete my monologue:
Here's the traceback from running IDLE in cmd line.
C:\Python32\Lib\idlelibpython -i idle.py
Traceback (most recent call last):
File idle.py, line 11, in module
idlelib.PyShell.main()
File C:\Python32\Lib
New submission from João Bernardo jbv...@gmail.com:
I was playing with some unicode chars on Python 3.2 (x64 on Windows 7), but
when pasted a char bigger than 0x, IDLE crashes without any error message.
Example (works fine):
'\U000104a2'
'Ң'
But, if I try to paste the above char
João Bernardo jbv...@gmail.com added the comment:
@Ned
That looks like a bit different case. IDLE *can* print the char after you
entered the '\U' version of it.
It doesn't accept you to paste those caracters...
--
___
Python tracker rep
New submission from João Bernardo jbv...@gmail.com:
Since 2008 (as far as can remember) the Python Download page has a link to that
web page:
http://wiki.python.org/moin/Python2orPython3
I know it's been updated but it keeps saying the same thing since Python 3.0
was launched.
Basically
New submission from João Bernardo jbv...@gmail.com:
I'm having trouble subclassing the int type and I think this behavior is a
bug... (Python 3.2)
class One(int):
def __init__(self):
super().__init__(1)
one = One()
one + 2
2
one == 0
True
I know `int` objects
João Bernardo jbv...@gmail.com added the comment:
@orsenthil
My system is Ubuntu 11.04 x64. To run idle, i press the Super (windows button)
then write idle.
If I open the terminal and type idle, the problem don't appear but I have to
type the password on the terminal rather than on idle GUI
New submission from João Bernardo jbv...@gmail.com:
The getpass function is raising an error when first used on idle (Python 3.2
and 2.7.1)
The next time it'll work as expected (it echoes the data, but idle is just
for testing purposes so no problems here)
from getpass import getpass
p
João Sebastião de Oliveira Bueno gwid...@gmail.com added the comment:
I don't see this as a bug. The indices returned in both cases are exactly what
you need to feed to range, in order to get the correct indices for the provided
slice parameters.
Perceive that if for
s = slice(None, None, -2
New submission from João Bernardo jbv...@gmail.com:
With Python 3, the ** operator is supposed to do math with complex numbers, but
look what is happening:
Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on
win32
Type copyright, credits or license() for more
João Paulo Farias jpaulofar...@gmail.com added the comment:
Ok.. I was hoping for a solution that did not involve running a separate
process just for logging.
Gabriel: Yeah, I have a python application that uses threads and spawns
processes, even tho the processes it spawns have nothing
João Paulo Farias jpaulofar...@gmail.com added the comment:
I dont see the resolution for this problem yet... What should I do to not have
it happen?
--
nosy: +jpfarias
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4749
Hi.
Can someone guide me into getting this to work? It's just really
querying a DB of an Autodiscovery tool to have a bunch of updated dns
files.
(Thought I'm still building the first script steps) I was able to
successfully query the DB against a single groupid, but am failing in
passing a list
On Jan 15, 4:46 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
On Jan 15, 2:38 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
On Jan 14, 5:58 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
On Jan 12, 10:07 pm, r0g aioe@technicalbloke.com wrote:
João wrote
On Jan 15, 4:46 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
On Jan 15, 2:38 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
On Jan 14, 5:58 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
On Jan 12, 10:07 pm, r0g aioe@technicalbloke.com wrote:
João wrote
On Jan 14, 5:58 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
On Jan 12, 10:07 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
for the following data,
authentication = UID=somestring
message = 'PROBLEM severity High: OperatorX Plat1(locationY) global
Succ. : 94.47
On Jan 15, 2:38 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
On Jan 14, 5:58 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
On Jan 12, 10:07 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
for the following data,
authentication = UID=somestring
message
EDIT:
About the proxy.
That's why I'm using the '-P' in the POST call.
/usr/bin/POST -P
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 12, 10:07 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
On Jan 12, 8:05 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
Someone please?
Haven't seen your original post yet mate, usenet can be flaky like that,
might have been a good idea to quote your original post
Someone please?
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 12, 8:05 pm, r0g aioe@technicalbloke.com wrote:
João wrote:
Someone please?
Haven't seen your original post yet mate, usenet can be flaky like that,
might have been a good idea to quote your original post!
Roger.
Thanks Roger.
João wrote:
Someone please?
Hi.
I'm trying
Hi.
I'm trying to figure out how to force URLencoding in my Python 2.4.3
environment receiving data an input argument but I'm really at a loss
here.
What am I doing wrong?
#!/usr/bin/env python
import sys
from urllib import urlencode, urlopen
from urllib2 import Request
import urlparse
On Dec 10, 7:55 pm, Lie Ryan lie.1...@gmail.com wrote:
and, is there any reason why you're not using the email and
smtplib?http://docs.python.org/library/email-examples.html
Mainly because I was unaware of them :(
I just read about them and I found all the Subject, From, To classes,
but what
On Dec 10, 7:55 pm, Lie Ryan lie.1...@gmail.com wrote:
and, is there any reason why you're not using the email and
smtplib?http://docs.python.org/library/email-examples.html
Mainly because I was unaware of them :(
I just read about them and I found all the Subject, From, To classes,
but what
Lie Ryan wrote:
You can set MIME type and encoding from the MIME constructor
email.mime.Text.MIMEText(bBold Text/b, html, utf-8)
are you importing import mime or import email.mime or import
email.MIMEMultipart?
Hi Lie.
I was importing as,
'from email.mime.text import MIMEText' which was
Thanks for the output.
akean, I've installed ipython and I'm exploring it. Thanks.
Terry,
from what I've read stringIO allows us to store strings in a 'virtual'
file.
Can you please write just 2 lines exemplifying a write to and a read
from an OS level file?
MRAB, that 'mail' object should've
Thanks for the output.
akean, I've installed ipython and I'm exploring it. Thanks.
Terry,
from what I've read stringIO allows us to store strings in a 'virtual'
file.
Can you please write just 2 lines exemplifying a write to and a read
from an OS level file?
MRAB, that 'mail' object should've
I apologize for my newbiness but I'm banging my head making this work :
(
What change must I made for the tag enforcement being reflected to the
'mail' file? Am I using the WritableObject class correctly?
(I'm getting a blank 'mail' file after running the .py script)
How can I see the output run
kj wrote:
Does anyone know where I can buy the Python library reference in
printed form? (I'd rather not print the whole 1200+-page tome
myself.) I'm interested in both/either 2.6 and 3.0.
TIA!
kj
Why not download the documentation, take it to a local copy shop and
have it printed and
Lawrence D'Oliveiro wrote:
In message mailman.2140.1245996088.8015.python-l...@python.org, João
Valverde wrote:
Simple example usage case: Insert string into data structure in sorted
order if it doesn't exist, else retrieve it.
the_set = set( ... )
if str in the_set
João Valverde wrote:
Paul Rubin wrote:
João Valverde backu...@netcabo.pt writes:
Interesting, thanks. The concept is not difficult to understand but
I'm not sure it would be preferable. A copy operation should have the
same cost as a snapshot,
You mean a deep-copy
alex23 wrote:
João Valverde backu...@netcabo.pt wrote:
Currently I don't have a strong need for this.
And clearly neither has anyone else, hence the absence from the
stdlib. As others have pointed out, there are alternative approaches,
and plenty of recipes on ActiveState, which seem
Paul Rubin wrote:
a...@pythoncraft.com (Aahz) writes:
(In particular, WRT the bisect module, although insertion and deletion
are O(N), the constant factor for doing a simple memory move at C speed
swamps bytecode until N gets very large -- and we already have
collections.deque() for some
Paul Rubin wrote:
João Valverde backu...@netcabo.pt writes:
Could you clarify what you mean by immutable? As in... not mutable? As
in without supporting insertions and deletions?
Correct.
That's has the same performance as using binary search on a sorted
list. What's
João Valverde wrote:
Paul Rubin wrote:
João Valverde backu...@netcabo.pt writes:
Could you clarify what you mean by immutable? As in... not mutable? As
in without supporting insertions and deletions?
Correct.
That's has the same performance as using binary search on a sorted
list
João Valverde wrote:
Aahz wrote:
In article mailman.2170.1246042676.8015.python-l...@python.org,
=?ISO-8859-1?Q?Jo=E3o_Valverde?= backu...@netcabo.pt wrote:
Anyway, I'm *not* trying to discourage you, just explain some of the
roadblocks to acceptance that likely are why it hasn't already
Miles Kaufmann wrote:
João Valverde wrote:
To answer the question of what I need the BSTs for, without getting
into too many boring details it is to merge and sort IP blocklists,
that is, large datasets of ranges in the form of (IP address, IP
address, string). Originally I was also
Aahz wrote:
In article mailman.2139.1245994218.8015.python-l...@python.org,
Tom Reed tomree...@gmail.com wrote:
Why no trees in the standard library, if not as a built in? I searched
the archive but couldn't find a relevant discussion. Seems like a
glaring omission considering the
João Valverde wrote:
Aahz wrote:
In article mailman.2139.1245994218.8015.python-l...@python.org,
Tom Reed tomree...@gmail.com wrote:
Why no trees in the standard library, if not as a built in? I
searched the archive but couldn't find a relevant discussion. Seems
like a glaring omission
1 - 100 of 123 matches
Mail list logo