Anders Rundgren added the comment:
Well, I could have insisted on canonicalization of floating-point data but
that's so awkward that outlawing such data is a cleaner approach. Since the
target for JCS is security- and payment-protocols, I don't think the absence of
floating-point support
Anders Rundgren added the comment:
Using simplejson I got it to work!!!
I just wonder what you think of the solution:
import collections
import simplejson as json
from decimal import Decimal
class EnhancedDecimal(Decimal):
def __str__ (self):
return self.saved_string
def __new__
Anders Rundgren added the comment:
Bob,
I'm not sure I understand why you say that JCS requires *almost* full
normalization. Using browsers you can generate fully compliant JCS objects
using like 20 lines of javascript/webcrypto (here excluding base64 support).
No normalization step
Anders Rundgren added the comment:
The current JCS validator is only 150 lines and does both RSA and EC signatures:
https://code.google.com/p/openkeystore/source/browse/python/trunk/src/org/webpki/json/JCSValidator.py
My Java-version is much more advanced but this is quite useful anyway
Anders Rundgren added the comment:
Ethan Furman added the comment:
I am not a regular json user, but my impression is the format is
pretty basic, and we would be overloading it to try and keep numbers
with three decimal places as Decimal, and anything else as float.
Isn't json's main
Anders Rundgren added the comment:
I was actually hoping to implement the final part of this:
https://openkeystore.googlecode.com/svn/resources/trunk/docs/jcs.html#Normalization_and_Signature_Validation
It seems that the current Decimal implementation wouldn't save me anyway since
it modifies
Anders Rundgren added the comment:
It would be great if I could use a sub-classed Decimal during parsing but since
it doesn't appear to be a way to serialize the result using the json package
I'm probably stuck with the current 99% solution.
I have solved this in Java and JavaScript
New submission from Anders Rundgren:
jsonString = '{t:6,h:4.50, g:text,j:1.40e450}'
jsonObject = json.loads(jsonString,
object_pairs_hook=collections.OrderedDict,parse_float=Decimal)
for item in jsonObject:
print jsonObject[item]
6
4.50
text
1.40E+450
Works as expected.
However, there seems
On Sun, 24 Aug 2014 00:56:11 +1000
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
Despite my comments, I don't actually have any objection to people who
choose to use Emacs, or Vim, or edit their text files by poking the hard
drive platter with a magnetised needle if they prefer
My spam filter have an issue with the way mails are sent to this list. If a
mail sent to python-list is DKIM-signed, the DKIM-Signature header is kept
in the mail. Since the mangling happening during distribution to the list
changes one of the signed header fields, rather a lot of the mails to
On Thu, 31 Jul 2014 14:57:36 -0400
Terry Reedy tjre...@udel.edu wrote:
On 7/31/2014 9:38 AM, Anders Wegge Keller wrote:
My spam filter have an issue with the way mails are sent to this list.
If a mail sent to python-list is DKIM-signed, the DKIM-Signature header
is kept in the mail
. Is there a general numerics-list somewhere also? I
don't see any on https://mail.python.org/mailman/listinfo.
By the way, you guys seem to have overlooked the opportunity for arbitrage:
*Anyone* can go to a numerical list, poll for examples, and come back and earn
some beer :)
regards, Anders
Kevin Walzer k...@codebykevin.com writes:
I can only think of two widely used languages in the last decade where
there was this type of major break in binary compatibility: Perl and
Visual Basic.
Lua 5.1, 5.2 and 5.3 are all incompatible to some extent. It's
debatable how widely used Lua is
.
This is about float.__eq__, not about numpy or SciPy.
Maybe they just don't like beer?
regards, Anders
--
https://mail.python.org/mailman/listinfo/python-list
)
regards, Anders
--
https://mail.python.org/mailman/listinfo/python-list
, time stamps, NoneType's, bools,
floating-point floats and a thousand other things, then NaNs stand out as the
values that have special algorithm-breaking magic.
I gave an example of such an algorithm in an earlier reply to Chris.
regards, Anders
--
https://mail.python.org/mailman/listinfo
strategies to
avoid NaNs ever being compared. I'll take that one step further and say that as
long as NaN!=NaN, everyone should seek to avoid NaNs ever being compared.
regards, Anders
--
https://mail.python.org/mailman/listinfo/python-list
== always doing an identity test before calling __eq__ solve your
problem? If not, what would it take to solve your problem?
It would not solve it. Two bitwise identical NaNs would still compare different.
What would solve the problem is making identical NaNs compare equal.
regards, Anders
on those lists read python-list also?
regards, Anders
--
https://mail.python.org/mailman/listinfo/python-list
to
improvement of Python, well, I'm not too optimistic, but I feel the point was
worth making regardless.
regards, Anders
--
https://mail.python.org/mailman/listinfo/python-list
) that benefits from NaN!=NaN and that would
fail if x==x for all float objects x, then please come forward and
show it, and I'll buy you a beer the next time I'm at PyCon.
regards, Anders
--
https://mail.python.org/mailman/listinfo/python-list
.
regards, Anders
--
https://mail.python.org/mailman/listinfo/python-list
fully aware of that. Whether NaN's are one equivalence class or several is
not the issue. What matters is the integrity of the equivalence relation.
Following the standard isn't a good reason itself?
If a standard tells you to jump of a cliff...
regards, Anders
--
https://mail.python.org
so.
regards, Anders
--
https://mail.python.org/mailman/listinfo/python-list
Ethan Furman skrev:
What exception? Apparently your claims about NaN in Python are all wrong --
have you been using a custom interpreter?
float('inf') - float('inf')
nan
If you deliberately try to manufacture NaN's, you can. I never said otherwise.
regards, Anders
--
https://mail.python.org
with missing data. They
generally want NaN propagated and not have some long running
calculation crash in the middle.
NaN!=NaN doesn't cause NaN's to propagate any more or any less. It simply causes
a different branch of code to run, quite often the wrong one.
regards, Anders
--
https://mail.python.org
.
regards, Anders
--
https://mail.python.org/mailman/listinfo/python-list
are different in those languages, so choices the IEEE-754
committee made with C and Fortran in mind may be less relevant for Python.
regards, Anders
--
https://mail.python.org/mailman/listinfo/python-list
Shane Konings shane.koni...@gmail.com writes:
I have struggled with this for a while and know there must be a
simple method to achieve this result.
There are several. But without seeing the code you have already
written, it's har to help you improve it.
--
/Wegge
Leder efter redundant
Shane Konings shane.koni...@gmail.com writes:
...
The following is a sample of the data. There are hundreds of lines
that need to have an automated process of splitting the strings into
headings to be imported into excel with theses headings
ID Address StreetNum StreetName SufType Dir
During the final test of a bit of embedded python, I wanted to see if
I had any hanging references. To my suprise, I ended up with a rather
large amount, after running combinerefs.py. And even with the
simplest[1] possible use of embedding, I end up with 13475 still-living
references.
If this
New submission from Anders Hammarquist:
Python 2.7 HTMLParse.py lines 185-199 (similar lines still exist in Python 3.4)
match = charref.match(rawdata, i)
if match:
...
else:
if ; in rawdata[i:]: #bail
}
$
)
It's too bad re.VERBOSE isn't the default.
regards, Anders
--
http://mail.python.org/mailman/listinfo/python-list
Anders Hovmöller added the comment:
Éric Araujo: absolutely. Although I think my code can be improved (speed wise,
elegance, etc) since I just wrote it quickly a weekend :)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org
Anders Hovmöller added the comment:
I've written a parser for ISO 8601: https://github.com/boxed/iso8601
Some basic tests are included and it supports most of the standard. Haven't
gotten around to the more obscure parts like durations and intervals, but those
are trivial to add
Thanks, Oscar and Ramit! This is exactly what I was looking for.
Anders
-Original Message-
From: Oscar Benjamin [mailto:oscar.j.benja...@gmail.com]
Sent: Wednesday, November 07, 2012 6:27 PM
To: Anders Schneiderman
Cc: python-list@python.org
Subject: Re: Right solution to unicode
the tasks' subjects, one of the tasks is generating an
error:
Traceback (most recent call last):
File outlook_tasks.py, line 66, in module
my_tasks.dump_today_tasks()
File C:\Users\Anders\code\Task List\tasks.py, line 29, in
dump_today_tasks
print task.subject
UnicodeEncodeError: 'ascii' codec
Changes by Anders Kaseorg ande...@mit.edu:
--
assignee: docs@python
components: Documentation
nosy: andersk, docs@python
priority: normal
severity: normal
status: open
title: types.NoneType missing
type: behavior
versions: Python 3.2
___
Python
New submission from Anders Kaseorg ande...@mit.edu:
http://docs.python.org/py3k/library/constants.html#None says that None is the
sole value type types.NoneType. However, NoneType was removed from the types
module with Python 3.
--
___
Python
New submission from Anders Hammarquist i...@iko.pp.se:
When testing Eutaxia on PyPy (1.9) I discovered a discrepancy in the path_hooks
import hook implementation. In CPython (2.7), if the find_module() method
raises ImportError (as imp.find_module() does when it does not find a module
Anders Blomdell anders.blomd...@control.lth.se added the comment:
So my suggestion is to remove in pysql_connection_commit the call to :
pysqlite_do_all_statements(self, ACTION_RESET, 0);
to bring back the correct old behavior.
That's what I have been running for years, now...
And also
Anders Kaseorg ande...@mit.edu added the comment:
James: That’s not related to this issue. This issue is about options taking
arguments beginning with dash (such as a2x --asciidoc-opts --safe, where --safe
is the argument to --asciidoc-opts), not positional arguments beginning with
dash
Hi!
Is there anyway to communicate with JavaScript inside a website opened via the
webbrowser module?
| import webbrowser
| webbrowser.open('http://python.org')
Here I'd like to do something like webbrowser.call('alert(1)')
and I'd like to be able to call the python app from javascript too.
New submission from Anders Kaseorg ande...@mit.edu:
This feels like an arbitrary restriction (obvious sequences have been replaced
with ‘…’ to save space in this report):
zip([0], [1], [2], …, [1999])
File stdin, line 1
SyntaxError: more than 255 arguments
especially when this works:
zip
Anders Kaseorg ande...@mit.edu added the comment:
I guess the desugaring is slightly more complicated in the case where the
original function call already used *args or **kwargs:
f(arg0, …, arg999, *args, k0=v0, …, k999=v999, **kwargs)
becomes something like
f(*((arg0, …, arg999) + args
Thomas 'PointedEars' Lahn wrote:
I am getting the idea here that you mean the right thing, but that you
explain it wrong.
Feel free to write the much longer essay that explains it all unambiguously, I'm
not going to.
regards, Anders
--
http://mail.python.org/mailman/listinfo/python-list
:)
regards, Anders
--
http://mail.python.org/mailman/listinfo/python-list
Anders Kaseorg ande...@mit.edu added the comment:
@andersk: Would the restriction to only having flags with a fixed
number of arguments be acceptable for your use case?
I think that’s fine. Anyone coming from optparse won’t need options with
optional arguments.
However, FWIW, GNU
New submission from Anders Østhus grapz...@gmail.com:
Hi
I'm running Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit
(AMD64)] on win32 (Server 2008 R2).
I've discovered that when moving files with shutil.move, the file won't inherit
the security settings as it should
Anders Østhus grapz...@gmail.com added the comment:
Ok, but the whole page you linked to (http://docs.python.org/library/shutil)
confuses me then.
It states at the top:
Warning
Even the higher-level file copying functions (copy(), copy2()) can’t copy all
file metadata.
On POSIX platforms
Anders Østhus grapz...@gmail.com added the comment:
Ok.
But that makes the whole method inconsistent.
Basically, if it's on the same filesystem, rename the file, and thus not
inheriting ACL. If it's on another use copy2, and inherit ACL.
That makes no sense, atleast not to me
Anders Østhus grapz...@gmail.com added the comment:
On my system (Win Server 2008 R2 64-Bit, Python 2.7.1), when I use copy, copy2
or move(to another filesystem), the file _will_ get the ACL of the DST folder,
and remove any ACL in SRC file that the DST folder does not have.
Thus, it doesn't
Anders Østhus grapz...@gmail.com added the comment:
Thank you for taking the time to explain it to me, but it still seems
inconsistent to me.
I did a test with the functions copy, copy2, move, os.rename, copyfile, both on
the same filesystem and another filesystem, and the result is:
Same
Anders Kaseorg ande...@mit.edu added the comment:
There are some problems that ‘=’ can’t solve, such as options with nargs ≥ 2.
optparse has no trouble with this:
parser = optparse.OptionParser()
parser.add_option('-a', nargs=2)
parser.parse_args(['-a', '-first', '-second'])
(Values
Anders Kaseorg ande...@mit.edu added the comment:
That would be a good first step.
I continue to advocate making that mode the default, because it’s consistent
with how every other command line program works[1], and backwards compatible
with the current argparse behavior.
As far
Anders Kaseorg ande...@mit.edu added the comment:
(1) It's only deprecated in the documentation
Which is why I suggested un-deprecating it in the documentation. (I want to
avoid encouraging programmers to switch away from optparse until this bug is
fixed.)
# proposed behavior
parser
Anders Chrigström ander...@users.sourceforge.net added the comment:
This is indeed a duplicate of #1571184
--
resolution: - duplicate
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1571170
Hi!
When a look att py2exe homepage it is not looking like mutch happen,
as a beginner i was thinking to start with Python 3, but i like to now
if py2exe will be for 3 too.
Is any one have any info ?
--
http://mail.python.org/mailman/listinfo/python-list
You can't compile Python to exe files, but there is program packing
your script to a exe files, look att
www.py2exe.org
Beware that you must have py2exe version match your pythonversion and
att current time the highest version is 2.7.
/A
On Dec 7, 2:39 pm, Octavian Rasnita orasn...@gmail.com
Anders Blomdell anders.blomd...@control.lth.se added the comment:
The culprit seems to be 'pysqlite_do_all_statements(self, ACTION_RESET, 0)' in
pysqlite_connection_commit, which resets all active statements, but subsequent
fetch/fetchall seems to trash the sqlite3 state in the statements
New submission from Anders Blomdell anders.blomd...@control.lth.se:
With version 2.7 (and 2.7.1rc1), the following sequence (see attached test):
c = cursor.execute(' select k from t where k == ?;', (1,))
conn.commit()
r = c.fetchone()
Traceback (most recent call last):
File
Changes by Anders Sandvig anders.sand...@gmail.com:
--
nosy: +asandvig
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue809163
___
___
Python-bugs
Changes by Anders Sandvig anders.sand...@gmail.com:
--
nosy: +anders.sandvig
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8595
___
___
Python
New submission from Anders Sandvig anders.sand...@gmail.com:
From http://mail.python.org/pipermail/python-dev/2010-July/101266.html:
Consider the following code for retreieving a web page using httplib:
def get_url(hostname, port, url, timeout=5):
con = httplib.HTTPConnection
Anders Sandvig anders.sand...@gmail.com added the comment:
The best (and simplest) solution seems to be option 2).
Affected methods are found to be HTTPConnection.connect() and
HTTPSConnection.connect() in Lib/httplib.py (Lib/http/client.py for 3.x) and
FTP.connect() and FTP.ntransfercmd
Anders Sandvig anders.sand...@gmail.com added the comment:
socket.create_connection() does in fact set the timeout of the resulting socket
object, so the issue is not an issue after all.
The problems I experienced was a result of sending the timeout as the third
parameter
Changes by Anders Sandvig anders.sand...@gmail.com:
--
nosy: +anders.sandvig
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue979407
___
___
Python
Anders Kaseorg ande...@mit.edu added the comment:
I still disagree. You're giving the parser ambiguous input. If a
parser sees --foo --bar, and --foo is a valid option, but --bar
is not, this is a legitimately ambiguous situation.
There is no ambiguity. According to the way that every
Anders Kaseorg ande...@mit.edu added the comment:
arguments = *(positional-argument / option) [-- *(positional-argument)]
positional-argument = string
option = foo-option / bar-option
foo-option = --foo string
bar-option = --bar
Er, obviously positional arguments before the first
Anders Kaseorg ande...@mit.edu added the comment:
Note that the negative number heuristic you're complaining about
doesn't actually affect your code below.
Yes it does:
import argparse
parser = argparse.ArgumentParser(prog='a2x')
parser.add_argument('--asciidoc-opts',
... action
Anders Kaseorg ande...@mit.edu added the comment:
I don’t think that small change is good enough, if it is still the case that
the only provided example is the dangerous one.
It would be easy to clarify the differences between the classes:
rl = test.ReverseList('spam')
[c for c in rl]
['m
Anders Kaseorg ande...@mit.edu added the comment:
Antoine: That’s true.
Amaury: See my original bug description (“This is reasonable advice for writing
an iterator class, but terrible advice for writing a container class…”), and my
other comments.
There is nothing wrong with explaining how
New submission from Anders Kaseorg ande...@mit.edu:
Porting the a2x program to argparse from the now-deprecated optparse subtly
breaks it when certain options are passed:
$ a2x --asciidoc-opts --safe gitcli.txt
$ ./a2x.argparse --asciidoc-opts --safe gitcli.txt
usage: a2x [-h] [--version
Anders Kaseorg ande...@mit.edu added the comment:
Though in general I find argparse's default behavior more useful.
I’m not sure I understand. Why is it useful for an option parsing library to
heuristically decide, by default, that I didn’t actually want to pass in the
valid option that I
New submission from Anders Kaseorg ande...@mit.edu:
The Python tutorial offers some dangerous advice about adding iterator behavior
to a class:
http://docs.python.org/tutorial/classes.html#iterators
“By now you have probably noticed that most container objects can be looped
over using
Anders Kaseorg ande...@mit.edu added the comment:
As an experienced Python programmer I am obviously aware that the tutorial is
trying to teach how to make an iterator class, not how to make a container
class.
But the tutorial doesn’t make that *clear*. It should be much more explicit
about
New submission from Simon Anders and...@embl.de:
The class optparse.OptionParser supports a number of useful keyword arguments
to the initializer, which are not documented in the Python Standard Library
documentation, here: http://docs.python.org/library/optparse.html
This is a bit
anders musikka anders.musi...@gmail.com added the comment:
Just wanted to chip in my $.02:
Defining _XOPEN_SOURCE in the python headers causes problems for
Solaris. It also causes problems for Ubuntu Linux.
Because _XOPEN_SOURCE is defined, Python.h must included first in any
program under
New submission from Anders Blomdell anders.blomd...@control.lth.se:
While trying to get a PEP302 import hook to function properly, I found
that the default traceback picks up the wrong sourcecode for PEP302
loaded modules.
The testcase pep302_traceback.py tries to emulate the behavior
with:
file_age_in_seconds = time.time() - os.path.getmtime(filename)
Only convert to local time for presentation.
- Anders
--
http://mail.python.org/mailman/listinfo/python-list
New submission from Simon Anders sand...@fs.tum.de:
The '-3' command line option in Python 2.6 is supposed to warn whenever
encountering something that would throw an error in Python 3. Mixing of
tabs and spaces has become illegal in Python 3. However, Python 2.6,
called with '-3', passes
I intended.
Is downloading a binary file using: srcdata = urlopen(url).read()
the best way? Is there some other way that would speed up the downloading?
// Anders
--
English is not my first or second language
so any error or insult are done in the translation!
Please correct my English so I may
Tanks everyone that spent time helping my, the help was great.
Best regards Anders
--
http://mail.python.org/mailman/listinfo/python-list
hope someone understand my
beginner question
what i am looking for is somting like
if file.findInFile(LF01):
...
Is there any library like this ??
Best Regards
Anders
--
http://mail.python.org/mailman/listinfo/python-list
Anders J. Munch [EMAIL PROTECTED] added the comment:
Any thoughts to time zone/DST handling for naive datetime objects? E.g.
suppose the datetime object was created by .utcnow or .utcfromtimestamp.
For aware datetime objects, I think the time.mktime(dt.timetuple())
approach doesn't work; the tz
them out ;-)
// Anders
--
English is not my first, or second, language
so anything strange, or insulting, is due to
the translation.
Please correct me so I may improve my English!
On Tue, 14 Oct 2008 03:03:52 -0700 (PDT), MM wrote:
Hi to all,
I'm trying to import a tab separated values file
the source code of the C++?
I don't have the source code! Just the header files and the library and
dll.
Have I overlooked something or am I just screwed?
// Anders
--
English is not my first, or second, language
so anything strange, or insulting, is due to
the translation.
Please correct me so I may
Hello,
I have a C++ library compiled as Windows DLL's. It consists of 32 .h and 1
.lib and 1 .dll files. I don't have the source code.
How can I create a Python module from these files?
// Anders
--
English is not my first, or second, language
so anything strange, or insulting, is due
Changes by Anders J. Munch [EMAIL PROTECTED]:
--
nosy: +andersjm
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1759845
___
___
Python-bugs-list mailing
Changes by Anders J. Munch [EMAIL PROTECTED]:
--
nosy: +andersjm
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1220212
___
___
Python-bugs-list mailing
Anders Bensryd [EMAIL PROTECTED] added the comment:
We started using Python 2.5.2 recently and a few developers have
complained that they do not get any assertions anymore so yes, we do
use _ASSERT() and _ASSERTE(), but after a brief look it seems as if we
mainly use assert(). The developer
Anders Bensryd [EMAIL PROTECTED] added the comment:
Yes, we could do that. However, my concerns are:
1) We cannot be the only Python user that experience this issue? I
would prefer one of these solutions (in this order):
a) A parameter to Py_Initialize (structure) that controls its
behaviour
New submission from Anders Bensryd [EMAIL PROTECTED]:
We are using Windows XP SP2, Visual Studio 2005 Python 2.5.2.
In Objects/exceptions.c the following code turns off all assertions.
#if defined _MSC_VER _MSC_VER = 1400 defined(__STDC_SECURE_LIB__)
/* Set CRT argument error handler
read the rest of
the paragraph.
Of course I know what __nonzero__ does.
regards, Anders
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
On Tue, 29 Jul 2008 00:23:02 +, Steven D'Aprano wrote:
Dude. Dude. Just... learn some Python before you embarrass yourself
further.
I'm sorry Anders, that was a needlessly harsh thing for me to say. I
apologize for the unpleasant tone.
Still, __nonzero__
is simple to type, but not so simple to read. if x.namedPredicate() is
harder to type, but easier to read. I prefer the latter because code is read
more often than it is written.
regards,
Anders
--
http://mail.python.org/mailman/listinfo/python-list
Gary Herron wrote:
A = [1,2,3]
B = [4,5,6]
C = [7,8,9]
A+B+C
[1, 2, 3, 4, 5, 6, 7, 8, 9]
sum([A,B,C], [])
[1, 2, 3, 4, 5, 6, 7, 8, 9]
Careful now, this can be very slow. sum uses __add__, not __iadd__, which gives
this approach quadratic worst-case runtime.
- Anders
--
http
= []
gwl_helper(node, hwnd, result.append)
return result
- Anders
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 6 Mar 2008 20:07:46 +, Simon Brunning wrote:
This might be of use:
http://ftputil.sschwarzer.net/trac
Nice, Just what I needed!
Thank you!
// Anders
--
English is not my first, or second, language
so anything strange, or insulting, is due to
the translation.
Please correct me
Hello,
I need to list all the files on my FTP account (multiple subdirectories). I
don't have shell access to the account.
anyone that has a program that will do this?
// Anders
--
English is not my first, or second, language
so anything strange, or insulting, is due to
the translation.
Please
101 - 200 of 250 matches
Mail list logo