Terry Reedy :
> On 4/8/2016 12:22 AM, Marko Rauhamaa wrote:
>> The issue is known. It has been tackled with a kind of a "garbage
>> collection" scheme:
>>
>> https://bugs.python.org/issue22448>
>
> and fixed 1 1/2 years ago.
On the surface, the garbage collection scheme looks dubious, but may
On 4/8/2016 12:22 AM, Marko Rauhamaa wrote:
Paul Rubin :
Marko Rauhamaa writes:
Guido chose a different method to implement timers for asyncio. He
decided to never remove canceled timers.
Only initially. He approved a change immediately when presented with a
concrete problem.
Oh my, th
On 4/7/2016 3:32 PM, Marko Rauhamaa wrote:
I use AVL trees to implement timers. You need to be able to insert
elements in a sorted order and remove them quickly.
Guido chose a different method to implement timers for asyncio. He
decided to never remove canceled timers.
In 3.5.1, asyncio.base_
On Fri, Apr 8, 2016 at 4:00 PM, Steven D'Aprano wrote:
> Or for that matter:
>
> a = akjhvciwfdwkejfc2qweoduycwldvqspjcwuhoqwe9fhlcjbqvcbhsiauy37wkg() + 100
> b = 100 + akjhvciwfdwkejfc2qweoduycwldvqspjcwuhoqew9fhlcjbqvcbhsiauy37wkg()
>
> How easily can you tell them apart at a glance?
Ouch! Can'
On Thu, 7 Apr 2016 05:19 pm, Marko Rauhamaa wrote:
> First, terminology disputes are pointless.
I agree! There's nothing I like more than sitting in front of a blazing open
fire (or even just a warm heater) on a cold winter's evening, drinking a
nice mug of piping hot terminology dispute. Sometim
On Fri, 8 Apr 2016 02:51 am, Peter Pearson wrote:
> Seriously, it's cute how neatly normalisation works when you're
> watching closely and using it in the circumstances for which it was
> intended, but that hardly proves that these practices won't cause much
> trouble when they're used more casual
On Fri, 8 Apr 2016 12:25 am, Jon Ribbens wrote:
> On 2016-04-07, Chris Angelico wrote:
>> Options 1 and 2 are nastily restricted. Option 3 is likely broken, as
>> exception objects carry tracebacks and such.
>
> Everything you're saying here is assuming that we must not let the
> attacker see an
On Fri, 8 Apr 2016 01:18 am, Jon Ribbens wrote:
> No, actually absolutely no modules at all are safe to import directly.
> This is because the untrusted code might alter them
Good thinking! I never even thought of that.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
Emeka writes:
> Thanks it worked when parsed with json.load. However, it needed this
> decode('utf'):
>
> data = json.loads(respData.decode('utf-8'))
So it does. The response data is bytes.
There's also a way to wrap a decoding reader between the response object
and the JSON parser (json.load in
Ian Kelly :
> On Apr 7, 2016 10:22 PM, "Marko Rauhamaa" wrote:
>> The keys are expiry times. You could use numbers or you could use
>> datetime objects.
>
> Yes, but why would you want to use both?
I was never talking about mixing key types. I was simply reacting (out
of context) to a suggestion
On Fri, Apr 8, 2016 at 2:43 PM, Rustom Mody wrote:
> No I am not clever/criminal enough to know how to write a text that is
> visually
> close to
> print "Hello World"
> but is internally closer to
> rm -rf /
>
> For me this:
> >>> Α = 1
A = 2
Α + 1 == A
> True
>
>
> is cure enoug
On Friday, April 8, 2016 at 10:13:16 AM UTC+5:30, Rustom Mody wrote:
> No I am not clever/criminal enough to know how to write a text that is
> visually
> close to
> print "Hello World"
> but is internally closer to
> rm -rf /
>
> For me this:
> >>> Α = 1
> >>> A = 2
> >>> Α + 1 == A
> True
>
On Thursday, April 7, 2016 at 10:22:18 PM UTC+5:30, Peter Pearson wrote:
> On Thu, 07 Apr 2016 11:37:50 +1000, Steven D'Aprano wrote:
> > On Thu, 7 Apr 2016 05:56 am, Thomas 'PointedEars' Lahn wrote:
> >> Rustom Mody wrote:
> >
> >>> So here are some examples to illustrate what I am saying:
> >>>
On Apr 7, 2016 10:22 PM, "Marko Rauhamaa" wrote:
>
> Ian Kelly :
>
> > On Thu, Apr 7, 2016 at 1:32 PM, Marko Rauhamaa wrote:
> >> I use AVL trees to implement timers. You need to be able to insert
> >> elements in a sorted order and remove them quickly.
> >
> > Why would AVL trees implementing ti
Paul Rubin :
> Marko Rauhamaa writes:
>> Guido chose a different method to implement timers for asyncio. He
>> decided to never remove canceled timers.
>
> Oh my, that might not end well. There are other approaches that don't
> need AVL trees and can remove cancelled timers, e.g. "timer wheels" a
Ian Kelly :
> On Thu, Apr 7, 2016 at 1:32 PM, Marko Rauhamaa wrote:
>> I use AVL trees to implement timers. You need to be able to insert
>> elements in a sorted order and remove them quickly.
>
> Why would AVL trees implementing timers ever need non-numeric keys
> though?
>
> It seems to me that
On 07/04/2016 21:56, Antoon Pardon wrote:
Op 07-04-16 om 14:22 schreef Chris Angelico:
...
There's no __cmp__ method, but you could easily craft your own
compare() function:
def compare(x, y):
"""Return a number < 0 if x < y, or > 0 if x > y"""
if x == y: return 0
return -1 if
On Thu, Apr 7, 2016 at 2:56 PM, Antoon Pardon
wrote:
> Op 07-04-16 om 14:22 schreef Chris Angelico:
>
> ...
>
>> There's no __cmp__ method, but you could easily craft your own
>> compare() function:
>>
>> def compare(x, y):
>> """Return a number < 0 if x < y, or > 0 if x > y"""
>> if x ==
On Thu, Apr 7, 2016 at 1:32 PM, Marko Rauhamaa wrote:
> Paul Rubin :
>
>> Chris Angelico writes:
>>> First off, what does it actually *mean* to have a tree with numbers
>>> and keys as strings? Are they ever equal? Are all integers deemed
>>> lower than all strings? Something else?
>>
>> If the A
On Fri, Apr 8, 2016 at 6:56 AM, Antoon Pardon
wrote:
>
> That solution will mean I will have to do about 100% more comparisons
> than previously.
Try it regardless. You'll probably find that performance is fine.
Don't prematurely optimize!
ChrisA
--
https://mail.python.org/mailman/listinfo/pyth
Marko Rauhamaa writes:
> Guido chose a different method to implement timers for asyncio. He
> decided to never remove canceled timers.
Oh my, that might not end well. There are other approaches that don't
need AVL trees and can remove cancelled timers, e.g. "timer wheels" as
used in Erlang and f
Antoon Pardon writes:
> With this method I have to traverse the two tuples almost always
> twice. Once to find out if they are equal and if not a second time to
> find out which is greater.
You are essentially describing the new internal API of comparison
operators. That's pretty much unavoidabl
Op 07-04-16 om 14:22 schreef Chris Angelico:
...
> There's no __cmp__ method, but you could easily craft your own
> compare() function:
>
> def compare(x, y):
> """Return a number < 0 if x < y, or > 0 if x > y"""
> if x == y: return 0
> return -1 if keyify(x) < keyify(y) else 1
>
>
On Fri, Apr 8, 2016 at 5:26 AM, Paul Rubin wrote:
> Chris Angelico writes:
>> First off, what does it actually *mean* to have a tree with numbers
>> and keys as strings? Are they ever equal? Are all integers deemed
>> lower than all strings? Something else?
>
> If the AVL tree's purpose is to be
Paul Rubin :
> Chris Angelico writes:
>> First off, what does it actually *mean* to have a tree with numbers
>> and keys as strings? Are they ever equal? Are all integers deemed
>> lower than all strings? Something else?
>
> If the AVL tree's purpose is to be an alternative lookup structure to
>
Chris Angelico writes:
> First off, what does it actually *mean* to have a tree with numbers
> and keys as strings? Are they ever equal? Are all integers deemed
> lower than all strings? Something else?
If the AVL tree's purpose is to be an alternative lookup structure to
Python's hash-based dict
Jussi,
Thanks it worked when parsed with json.load. However, it needed this
decode('utf'):
data = json.loads(respData.decode('utf-8'))
On Thu, Apr 7, 2016 at 6:01 AM, Jussi Piitulainen <
jussi.piitulai...@helsinki.fi> wrote:
> Emeka writes:
>
> > Hello All,
> >
> > import urllib.request
> > imp
On Thu, 07 Apr 2016 13:02:46 +0200, Frantisek.Fridrich wrote:
> Hello.
>
> I run a third party program that can use a system installation of Python.
> I have to modify environment variables:
> PYTHONPATH,
> PATH,
> LD_LIBRARY_PATH.
>
> All these environment variables are empty at the beginning
Joaquin Alzola wrote:
> Hi People
>
> I need to covert this string:
>
> hello there
> this is a test
>
> (also \n important)
>
> To this Unicode:
>
00680065006c006c006f0020002000740068006500720065000a00740068006900730020006900730020006100200074006500730074000a
> Without the \u and space.
>
On 07/04/2016 13:02, frantisek.fridr...@rubena.cgs.cz wrote:
Hello.
I run a third party program that can use a system installation of Python.
I have to modify environment variables:
PYTHONPATH,
PATH,
LD_LIBRARY_PATH.
All these environment variables are empty at the beginning but Python uses
a
On Thu, Apr 7, 2016 at 11:35 AM, Jon Ribbens
wrote:
> Well, it entirely depends on how much you're trying to allow the
> sandboxed code to do. Most of the stuff in that script (e.g.
> _copy_module and safe versions of get/set/delattr, exec, and eval)
> I don't think is really necessary for most se
On Fri, Apr 8, 2016 at 1:33 AM, Joaquin Alzola
wrote:
> hello there
> this is a test
>
> (also \n important)
>
> To this Unicode:
> 00680065006c006c006f0020002000740068006500720065000a00740068006900730020006900730020006100200074006500730074000a
> Without the \u and space.
What happens if you hav
On 2016-04-07, Chris Angelico wrote:
> On Fri, Apr 8, 2016 at 3:20 AM, Jon Ribbens
> wrote:
>> On 2016-04-07, Random832 wrote:
>>> On Thu, Apr 7, 2016, at 08:13, Jon Ribbens wrote:
> All the obvious, and even not-so-obvious, attack tools are gone:
> eval, exec, getattr, type, __import__
On Fri, Apr 8, 2016 at 3:20 AM, Jon Ribbens
wrote:
> On 2016-04-07, Random832 wrote:
>> On Thu, Apr 7, 2016, at 08:13, Jon Ribbens wrote:
>>> > All the obvious, and even not-so-obvious, attack tools are gone:
>>> > eval, exec, getattr, type, __import__.
>>
>> We don't even need to take these away
On 2016-04-07, Random832 wrote:
> On Thu, Apr 7, 2016, at 08:13, Jon Ribbens wrote:
>> > All the obvious, and even not-so-obvious, attack tools are gone:
>> > eval, exec, getattr, type, __import__.
>
> We don't even need to take these away, per se.
>
> eval and exec could be replaced with function
On Fri, Apr 8, 2016 at 2:51 AM, Peter Pearson wrote:
> The pile-of-poo character was just frosting on
> the cake.
>
> (Sorry to leave you with that image.)
No. You're not even a little bit sorry.
You're an evil, evil man. And funny.
ChrisA
who knows that its codepoint is 1F4A9 without looking i
Hi People
I need to covert this string:
hello there
this is a test
(also \n important)
To this Unicode:
00680065006c006c006f0020002000740068006500720065000a00740068006900730020006900730020006100200074006500730074000a
Without the \u and space.
https://www.branah.com/unicode-converter
I seem n
On Thu, 07 Apr 2016 11:37:50 +1000, Steven D'Aprano wrote:
> On Thu, 7 Apr 2016 05:56 am, Thomas 'PointedEars' Lahn wrote:
>> Rustom Mody wrote:
>
>>> So here are some examples to illustrate what I am saying:
>>>
>>> Example 1 -- Ligatures:
>>>
>>> Python3 gets it right
>> flag = 1
>> flag
On Fri, Apr 8, 2016 at 1:18 AM, Jon Ribbens
wrote:
> No, actually absolutely no modules at all are safe to import directly.
> This is because the untrusted code might alter them, and then the
> altered code would be used by the trusted main application. Trivial
> examples might include altering ha
On 2016-04-07, Chris Angelico wrote:
> On Thu, Apr 7, 2016 at 11:45 AM, Steven D'Aprano wrote:
>> And you would have to do something about the unfortunate matter that modules
>> have a reference to the unrestricted __builtins__:
>>
>> py> os.__builtins__['eval']
>>
>
> This *in itself* is blocke
On 7 April 2016 at 15:31, Heli wrote:
>
> Thanks a lot Oscar,
>
> The lexsort you suggested was the way to go.
Glad to hear it.
> import h5py
> import numpy as np
> f=np.loadtxt(inputFile,delimiter=None)
> xcoord=np.sort(np.unique(f[:,0]))
> ycoord=np.sort(np.unique(f[:,1]))
> zcoord=np.sort(np.
On 07/04/2016 13:05, Antoon Pardon wrote:
I am looking at my avltree module for converting it to
python3.
One of the things that trouble me here is how python3 no
longer has cmp and how things have to be of "compatible"
type in order to be comparable.
So in python2 it wasn't a problem to have a
On Thu, Apr 7, 2016, at 08:13, Jon Ribbens wrote:
> > All the obvious, and even not-so-obvious, attack tools are gone:
> > eval, exec, getattr, type, __import__.
We don't even need to take these away, per se.
eval and exec could be replaced with functions that perform the
evaluation with the same
Thanks a lot Oscar,
The lexsort you suggested was the way to go.
import h5py
import numpy as np
f=np.loadtxt(inputFile,delimiter=None)
xcoord=np.sort(np.unique(f[:,0]))
ycoord=np.sort(np.unique(f[:,1]))
zcoord=np.sort(np.unique(f[:,2]))
x=f[:,0]
y=f[:,1]
z=f[:,2]
val=f[:,3]
ind = np.lexsort(
On Thu, Apr 7, 2016, at 00:48, Steven D'Aprano wrote:
> Sure, but I'm just demonstrating that the unrestricted builtins are just
> one
> attribute lookup away. And as Chris points out, if you have (say) the os
> module, then:
>
> magic = os.sys.modules[
> ''.join(chr(i-1) for i in
> (96,
On 2016-04-07, Chris Angelico wrote:
> Options 1 and 2 are nastily restricted. Option 3 is likely broken, as
> exception objects carry tracebacks and such.
Everything you're saying here is assuming that we must not let the
attacker see any exception objects, but I don't understand why you're
assu
On Thu, Apr 7, 2016, at 04:47, Daiyue Weng wrote:
> Hi, when I read a file, the file string contains Mojibake chars at the
> beginning, the code is like,
>
> file_str = open(file_path, 'r', encoding='utf-8').read()
> print(repr(open(file_path, 'r', encoding='utf-8').read())
>
> part of the string
On 6 April 2016 at 05:08, Rustom Mody wrote:
> On Wednesday, April 6, 2016 at 4:34:11 AM UTC+5:30, Steven D'Aprano wrote:
>> On Wed, 6 Apr 2016 02:52 am, Rustom Mody wrote:
>>
>> > On Tuesday, April 5, 2016 at 9:49:58 PM UTC+5:30, Oscar Benjamin wrote:
>> >> Another possibility to improve this sit
On Thu, 7 Apr 2016 08:07 pm, Inya Ivano wrote:
> Hi,
>
> I've been having trouble with running my files:
>
>>join_paired_ends.py -f
>>/home/qiime/Documents/Aleurone/1101-Pl1-A1_S193_L001_R2_001.fastq.gz -r
>>/home/qiime/Documents/Aleurone/1101-Pl1-A1_S193_L001_R1_001.fastq.gz -o
>>/home/qiime/Do
On Thu, Apr 7, 2016 at 6:47 PM, Daiyue Weng wrote:
> Hi, when I read a file, the file string contains Mojibake chars at the
> beginning, the code is like,
>
> file_str = open(file_path, 'r', encoding='utf-8').read()
> print(repr(open(file_path, 'r', encoding='utf-8').read())
>
> part of the string
On Sun, Mar 20, 2016 at 4:55 PM, Larry Martell wrote:
> On Sun, Mar 20, 2016 at 4:47 PM, Joel Goldstick
> wrote:
>> On Sun, Mar 20, 2016 at 4:32 PM, Larry Martell
>> wrote:
>>
>>> I have a script that I run a lot - at least 10 time every day. Usually
>>> it works fine. But sometime it just stops
On Thu, Apr 7, 2016 at 10:13 PM, Jon Ribbens
wrote:
> It's true that I was using eval(), but I don't think that actually
> fundamentally changes the game. Almost exactly the same sanitisation
> method can be used to make exec() code safe. ("import" for example
> does not work because there is no "
On 6 April 2016 at 17:26, Heli wrote:
>
> Thanks for your replies. I have a question in regard with my previous
> question. I have a file that contains x,y,z and a value for that coordinate
> on each line. Here I am giving an example of the file using a numpy array
> called f.
>
> f=np.array([[
On Thu, Apr 7, 2016 at 10:05 PM, Antoon Pardon
wrote:
> I am looking at my avltree module for converting it to
> python3.
>
> One of the things that trouble me here is how python3 no
> longer has cmp and how things have to be of "compatible"
> type in order to be comparable.
>
> So in python2 it w
On 2016-04-06, Steven D'Aprano wrote:
> On Wed, 6 Apr 2016 03:48 am, Chris Angelico wrote:
>> On Wed, Apr 6, 2016 at 3:26 AM, Jon Ribbens
>> wrote:
>>> The received wisdom is that restricted code execution in Python is
>>> an insolubly hard problem, but it looks a bit like my 7-line example
>>> a
I am looking at my avltree module for converting it to
python3.
One of the things that trouble me here is how python3 no
longer has cmp and how things have to be of "compatible"
type in order to be comparable.
So in python2 it wasn't a problem to have a tree with
numbers and strings as keys. In p
Hello.
I run a third party program that can use a system installation of Python.
I have to modify environment variables:
PYTHONPATH,
PATH,
LD_LIBRARY_PATH.
All these environment variables are empty at the beginning but Python uses
a default or initial places to search for modules, libraries or
On 07/04/2016 10:25, Antoon Pardon wrote:
the index() method seems to be added in 3.5, so is deque
a subclass of Sequence in 3.5?
Yes, this http://bugs.python.org/issue23704 refers.
Use the builtin
https://docs.python.org/3/library/functions.html#issubclass to try it.
>>> issubclass(deque
Hi,
I've been having trouble with running my files:
>join_paired_ends.py -f
>/home/qiime/Documents/Aleurone/1101-Pl1-A1_S193_L001_R2_001.fastq.gz -r
>/home/qiime/Documents/Aleurone/1101-Pl1-A1_S193_L001_R1_001.fastq.gz -o
>/home/qiime/Documents/Aleurone/Joined_1101
>join_paired_ends.py: error
On 2016-04-07 11:12, Peter Otten wrote:
Antoon Pardon wrote:
Second tryal, I hope the formatting doesn't get messed up now
Playing around with the collections and collections.abc modules in
python3.4 I stumbled upon the following:
from collections.abc import Sequence
from collections impor
Daiyue Weng wrote:
> Hi, when I read a file, the file string contains Mojibake chars at the
> beginning, the code is like,
>
> file_str = open(file_path, 'r', encoding='utf-8').read()
> print(repr(open(file_path, 'r', encoding='utf-8').read())
>
> part of the string (been printing) containing Mo
Antoon Pardon wrote:
> Op 07-04-16 om 11:12 schreef Peter Otten:
>>
> from collections import deque
> from collections.abc import Sequence
> [name for name in set(dir(Sequence)) - set(dir(deque)) if not
>> name.startswith("_")]
>> ['index']
>>
>> So the index() method seems to be what
Daiyue Weng writes:
> Hi, when I read a file, the file string contains Mojibake chars at the
> beginning
You are explicitly setting an encoding to read the file; that is good,
since Python should not guess the input encoding.
The reason it's good is because the issue, of knowing the correct tex
Hi, when I read a file, the file string contains Mojibake chars at the
beginning, the code is like,
file_str = open(file_path, 'r', encoding='utf-8').read()
print(repr(open(file_path, 'r', encoding='utf-8').read())
part of the string (been printing) containing Mojibake chars is like,
'锘縶\n "na
Op 07-04-16 om 11:12 schreef Peter Otten:
>
from collections import deque
from collections.abc import Sequence
[name for name in set(dir(Sequence)) - set(dir(deque)) if not
> name.startswith("_")]
> ['index']
>
> So the index() method seems to be what is missing.
the index() method
Antoon Pardon wrote:
> Second tryal, I hope the formatting doesn't get messed up now
>
> Playing around with the collections and collections.abc modules in
> python3.4 I stumbled upon the following:
>
from collections.abc import Sequence
from collections import deque
isinstance(li
Second tryal, I hope the formatting doesn't get messed up now
Playing around with the collections and collections.abc modules in
python3.4 I stumbled upon the following:
>>> from collections.abc import Sequence
>>> from collections import deque
>>> isinstance(list(), Sequence)
True
>>> isinstance
On Thursday, April 7, 2016 at 12:20:32 PM UTC+5:30, Ethan Furman wrote:
> On 04/05/2016 01:05 PM, Thomas 'PointedEars' Lahn wrote:
>
> > | >>> from email import ID10T
>
> Thomas, as has been pointed out to you in previous threads it is not
> necessary to be rude to be heard.
>
> You are hereby
Playing around with the collections and collections.abc modules in
python3.4 I stumbled upon the following: >>> from collections.abc import
Sequence >>> from collections import deque >>> isinstance(list(),
Sequence) True >>> isinstance(deque(), Sequence) False >>> This seems
strange to me. As far a
Ethan Furman writes:
> You are hereby placed in moderation for the Python List mailing list.
Thanks for taking action to maintain a healthy community, Ethan.
--
\ “I don't know anything about music. In my line you don't have |
`\ to.” —Elvis Aaron Presley (
On 04/06/16 at 08:59pm, Joel Goldstick wrote:
> 2016-04-05 20:35 GMT-04:00 majoxd hola :
> > me podrían enviar el programa Python spyder para Windows?
> >
> This is an english language list. And besides, your question I could
> send the Python program spyder for Windows? is awfully vague
They a
On Thu, Apr 7, 2016, 7:51 AM Charles T. Smith
wrote:
> On Wed, 06 Apr 2016 20:28:47 +, Rob Gaddi wrote:
>
> > Charles T. Smith wrote:
> >
> >> I just tried to write a recursive method in python - am I right that
> local
> >> variables are only lexically local scoped, so sub-instances have the
Ian Kelly :
> Let's take a different example.
>
> class Dialog(Window):
>
> def __init__(self, parent, title, ok_callback):
> super().__init__(parent, title)
> self._ok_callback = ok_callback
> self._ok_button = Button(self, 'Ok')
> self._ok_button.bind(self._ok
Jon Ribbens writes:
>> That string decodes to "__private".
> Yes, and? ... The namespace
> I was suggesting didn't provide access to any objects which have a
> 'get()' method which would access attributes.
I see, I forgot that getattr is a function, not an object method.
Though, now you've got th
On Thu, Apr 7, 2016 at 12:30 AM, Marko Rauhamaa wrote:
> Or:
>
>When a class attribute reference (for class C, say) would yield a
>class method object, it is transformed into an instance method object
>whose __self__ attributes is C.
>https://docs.python.org/3/reference/datamodel.h
75 matches
Mail list logo