Re: Is there a way to install ALL Python packages?

2015-07-21 Thread Laura Creighton
>pip can load a list of packages.  This is used daily to build machines 
>with Python + a specified list.  It would be an interesting project for 
>someone to make, publish, and update a 'sumo' list of the most useful 
>packages that can all be loaded together.
>
>-- 
>Terry Jan Reedy

For a list of the 360 most dowloaded packages from PyPi look here:
http://pythonwheels.com/

Laura

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?]

2015-07-21 Thread Laura Creighton
In a message of Mon, 20 Jul 2015 20:30:48 -0700, Rustom Mody writes:

>BTW my boys have just mailed me their latest:
>
 九.九九
>
>9.99
>
>Can some unicode/Chinese literate person inform me whether
>that ideograph is equivalent to roman '9' or roman 'nine'?

Ah, I don't understand you.  What do you mean roman 'nine'?  a
phonetic way of saying things?  What bankers use to help prevent
forgeries? Something else?

九 is a numberal.  The numberal 9.  For absolutely certain.  But since
I don't know what you mean by 'nine' it may mean that, as well.  九 is
not restricted to any particular dialect of Chinese -- if you speak
any chinese you will know what this means.  On the other hand the
pinyan (phonetic) way to pronounce numbers can vary between dialects.

Chinese has *many* ways of writing numbers, at least 4 I know about.
See: https://en.wikipedia.org/wiki/Chinese_numerals

Laura
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Laura Creighton
In a message of Mon, 20 Jul 2015 19:49:56 -0700, ryguy7272 writes:
>I'm trying to copy some Python code from a PDF book that I'm reading.  I want 
>to test out the code, and I can copy it, but when I paste it into the Shell, 
>everything is all screwed up because of the indentation. Every time I paste in 
>any kind of code, it seems like everything is immediately left-justified, and 
>then nothing works.
>
>Any idea how to make this work easily?  Without re-typing hundreds of lines of 
>code...
>
>Thanks to all.
>-- 
>https://mail.python.org/mailman/listinfo/python-list

What I do is run my pdf file through pdftotext
https://en.wikipedia.org/wiki/Pdftotext

and get a text version of the file.  If the file is large, sometimes I
just save the code I want to convert as separate pdf files and then
convert them.  Then I paste from the result, not the pdf.

You want to give the -layout and -nopgbrk options to pdftotext.

It's not perfect, but saves a lot of work.

Make sure your pdf is writing your python code in a fixed width font
before you try this, or it will be hopeless.  If your python code is
being displayed in the book in a variable width font, you will first have
to hack your pdf to stop doing this, and then run it through the tool.

Write back if you need more help.

Laura
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-21 Thread Steven D'Aprano
On Tuesday 21 July 2015 13:58, Rick Johnson wrote:

> But even if i am wrong, the worse thing i did was mis-
> interpret his and another post. But since he still owes me
> an apology for insulting my integrity, 

Someone insulted your integrity? Poor integrity, I hope it wasn't too upset.

> i'd say we're even.
> Funny thing is, no one called for Mark to apologize... GO
> FIGURE! I guess pets get preferential treatment.

Perhaps nobody else read Mark's post. Perhaps they didn't think he insulted 
your integrity. Perhaps they thought you don't have any integrity to be 
insulted. Perhaps they thought you deserved it. Perhaps they wrote a post 
critical of Mark but suffered a fatal heart attack just before they could 
hit send. Anything is possible.

I guess we'll just never know.



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Peter Heitzer
ryguy7272  wrote:
>I'm trying to copy some Python code from a PDF book that I'm reading.  I want 
>to test out the code, and I can copy it, but when I paste it into the Shell, 
>everything is all screwed up because of the indentation. Every time I paste in 
>any kind of code, it seems like everything is immediately left-justified, and 
>then nothing works.

>Any idea how to make this work easily?  Without re-typing hundreds of lines of 
>code...
try cat >testfile , paste in and type ^D or use a graphical text editor to 
paste the code
in.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?]

2015-07-21 Thread Steven D'Aprano
On Tuesday 21 July 2015 13:30, Rustom Mody wrote:

> BTW my boys have just mailed me their latest:
> 
 九.九九
> 
> 9.99
> 
> Can some unicode/Chinese literate person inform me whether
> that ideograph is equivalent to roman '9' or roman 'nine'?
> 

I don't speak or read Chinese, so I could be completely wrong, but my 
understanding is that Chinese does not distinguish between the numeral 9 and 
the word 'nine', they are both spelled the same, 九. I think that the 
distinction you are looking for doesn't really exist in Chinese.

However, 90 would not be written as nine-zero, 九零, but as nine-ten 九十. 
Ninety-one, I believe, would be written as nine-ten-nine: 九十一.

Decimal numbers, however, copy the European usage: 91.1 = 九一.一.

See also:

https://en.wiktionary.org/wiki/%E4%B9%9D
https://en.wikipedia.org/wiki/Chinese_numerals


-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?]

2015-07-21 Thread Marko Rauhamaa
Laura Creighton :

> In a message of Mon, 20 Jul 2015 20:30:48 -0700, Rustom Mody writes:
>
>>Can some unicode/Chinese literate person inform me whether that
>>ideograph is equivalent to roman '9' or roman 'nine'?
>
> Ah, I don't understand you. What do you mean roman 'nine'? a phonetic
> way of saying things? What bankers use to help prevent forgeries?
> Something else?

This is getting deep. It is an embarrassing metamathematical fact that
numbers cannot be defined. At least, mathematicians gave up trying a
century ago.

   In mathematics, the essence of counting a set and finding a result n,
   is that it establishes a one to one correspondence (or bijection) of
   the set with the set of numbers {1, 2, ..., n}.
   https://en.wikipedia.org/wiki/Counting#Counting_in_mathematics>

Our ancestors defined the fingers (or digits) as "the set of numbers."
Modern mathematicians have managed to enhance the definition
quantitatively but not qualitatively.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?]

2015-07-21 Thread Chris Angelico
On Tue, Jul 21, 2015 at 7:10 PM, Marko Rauhamaa  wrote:
> This is getting deep. It is an embarrassing metamathematical fact that
> numbers cannot be defined. At least, mathematicians gave up trying a
> century ago.
>
>In mathematics, the essence of counting a set and finding a result n,
>is that it establishes a one to one correspondence (or bijection) of
>the set with the set of numbers {1, 2, ..., n}.
>https://en.wikipedia.org/wiki/Counting#Counting_in_mathematics>

AIUI, zero is defined as the cardinality of the empty set, one is
defined as the cardinality of the set containing the empty set, two is
defined as the cardinality of the set containing the empty set and the
set containing the set containing the empty set... which makes
mathematics the only language *more verbose* than the Shakespeare
Programming Language in its definition of fundamental constants.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?]

2015-07-21 Thread Marko Rauhamaa
Chris Angelico :

> On Tue, Jul 21, 2015 at 7:10 PM, Marko Rauhamaa  wrote:
>> This is getting deep. It is an embarrassing metamathematical fact
>> that numbers cannot be defined. At least, mathematicians gave up
>> trying a century ago.
>>
>>In mathematics, the essence of counting a set and finding a result
>>n, is that it establishes a one to one correspondence (or
>>bijection) of the set with the set of numbers {1, 2, ..., n}.
>>https://en.wikipedia.org/wiki/Counting#Counting_in_mathematics>
>
> AIUI, zero is defined as the cardinality of the empty set, one is
> defined as the cardinality of the set containing the empty set, two is
> defined as the cardinality of the set containing the empty set and the
> set containing the set containing the empty set... which makes
> mathematics the only language *more verbose* than the Shakespeare
> Programming Language in its definition of fundamental constants.

   There are two approaches to cardinality – one which compares sets
   directly using bijections and injections, and another which uses
   cardinal numbers.
   https://en.wikipedia.org/wiki/Cardinality>

The first approach is comparative, the second approach is quantitative.
You must be referring to the latter meaning (cardinality ~ cardinal
number). However:

   In mathematics, cardinal numbers, or cardinals for short, are a
   generalization of the natural numbers [...]
   https://en.wikipedia.org/wiki/Cardinal_number>

IOW, cardinal numbers assume natural numbers as a given. Thus, your
definition of natural numbers leads to a circular definition.

Frege et al tried to do the natural thing and defined natural numbers as
equivalence classes:

   0 = the set of sets with no elements
   1 = the set of sets with a single element
   2 = the set of sets with precisely two elements
   etc

Unfortunately, the natural thing leads to a contradiction and must be
abandoned.

Nowadays, mathematicians are content with working with one prototypical
chain of beads:

   0 = ∅
   1 = { 0 }
   2 = { 0, 1 }
   3 = { 0, 1, 2 }
   etc

IOW:

   0 = ∅
   σ(n) = n ∪ { n }

and forget about the true essence of numbers.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?]

2015-07-21 Thread Mark Lawrence

On 21/07/2015 10:10, Marko Rauhamaa wrote:

Laura Creighton :


In a message of Mon, 20 Jul 2015 20:30:48 -0700, Rustom Mody writes:


Can some unicode/Chinese literate person inform me whether that
ideograph is equivalent to roman '9' or roman 'nine'?


Ah, I don't understand you. What do you mean roman 'nine'? a phonetic
way of saying things? What bankers use to help prevent forgeries?
Something else?


This is getting deep. It is an embarrassing metamathematical fact that
numbers cannot be defined. At least, mathematicians gave up trying a
century ago.

In mathematics, the essence of counting a set and finding a result n,
is that it establishes a one to one correspondence (or bijection) of
the set with the set of numbers {1, 2, ..., n}.
https://en.wikipedia.org/wiki/Counting#Counting_in_mathematics>

Our ancestors defined the fingers (or digits) as "the set of numbers."
Modern mathematicians have managed to enhance the definition
quantitatively but not qualitatively.



Not all of them 
http://www.languagesandnumbers.com/how-to-count-in-paici/en/pri/


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?]

2015-07-21 Thread Steven D'Aprano
On Tuesday 21 July 2015 19:10, Marko Rauhamaa wrote:


> This is getting deep.

When things get too deep, stop digging.


> It is an embarrassing metamathematical fact that
> numbers cannot be defined. At least, mathematicians gave up trying a
> century ago.

That's not the case. It's not so much that they stopped trying (implying 
failure), but that they succeeded, for some definition of success (see 
below).

The contemporary standard approach is from Zermelo-Fraenkel set theory: 
define 0 as the empty set, and the successor to n as the union of n and the 
set containing n:

0 = {} (the empty set) 
n + 1 = n ∪ {n}

https://en.wikipedia.org/wiki/Set-theoretic_definition_of_natural_numbers


> Our ancestors defined the fingers (or digits) as "the set of numbers."
> Modern mathematicians have managed to enhance the definition
> quantitatively but not qualitatively.

So what?

This is not a problem for the use of numbers in science, engineering or 
mathematics (including computer science, which may be considered a branch of 
all three). There may be still a few holdouts who hope that Gödel is wrong 
and Russell's dream of being able to define all of mathematics in terms of 
logic can be resurrected, but everyone else has moved on, and don't consider 
it to be "an embarrassment" any more than it is an embarrassment that all of 
philosophy collapses in a heap when faced with solipsism.

We have no reason to expect that the natural numbers are anything less than 
"absolutely fundamental and irreducible" (as the Wikipedia article above 
puts it). It's remarkable that we can reduce all of mathematics to 
essentially a single axiom: the concept of the set.


-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?]

2015-07-21 Thread Marko Rauhamaa
Steven D'Aprano :

> That's not the case. It's not so much that they stopped trying (implying 
> failure), but that they succeeded, for some definition of success (see 
> below).
>
> The contemporary standard approach is from Zermelo-Fraenkel set theory: 
> define 0 as the empty set, and the successor to n as the union of n and the 
> set containing n:
>
> 0 = {} (the empty set) 
> n + 1 = n ∪ {n}

That definition barely captures the essence of what a number *is*. In
fact, there have been different formulations of natural numbers. For
example:

   0 = {}
   1 = {0}
   2 = {1}
   3 = {2}
   etc


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


We're looking for a middle python developer in Moscow

2015-07-21 Thread pavel
Hello everybody!

We're looking for a well-experienced python developer who'd like to participate 
in educational startup in Moscow, Russia. It's going to be a contractor's job 
position for 6 months with possible prolongation.  
Here is the link: http://edumate.ru

Main milestones for work completion:
 - The development of billing
 - The development of an external API for communication with partners
 - The design and development of additional tools for our clients

Requirements:
 - Python, of course (you should know what does threads, GIL, yield mean, 
you've read PEP 8 etc.)
 - you've worked with Django 1.7 at least 1 year
 - you have an experience with NoSQL storages in production (MongoDB, Redis)
 - you've worked with Sphinx/Haystack
 - you have an experience of team work development with SVN or Git (if you 
active on GitHub  - please, share your github account in your CV)
 
If you're interested, please, send your CV to us: i...@edumate.ru

Thank you!
-- 
https://mail.python.org/mailman/listinfo/python-list


Send data to asyncio coroutine

2015-07-21 Thread jcarmena
Hello, I'm trying to understand and link asyncio with ordinary coroutines. Now 
I just want to understand how to do this on asyncio:


def foo():
data = yield 8
print(data)
yield "bye"

def bar():
f = foo()
n = f.next()
print(n)
message = f.send("hello")
print(message)


What is the equivalent for coro.send("some data") in asyncio?

coro.send on an asyncio coroutine throws AssertionError: yield from wasn't used 
with future.


Thank you
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to install ALL Python packages?

2015-07-21 Thread tjohnson

On 7/20/2015 10:57 PM, ryguy7272 wrote:

I'd like to install ALL Python packages on my machine.  Even if it takes up 
4-5GB, or more, I'd like to get everything, and then use it when I need it.  
Now, I'd like to import packages, like numpy and pandas, but nothing will 
install.  I figure, if I can just install everything, I can simply use it when 
I need it, and if I don't need it, then I just won't use it.

I know R offers this as an option.  I figure Python must allow it too.

Any idea  how to grab everything?

Thanks all.

As others have stated, this is not practical with Python. If you were to 
install every single package from PyPI, you'd end up with packages like 
funny 0.1 or Barun_Heehaw, which is described as "A sample junk 
project." (No, I'm not joking.)

--
https://mail.python.org/mailman/listinfo/python-list


Re: Need Help w. Getting the Eclipse Python Add-On.

2015-07-21 Thread tjohnson

On 7/17/2015 2:22 PM, Steve Burrus wrote:

I Need immediate Help w. Getting the Eclipse Python Add-On. I looked all around 
the Eclipse website to try to get this but didn't see the add-on for this. Can 
someone please help me to find it? Thanx.

The link Jerry posted should point you in the right direction. The PyDev 
manual contains detailed instructions on how to install PyDev in 
Eclipse: http://www.pydev.org/manual_101_root.html


--
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Christian Gollwitzer

On 21.07.2015 04:55, Chris Angelico wrote:

On Tue, Jul 21, 2015 at 12:49 PM, ryguy7272  wrote:

I'm trying to copy some Python code from a PDF book that I'm reading.  I want 
to test out the code, and I can copy it, but when I paste it into the Shell, 
everything is all screwed up because of the indentation. Every time I paste in 
any kind of code, it seems like everything is immediately left-justified, and 
then nothing works.

Any idea how to make this work easily?  Without re-typing hundreds of lines of 
code...


Sounds like a flaw in the PDF - it creates indentation in some way
other than leading spaces/tabs.


PDF never uses tabs and spaces for indentation. In a PDF file, typically 
all words are placed using a drawing operator individually, the space is 
made up by your eyes when see the file. While space characters exist in 
fonts, they are practically never used. Often even inside a word there 
are breaks, because of kerning corrections. When copying the data, the 
PDF reader has to guess where the word breaks are and how the strings 
belong together. Acrobat does a good job, but fails in this special 
situation. Sometimes it even fails for a narrow running font and copies 
the string without any word breaks.


Laura's method works, because pdftotext can simulate the PDF appearance 
using spaces in the output. Maybe an OCR program with good layout could 
also be used.


Christian

--
https://mail.python.org/mailman/listinfo/python-list


Re: Send data to asyncio coroutine

2015-07-21 Thread Ian Kelly
On Tue, Jul 21, 2015 at 5:31 AM,   wrote:
> Hello, I'm trying to understand and link asyncio with ordinary coroutines. 
> Now I just want to understand how to do this on asyncio:
>
>
> def foo():
> data = yield 8
> print(data)
> yield "bye"
>
> def bar():
> f = foo()
> n = f.next()
> print(n)
> message = f.send("hello")
> print(message)
>
>
> What is the equivalent for coro.send("some data") in asyncio?

I don't know of any reason why you couldn't do it just like the above.
However, the exchange would not be asynchronous, if that is your goal.

> coro.send on an asyncio coroutine throws AssertionError: yield from wasn't 
> used with future.

So somehow a future got involved where it shouldn't have been. What
was the actual code that you tried to run?

Note that while "yield" and "yield from" look similar, they are quite
different, and you cannot send to a generator that is currently paused
at a "yield from".

If you want to emulate bidirectional communication similar to
coro.send asynchronously, I think you'll need to use Futures to
mediate, something like this (lightly tested):

@asyncio.coroutine
def foo(fut):
data, fut = yield from send_to_future(8, fut)
print("foo", data)
fut.set_result("bye")

@asyncio.coroutine
def bar():
n, fut = yield from start_coro(foo)
print("bar", n)
message = yield from send_to_future("hello", fut)
print("bar", message)

def start_coro(coro):
future = asyncio.Future()
asyncio.async(coro(future))
return future

def send_to_future(data, future):
new_future = asyncio.Future()
future.set_result((data, new_future))
return new_future
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Chris Angelico
On Tue, Jul 21, 2015 at 10:29 PM, Christian Gollwitzer  wrote:
> On 21.07.2015 04:55, Chris Angelico wrote:
>>
>> On Tue, Jul 21, 2015 at 12:49 PM, ryguy7272  wrote:
>>>
>>> I'm trying to copy some Python code from a PDF book that I'm reading.  I
>>> want to test out the code, and I can copy it, but when I paste it into the
>>> Shell, everything is all screwed up because of the indentation. Every time I
>>> paste in any kind of code, it seems like everything is immediately
>>> left-justified, and then nothing works.
>>>
>>> Any idea how to make this work easily?  Without re-typing hundreds of
>>> lines of code...
>>
>>
>> Sounds like a flaw in the PDF - it creates indentation in some way
>> other than leading spaces/tabs.
>
>
> PDF never uses tabs and spaces for indentation. In a PDF file, typically all
> words are placed using a drawing operator individually, the space is made up
> by your eyes when see the file. While space characters exist in fonts, they
> are practically never used. Often even inside a word there are breaks,
> because of kerning corrections. When copying the data, the PDF reader has to
> guess where the word breaks are and how the strings belong together. Acrobat
> does a good job, but fails in this special situation. Sometimes it even
> fails for a narrow running font and copies the string without any word
> breaks.

Ah. I've never dug into PDF's internal details, but the above
explanation completely doesn't surprise me.

Tip, to document publishers: Don't use PDF for anything containing
Python code. Thanks!

Actually, maybe don't use PDF at all. I keep having to help my Mum
deal with stupid problems with PDF documents she gets, and I'm never
sure whether the fault is with the PDF creation software, the human
operating said software, or limitations in the file format itself.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread ryguy7272
On Monday, July 20, 2015 at 10:50:09 PM UTC-4, ryguy7272 wrote:
> I'm trying to copy some Python code from a PDF book that I'm reading.  I want 
> to test out the code, and I can copy it, but when I paste it into the Shell, 
> everything is all screwed up because of the indentation. Every time I paste 
> in any kind of code, it seems like everything is immediately left-justified, 
> and then nothing works.
> 
> Any idea how to make this work easily?  Without re-typing hundreds of lines 
> of code...
> 
> Thanks to all.

Thanks for all the help everyone!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to install ALL Python packages?

2015-07-21 Thread ryguy7272
On Monday, July 20, 2015 at 10:57:47 PM UTC-4, ryguy7272 wrote:
> I'd like to install ALL Python packages on my machine.  Even if it takes up 
> 4-5GB, or more, I'd like to get everything, and then use it when I need it.  
> Now, I'd like to import packages, like numpy and pandas, but nothing will 
> install.  I figure, if I can just install everything, I can simply use it 
> when I need it, and if I don't need it, then I just won't use it.
> 
> I know R offers this as an option.  I figure Python must allow it too.
> 
> Any idea  how to grab everything?
> 
> Thanks all.

Ok, this makes sense.  Thanks for the insight everyone!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to install ALL Python packages?

2015-07-21 Thread Todd
On Tue, Jul 21, 2015 at 2:10 PM, tjohnson 
wrote:

> On 7/20/2015 10:57 PM, ryguy7272 wrote:
>
>> I'd like to install ALL Python packages on my machine.  Even if it takes
>> up 4-5GB, or more, I'd like to get everything, and then use it when I need
>> it.  Now, I'd like to import packages, like numpy and pandas, but nothing
>> will install.  I figure, if I can just install everything, I can simply use
>> it when I need it, and if I don't need it, then I just won't use it.
>>
>> I know R offers this as an option.  I figure Python must allow it too.
>>
>> Any idea  how to grab everything?
>>
>> Thanks all.
>>
>>  As others have stated, this is not practical with Python. If you were to
> install every single package from PyPI, you'd end up with packages like
> funny 0.1 or Barun_Heehaw, which is described as "A sample junk project."
> (No, I'm not joking.)
>

The latter being, literally, a "Hello world" project and nothing else.
-- 
https://mail.python.org/mailman/listinfo/python-list


Where is the c source code of the import mechanism that ignores invalid directory?

2015-07-21 Thread Shiyao Ma
Hi,

It looks to me that the import system of Python will ignore invalid
directories and cache the result in memory.

For example, the following code:
paste here: https://bpaste.net/show/b144deb42620

#!/usr/bin/env python3
import sysimport osimport shutil
sys.path.append("./test")shutil.rmtree("./test", ignore_errors=True)
try:
import fooexcept ImportError:
os.mkdir("./test")
with open("./test/foo.py", "w") as f:
f.write("print(3)")

import foo

the second import foo will fail even though it's there. This is because
when doing the first import foo, the directory .test doesn't exist, and
Python ignores that directory forever.


I am interested in the c side implementation of this "ignoring" part.


Any body help me to pinpoint the exact c source location?


Thanks.


-- 

吾輩は猫である。ホームーページはhttps://introo.me 。
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Ben Bacarisse
Christian Gollwitzer  writes:

> On 21.07.2015 04:55, Chris Angelico wrote:
>> On Tue, Jul 21, 2015 at 12:49 PM, ryguy7272  wrote:
>>> [...]   Every time I paste in any kind of code, it seems
>>> like everything is immediately left-justified, and then nothing
>>> works.

>> Sounds like a flaw in the PDF - it creates indentation in some way
>> other than leading spaces/tabs.
>
> PDF never uses tabs and spaces for indentation. In a PDF file,
> typically all words are placed using a drawing operator individually,
> the space is made up by your eyes when see the file.

It's not really a PDF issue.  It's to do with how the document is
produced.  I've just looked at a few PDF files and I have found all
three layout methods used for code: positioning, spaces and tabs.  Of
course those that use spaces may be violating some PDF rule or other,
but such files certainly exist in the wild.


-- 
Ben.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Where is the c source code of the import mechanism that ignores invalid directory?

2015-07-21 Thread Mark Lawrence

On 21/07/2015 16:35, Shiyao Ma wrote:

Hi,

It looks to me that the import system of Python will ignore invalid
directories and cache the result in memory.

For example, the following code:
paste here: https://bpaste.net/show/b144deb42620

#!/usr/bin/env python3

import  sys
import  os
import  shutil

sys.path.append("./test")
shutil.rmtree("./test",  ignore_errors=True)

try:
 import  foo
except  ImportError:
 os.mkdir("./test")
 with  open("./test/foo.py",  "w")  as  f:
 f.write("print(3)")

 import  foo

the second import foo will fail even though it's there. This is because
when doing the first import foo, the directory .test doesn't exist, and
Python ignores that directory forever.


I am interested in the c side implementation of this "ignoring" part.


Any body help me to pinpoint the exact c source location?

Thanks.

--

吾輩は猫である。ホームーページはhttps://introo.me 。



Start here https://hg.python.org/cpython/file/6629773fef63/Python/import.c

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Where is the c source code of the import mechanism that ignores invalid directory?

2015-07-21 Thread Shiyao Ma
Yep. I followed from bltmodule.c(the import function) and got to the
import.c file, and finally got lost.


Regards.

On Tue, Jul 21, 2015 at 12:16 PM, Mark Lawrence 
wrote:

> On 21/07/2015 16:35, Shiyao Ma wrote:
>
>> Hi,
>>
>> It looks to me that the import system of Python will ignore invalid
>> directories and cache the result in memory.
>>
>> For example, the following code:
>> paste here: https://bpaste.net/show/b144deb42620
>>
>> #!/usr/bin/env python3
>>
>> import  sys
>> import  os
>> import  shutil
>>
>> sys.path.append("./test")
>> shutil.rmtree("./test",  ignore_errors=True)
>>
>> try:
>>  import  foo
>> except  ImportError:
>>  os.mkdir("./test")
>>  with  open("./test/foo.py",  "w")  as  f:
>>  f.write("print(3)")
>>
>>  import  foo
>>
>> the second import foo will fail even though it's there. This is because
>> when doing the first import foo, the directory .test doesn't exist, and
>> Python ignores that directory forever.
>>
>>
>> I am interested in the c side implementation of this "ignoring" part.
>>
>>
>> Any body help me to pinpoint the exact c source location?
>>
>> Thanks.
>>
>> --
>>
>> 吾輩は猫である。ホームーページはhttps://introo.me 。
>>
>>
> Start here https://hg.python.org/cpython/file/6629773fef63/Python/import.c
>
> --
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
>
> Mark Lawrence
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 

吾輩は猫である。ホームーページはhttps://introo.me 。
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Where is the c source code of the import mechanism that ignores invalid directory?

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 2:44 AM, Shiyao Ma  wrote:
> Yep. I followed from bltmodule.c(the import function) and got to the
> import.c file, and finally got lost.
>

What version of CPython are you looking at? If it's a sufficiently
recent version, you may want to look at importlib instead.

https://docs.python.org/3/library/importlib.html

That'll be a LOT easier to work through.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Oscar Benjamin
On Tue, 21 Jul 2015 at 17:16 Ben Bacarisse  wrote:

> Christian Gollwitzer  writes:
>
> > On 21.07.2015 04:55, Chris Angelico wrote:
>
>> Sounds like a flaw in the PDF - it creates indentation in some way
> >> other than leading spaces/tabs.
> >
> > PDF never uses tabs and spaces for indentation. In a PDF file,
> > typically all words are placed using a drawing operator individually,
> > the space is made up by your eyes when see the file.
>
> It's not really a PDF issue.  It's to do with how the document is
> produced.  I've just looked at a few PDF files and I have found all
> three layout methods used for code: positioning, spaces and tabs.  Of
> course those that use spaces may be violating some PDF rule or other,
> but such files certainly exist in the wild.
>

They're not violating any PDF rule. PDF as a format was not designed with
this kind of usage in mind. The idea of a PDF is that contains as much
information as is required to unambiguously represent the *appearance* of a
document. It's really a vectorised image format (like SVG) but with a few
extra document-like features (e.g. pages).

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Integers with leading zeroes

2015-07-21 Thread Antoon Pardon
On 07/19/2015 07:39 AM, Steven D'Aprano wrote:
> In Python 2, integer literals with leading zeroes are treated as octal, so
> 09 is a syntax error and 010 is 8.
> 
> This is confusing to those not raised on C-style octal literals, so in
> Python 3 leading zeroes are prohibited in int literals. Octal is instead
> written using the prefix 0o, similar to hex 0x and binary 0b.
> 
> Consequently Python 3 makes both 09 and 010 a syntax error.
> 
> However there is one exception: zero itself is allowed any number of leading
> zeroes, so 0 is a legal way to write zero as a base-10 int literal.
> 
> Does anyone use that (mis)feature?
> 

Yes. I like to sometime write numbers with leading zeros.
Sometimes these numbers represent codeblocks of a fixed
number of digits. Always writing those numbers with this
number of digits helps being aware of this. It is also
easier for when you need to know how many leading zero's
such a number has.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Laura Creighton
In a message of Wed, 22 Jul 2015 00:48:06 +1000, Chris Angelico writes:
>Actually, maybe don't use PDF at all. I keep having to help my Mum
>deal with stupid problems with PDF documents she gets, and I'm never
>sure whether the fault is with the PDF creation software, the human
>operating said software, or limitations in the file format itself.
>
>ChrisA

Lots of the problems are with the free reader, adobe acrobat.  It is
designed so that the user is kept very much in a straight-jacket which
is a problem when your Mum needs, for instance, things to be in 36 point
for her to be able to read things at all because she is nearly blind.

Laura

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proposed keyword to transfer control to another function

2015-07-21 Thread Antoon Pardon
On 07/19/2015 02:21 AM, Chris Angelico wrote:
> On Sun, Jul 19, 2015 at 9:32 AM, Gregory Ewing
>  wrote:

>> Personally I'd be fine with your initial syntax, but
>> something else might be needed to get it past Guido.
>> He didn't like my 'cocall f()' construct in PEP 3152,
>> which is syntactically isomorphic to 'transfer f()'.
> 
> Maybe it should get written up and rejected, then, to be something to
> point to any time anyone advocates TCO.

Those who remember the history of pep 308 will not find
that a strong deterrent.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proposed keyword to transfer control to another function

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 3:33 AM, Antoon Pardon
 wrote:
> On 07/19/2015 02:21 AM, Chris Angelico wrote:
>> On Sun, Jul 19, 2015 at 9:32 AM, Gregory Ewing
>>  wrote:
>
>>> Personally I'd be fine with your initial syntax, but
>>> something else might be needed to get it past Guido.
>>> He didn't like my 'cocall f()' construct in PEP 3152,
>>> which is syntactically isomorphic to 'transfer f()'.
>>
>> Maybe it should get written up and rejected, then, to be something to
>> point to any time anyone advocates TCO.
>
> Those who remember the history of pep 308 will not find
> that a strong deterrent.

It doesn't have to be a deterrent. It just has to say "Here's all the
arguments we came up with in 2015, so find answers to those if you
want to reopen the debate". It's effectively a way of rapidly
onboarding the conclusions from a lengthy discussion, much more easily
than pointing someone to the archive and expecting him/her to read
through it all.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Noob in Python. Problem with fairly simple test case

2015-07-21 Thread Jason P.
El miércoles, 15 de julio de 2015, 14:12:08 (UTC+2), Chris Angelico  escribió:
> On Wed, Jul 15, 2015 at 9:44 PM, Jason P.  wrote:
> > I can't understand very well what's happening. It seems that the main 
> > thread gets blocked listening to the web server. My intent was to spawn 
> > another process for the server independent of the test. Obviously I'm doing 
> > something wrong. I've made several guesses commenting pieces of code 
> > (tearDown method for example) but I didn't manage to solve the problem(s).
> >
> 
> When you find yourself making guesses to try to figure out what's
> going on, here are two general tips:
> 
> 1) Cut out as many pieces as you can. Test one small thing at a time.
> 2) If In Doubt, Print It Out! Stick print() calls into the code at key
> places, displaying the values of parameters or the results of
> intermediate calculations - or just saying "Hi, I'm still here and I'm
> running!".
> 
> For #1, I would recommend first just trying to get the web service
> going. Can you connect (using an external program) on port 8000 and
> receive a text/plain HTTP response saying "Hello World!"? Never mind
> about the test for the moment.
> 
> And for #2, judicious placement of console output will help you figure
> out things you're not sure about. For instance, you're suspecting that
> the main thread is getting blocked handling the web server. Easy way
> to check:
> 
> def setUp(self):
> # Start the forecast server
> self.server = ForecastServer()
> self.server.start(webservice.app)
> 
> Just before you construct the server, print something out. After
> you've constructed it but before you call start(), print something
> out. And after starting it, print something out. Then run the program.
> If you see the first line and no other, then it's blocking during the
> construction. Other deductions I'm sure you can figure out.
> 
> One small point: Probe even things that you think are trivial. In the
> above example, I cannot see any reason why constructing
> ForecastServer() could possibly block, because its init does nothing
> but set a flag. But you can get surprised by things sometimes - maybe
> the problem is actually that you're not running the code you think you
> are, but there's some other ForecastServer kicking in, and it's
> synchronous rather than subprocess-based.
> 
> End-to-end testing is all very well, but when something goes wrong,
> the key is to break the program down into smaller parts. Otherwise,
> all you have is "it doesn't work", which is one of the most useless
> error reports ever. If someone comes to python-list saying "it doesn't
> work", we'll be asking him/her to give a lot more details; if your
> aunt asks you for help printing out a document because "it doesn't
> work", you'll probably have to go over and watch her attempt it; and
> it's the same with your test cases - you make them tell you more
> details.
> 
> Hope that helps! The techniques I'm offering are completely
> problem-independent, and even language-independent. IIDPIO debugging
> works in anything that gives you a console, which is pretty much
> everything - maybe it won't be print() but logging.debug(), but the
> same technique works.
> 
> ChrisA


Thanks for your comments Chris.

I've come back to the problem today after a few days on trip. Fortunately 
someone in other mailing list pointed me that the join method was hanging the 
main thread. Without this inconvenience I can focus on the exercise's main goal.

Despite the impression that surely I gave, I'm quite familiar with programming 
and general bug hunting rules. The problem is that I'm inexperienced with 
Python and the subtle details of multiple threads ;)

Thanks!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Noob in Python. Problem with fairly simple test case

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 3:38 AM, Jason P.  wrote:
> Despite the impression that surely I gave, I'm quite familiar with 
> programming and general bug hunting rules. The problem is that I'm 
> inexperienced with Python and the subtle details of multiple threads ;)
>

Heh, it doesn't hurt to remind people of basic debugging techniques
sometimes. Worst case, you come back and say "Yep, I tried that, and
here's the result". Best case, someone else (who doesn't know what you
know) will come along with a superficially similar problem, will see
the suggested technique, and even if the actual issue is quite
different, will be better able to diagnose it.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Integers with leading zeroes

2015-07-21 Thread sohcahtoa82
On Tuesday, July 21, 2015 at 10:22:44 AM UTC-7, Antoon Pardon wrote:
> On 07/19/2015 07:39 AM, Steven D'Aprano wrote:
> > In Python 2, integer literals with leading zeroes are treated as octal, so
> > 09 is a syntax error and 010 is 8.
> > 
> > This is confusing to those not raised on C-style octal literals, so in
> > Python 3 leading zeroes are prohibited in int literals. Octal is instead
> > written using the prefix 0o, similar to hex 0x and binary 0b.
> > 
> > Consequently Python 3 makes both 09 and 010 a syntax error.
> > 
> > However there is one exception: zero itself is allowed any number of leading
> > zeroes, so 0 is a legal way to write zero as a base-10 int literal.
> > 
> > Does anyone use that (mis)feature?
> > 
> 
> Yes. I like to sometime write numbers with leading zeros.
> Sometimes these numbers represent codeblocks of a fixed
> number of digits. Always writing those numbers with this
> number of digits helps being aware of this. It is also
> easier for when you need to know how many leading zero's
> such a number has.

IMO, leading zeroes just looks like visual noise, and if I wanted to align 
numbers, I'd just use spaces.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Integers with leading zeroes

2015-07-21 Thread Emile van Sebille

On 7/21/2015 10:58 AM, sohcahto...@gmail.com wrote:


IMO, leading zeroes just looks like visual noise, and if I wanted to align 
numbers, I'd just use spaces.



Aligning numbers using spaces doesn't always align -- using zeros does.

Emile

--
https://mail.python.org/mailman/listinfo/python-list


Re: Integers with leading zeroes

2015-07-21 Thread sohcahtoa82
On Tuesday, July 21, 2015 at 11:07:43 AM UTC-7, Emile van Sebille wrote:
> On 7/21/2015 10:58 AM, sohcahto...@gmail.com wrote:
> >
> > IMO, leading zeroes just looks like visual noise, and if I wanted to align 
> > numbers, I'd just use spaces.
> >
> 
> Aligning numbers using spaces doesn't always align -- using zeros does.
> 
> Emile

You've got me confused.  They should align just fine if you're using a 
fixed-width font.

If you're not using a fixed-width font in your programming, then I don't know 
what to say to you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Integers with leading zeroes

2015-07-21 Thread sohcahtoa82
On Tuesday, July 21, 2015 at 11:38:53 AM UTC-7, sohca...@gmail.com wrote:
> On Tuesday, July 21, 2015 at 11:07:43 AM UTC-7, Emile van Sebille wrote:
> > On 7/21/2015 10:58 AM, sohcahto...@gmail.com wrote:
> > >
> > > IMO, leading zeroes just looks like visual noise, and if I wanted to 
> > > align numbers, I'd just use spaces.
> > >
> > 
> > Aligning numbers using spaces doesn't always align -- using zeros does.
> > 
> > Emile
> 
> You've got me confused.  They should align just fine if you're using a 
> fixed-width font.
> 
> If you're not using a fixed-width font in your programming, then I don't know 
> what to say to you.

I should probably state that I may use leading zeroes when using hexadecimal 
numbers.  For example, I might write 0x000ABCDE, rather than 0xABCDE, but 
that's only if I'm using a lot of 32-bit values.  If I only care about a single 
byte, I will use 0x01, for example.

But for base-10, I would never use leading zeroes.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Grant Edwards
On 2015-07-21, Laura Creighton  wrote:

> Lots of the problems are with the free reader, adobe acrobat.  It is
> designed so that the user is kept very much in a straight-jacket which
> is a problem when your Mum needs, for instance, things to be in 36 point
> for her to be able to read things at all because she is nearly blind.

That's not a problem with acrobat. That's not even a "problem" with
PDF itself, it's the whole _intent_ of PDF: to specify _exactly_ what
the document should look like and not allow the reader to muck up the
formatting, fonts, colors, alignment, page size, etc.  It's supposed
to mimic as closely as possible ink on paper: PDF is for when you want
the document to look exactly like you want it to look everwhere and
for everybody.

If you want the reader to be able to change the layout, fonts/sizes,
colors, alignments, page dimensions, etc, then PDF is just plain the
wrong format.  Complaining about a PDF reader not being able to change
the appearance of PDF documents is like complaining that glue is
sticky, oil is slippery, and knives have sharp edges.

-- 
Grant Edwards   grant.b.edwardsYow! Make me look like
  at   LINDA RONSTADT again!!
  gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Mark Lawrence

On 21/07/2015 18:25, Laura Creighton wrote:

In a message of Wed, 22 Jul 2015 00:48:06 +1000, Chris Angelico writes:

Actually, maybe don't use PDF at all. I keep having to help my Mum
deal with stupid problems with PDF documents she gets, and I'm never
sure whether the fault is with the PDF creation software, the human
operating said software, or limitations in the file format itself.

ChrisA


Lots of the problems are with the free reader, adobe acrobat.  It is
designed so that the user is kept very much in a straight-jacket which
is a problem when your Mum needs, for instance, things to be in 36 point
for her to be able to read things at all because she is nearly blind.

Laura



All I know is that I read a review about Foxit Reader 
https://www.foxitsoftware.com/products/pdf-reader/ and I've never looked 
back.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Grant Edwards
On 2015-07-21, Mark Lawrence  wrote:
> On 21/07/2015 18:25, Laura Creighton wrote:
>
>> Lots of the problems are with the free reader, adobe acrobat.  It is
>> designed so that the user is kept very much in a straight-jacket which
>> is a problem when your Mum needs, for instance, things to be in 36 point
>> for her to be able to read things at all because she is nearly blind.

> All I know is that I read a review about Foxit Reader 
> https://www.foxitsoftware.com/products/pdf-reader/ and I've never
> looked back.

I'd have serious doubts about anybody who brags that their product has
a "Microsoft Offic 2013 Style Ribbon Toolbar". ;)

But, it apears foxit reader is Windows-only so it's a moot point for
Linux/Unix/Mac users.

-- 
Grant Edwards   grant.b.edwardsYow! Hey, wait
  at   a minute!!  I want a
  gmail.comdivorce!! ... you're not
   Clint Eastwood!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Mark Lawrence

On 21/07/2015 21:32, Grant Edwards wrote:

On 2015-07-21, Mark Lawrence  wrote:

On 21/07/2015 18:25, Laura Creighton wrote:


Lots of the problems are with the free reader, adobe acrobat.  It is
designed so that the user is kept very much in a straight-jacket which
is a problem when your Mum needs, for instance, things to be in 36 point
for her to be able to read things at all because she is nearly blind.



All I know is that I read a review about Foxit Reader
https://www.foxitsoftware.com/products/pdf-reader/ and I've never
looked back.


I'd have serious doubts about anybody who brags that their product has
a "Microsoft Offic 2013 Style Ribbon Toolbar". ;)

But, it apears foxit reader is Windows-only so it's a moot point for
Linux/Unix/Mac users.



Who cares provided you can get a VMS version :)

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Emile van Sebille

On 7/21/2015 1:32 PM, Grant Edwards wrote:


But, it apears foxit reader is Windows-only so it's a moot point for
Linux/Unix/Mac users.



I've been happy with https://wiki.gnome.org/Apps/Evince on linux.

Emile

--
https://mail.python.org/mailman/listinfo/python-list


Python Schduling

2015-07-21 Thread Madduri Anil kumar
Hello Experts,

I am new to Python Programming.I have to work on Python.
I have a requirement to scheduling the script for every one hour.
could you please let me know which packages will be more helpful for Scheduling.
if you post any samples it would be more helpful.

Thanks & Regards,
Anilkumar.M.
-- 
https://mail.python.org/mailman/listinfo/python-list


convert output to list(and nested dictionary)

2015-07-21 Thread max scalf
Hello all,

For Each SecurityGroup, how can i convert that into a List that in turn
will have a dictionary of the cidr block, protocol type and the port...so
from output below, the SecurityGroup called "default" had 2
rules...allowing TCP port from 80 and 5500 to the source IP and then
SecurityGroup called "Pub_HDP_SG" had only one rule...so on and so
forthhere is the output that i am trying to get out in the form of a
list

what I am planning to do is, take the list(and nested dictionary) and pass
that to a function that will in turn spitout a cloudformation template
using troposphere (something like "
http://imil.net/wp/2015/06/04/rock-your-cloudformation-with-troposphere-and-boto/
")


For Better Readablity (http://pastebin.com/rT6Aswwz)

import boto.ec2

sgs = boto.ec2.connect_to_region('us-east-1').get_all_security_groups()

for sg in sgs:

for rule in sg.rules:

print sg, sg.id, "inbound:", rule, " source:", rule.grants


SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(80-80)
 source: [67.184.225.222/32]

SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(5500-5500)
 source: [67.184.225.222/32]

SecurityGroup:Pub_HDP_SG sg-e632d982 inbound: IPPermissions:tcp(80-80)
 source: [0.0.0.0/0]

SecurityGroup:sg3-MySecurityGroup-LB0QF9UQAOEF sg-4fe73728 inbound:
IPPermissions:tcp(22-22)  source: [0.0.0.0/0]

SecurityGroup:sg3-MySecurityGroup-LB0QF9UQAOEF sg-4fe73728 inbound:
IPPermissions:tcp(80-80)  source: [0.0.0.0/0]

SecurityGroup:RDP Rule - open everyone  sg-42d58d27 inbound:
IPPermissions:-1(None-None)  source: [0.0.0.0/0]

SecurityGroup:us-east-open-all sg-97ffa7f2 inbound:
IPPermissions:tcp(22-22)  source: [10.0.20.100/32]

SecurityGroup:us-east-open-all sg-97ffa7f2 inbound:
IPPermissions:tcp(53-53)  source: [10.0.20.100/32]

SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
IPPermissions:-1(None-None)  source: [sg-e632d982-995635159130]

SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
IPPermissions:tcp(22-22)  source: [67.184.225.222/32]

SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
IPPermissions:tcp(1024-65535)  source: [10.0.20.100/32]

SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
IPPermissions:tcp(80-80)  source: [24.12.30.198/32]

SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
IPPermissions:udp(138-138)  source: [10.0.20.100/32]

SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
IPPermissions:udp(53-53)  source: [24.12.30.198/32]

SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
IPPermissions:tcp(30015-30015)  source: [0.0.0.0/0]

SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
IPPermissions:icmp(-1--1)  source: [10.0.20.100/32]

SecurityGroup:default sg-c65a20a3 inbound: IPPermissions:-1(None-None)
 source: [sg-c65a20a3-995635159130]

SecurityGroup:default sg-c65a20a3 inbound: IPPermissions:-1(None-None)
 source: [sg-99c4befc-995635159130]

SecurityGroup:sg3-MySecurityGroup2-1HGPN4UF57XN6 sg-4ee73729 inbound:
IPPermissions:tcp(22-22)  source: [192.168.1.12/32]

SecurityGroup:AWS-AMI-SG sg-35568d51 inbound: IPPermissions:tcp(22-22)
 source: [0.0.0.0/0]

SecurityGroup:launch-wizard-2 sg-932255f6 inbound: IPPermissions:tcp(22-22)
 source: [10.0.20.100/32]

SecurityGroup:launch-wizard-2 sg-932255f6 inbound:
IPPermissions:tcp(443-443)  source: [0.0.0.0/0]

>>>


Here is the output i am looking for


rule1 = [{

'cidr': '67.184.225.222/32',

'proto': 'tcp',

'port': 80

},{

'cidr': '67.184.225.222/32',

'proto': 'tcp',

'port': 5500

}]


rule2 = [{

'cidr': '[0.0.0.0/0',

'proto': 'tcp',

'port': 80

}]


rule3 = [{

'cidr': '0.0.0.0/0',

'proto': 'tcp',

'port': 22

},{

'cidr': '0.0.0.0/0',

'proto': 'tcp',

'port': 80

}]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-21 Thread breamoreboy
On Tuesday, July 21, 2015 at 4:04:30 AM UTC+1, Rick Johnson wrote:
> On Sunday, July 19, 2015 at 9:17:11 PM UTC-5, Rustom Mody wrote:
> 
> 
> > List of python committers:
> > -
> >  11081 Guido van Rossum
> > [snip: long list]
> 
> Thanks for posting this list of names. I had put in a pyFOIA
> request for this data a few years ago, but to my surprise, was
> flat out denied. I'm not sure how exhaustive this list may be,
> but publicly displaying the "commit hierarchy" within the Python
> community is very import for those who may want to get involved.
> 
> [Talking to Mark Lawrence, Rustom said:]
> > So... May I humbly ask where are your precious commits??
> 
> Thanks for putting Mark in his place. He has been brow
> beating folks on this list (myself included) for years, and
> i'll bet he now feels as tiny as D'Aprano did -- when GvR
> scolded him for disrespecting a Noob on Python-ideas.
> 

Read on, oh great stupid one.

>   Yeah, i was watching! 
> 
>   I'M *ALWAYS* WATCHING!
> 
>   ಠ_ಠ
> 
> Now that Mark's lack of "commit cred" has been exposed, we can
> safely ignore his hollow and hypocritical bullying. And now
> that he has been de-fanged, he will be forced to seek employment
> elsewhere. Hmm, my suggestion is that he market himself as an
> on-call "peanut butter removal service". A venture that will
> no doubt be successful, seeing that he has two "heads up" on
> his competition!

Ever heard the saying "engage brain before putting mouth into gear"?  It was 
actually Rustom who posted inaccurate data as only core-devs have commit 
rights.  It would appear that your knowledge of the current development process 
is as good as your knowledge of European geography.  I would say enjoy your 
future in the "peanut butter removal service" but it is quite clear that you 
haven't the skills needed to make it happen.  In the mean time I'll quite 
happily carry on contributing to the Python community as best I can.

Oh, and while I think about it, you'd better put that shovel down, or the hole 
will only get deeper.

Have a nice day :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Schduling

2015-07-21 Thread Irmen de Jong
On 21-7-2015 19:52, Madduri Anil kumar wrote:
> Hello Experts,
> 
> I am new to Python Programming.I have to work on Python.
> I have a requirement to scheduling the script for every one hour.
> could you please let me know which packages will be more helpful for 
> Scheduling.
> if you post any samples it would be more helpful.
> 
> Thanks & Regards,
> Anilkumar.M.
> 

Unless you have specific reasons to do this from within Python itself, I advise 
to use
your operating system's task scheduler instead. Let it invoke the Python 
program on the
desired interval. So, make a cron job for unixes or configure the task 
scheduler on Windows.

Irmen



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Grant Edwards
On 2015-07-21, Emile van Sebille  wrote:
> On 7/21/2015 1:32 PM, Grant Edwards wrote:
>
>> But, it apears foxit reader is Windows-only so it's a moot point for
>> Linux/Unix/Mac users.
>
> I've been happy with https://wiki.gnome.org/Apps/Evince on linux.

I'm trying to switch from acroread to evince, bit it has a few serious
usability problems for me:

 1) You can't copy/paste text from evince _at_all_.  At least it works
right most of the time with acroread.  I really like being able
paste example commands or bits of code or a sentance or three from
PDF docs into a shell or editor window.  Pasting tables is a bit
more work, but it can at least be done with acroread.

 2) You can't print the current view.  I find that invaluable for
printing portions of documents (e.g. I want just a section of a C
size schematic printed on letter sized paper, or just one table
table from a manual sized to fill a 8.5x11 page).  If it did have
'print view' then lack of a marquee zoom would become another
inconvenience.

 3) There's no way to collapse-all in the TOC panel.  When I open a
1200 page document with 30 sections and several hundred sections
and subsections, I don't want to see all of them all of the time.
Closing them one at a time by hand is pretty tedious.

I find that about 20-30% of the time I start up evince, I end up
closing it and re-opening the document in acroread.

-- 
Grant Edwards   grant.b.edwardsYow! ... I have read the
  at   INSTRUCTIONS ...
  gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to install ALL Python packages?

2015-07-21 Thread tjohnson

On 7/21/2015 11:19 AM, ryguy7272 wrote:

On Monday, July 20, 2015 at 10:57:47 PM UTC-4, ryguy7272 wrote:

I'd like to install ALL Python packages on my machine.  Even if it takes up 
4-5GB, or more, I'd like to get everything, and then use it when I need it.  
Now, I'd like to import packages, like numpy and pandas, but nothing will 
install.  I figure, if I can just install everything, I can simply use it when 
I need it, and if I don't need it, then I just won't use it.

I know R offers this as an option.  I figure Python must allow it too.

Any idea  how to grab everything?

Thanks all.


Ok, this makes sense.  Thanks for the insight everyone!!

I forgot to mention in my previous post that there are Python bundles 
like Anaconda and Enthought available, which come with numerous packages 
preinstalled. You may want to check them out.


--
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Emile van Sebille

On 7/21/2015 2:47 PM, Grant Edwards wrote:

On 2015-07-21, Emile van Sebille  wrote:

On 7/21/2015 1:32 PM, Grant Edwards wrote:


But, it apears foxit reader is Windows-only so it's a moot point for
Linux/Unix/Mac users.


I've been happy with https://wiki.gnome.org/Apps/Evince on linux.


I'm trying to switch from acroread to evince, bit it has a few serious
usability problems for me:

  1) You can't copy/paste text from evince _at_all_.


Hmm, i just copied "Acorsa Artichoke Heart - Quarter, Water, Can" from a 
catalog pdf, so _at_all_ depends on something -- I couldn't copy text 
from scanned documents, but that's to be expected.



 At least it works
 right most of the time with acroread.  I really like being able
 paste example commands or bits of code or a sentance or three


Here's some copied text.

When connecting a DataMan directly to an Ethernet port on a PC, both the 
PC and the
DataMan must be configured for the same subnet. This can be done 
automatically though

Link Local Addressing or you can manually configure your reader and your PC.



 from
 PDF docs into a shell or editor window.  Pasting tables is a bit
 more work, but it can at least be done with acroread.



and a table (heading is screwed up but the data columns look ok):
This also looks like it may be dependent on how the pdf was created as 
when I tried with a different table it wouldn't pick up all the columns 
cleanly.  But I don't have acroreader so I couldn't compare.  And when I 
last worked from the 4060 EDI pdf specs some ten years ago that copying 
most everything was a problem even in acroread -- again, a creation 
dependent issue I suspect.


Attribute
ID
Access
Rule
Name
Data
Type
0x9 Set AcqTriggerEnable BOOL
0xA Set AcqTrigger BOOL
0xB Get AcqStatusRegister BYTE
0xC Set UserData ARRAY of
BYTE
0xD Set BufferResultsEnable BOOL
0xE Get DecodeStatusRegister BYTE




  2) You can't print the current view.


I almost never actually print these -- perhaps a page or two for notes 
or reference -- so I haven't hit this issue.



 I find that invaluable for
 printing portions of documents (e.g. I want just a section of a C
 size schematic printed on letter sized paper, or just one table
 table from a manual sized to fill a 8.5x11 page).  If it did have
 'print view' then lack of a marquee zoom would become another
 inconvenience.

  3) There's no way to collapse-all in the TOC panel.


I see a thumbnails side panel and index I can hide, but no TOC.


 When I open a
 1200 page document with 30 sections and several hundred sections
 and subsections, I don't want to see all of them all of the time.
 Closing them one at a time by hand is pretty tedious.

I find that about 20-30% of the time I start up evince, I end up
closing it and re-opening the document in acroread.



As I don't have acroread, I find the 100% of the time evince suits my needs.

When-all-you-have-is-a-hammer-ly yr's,

Emile


--
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Michael Torrie
On 07/21/2015 03:47 PM, Grant Edwards wrote:
> I'm trying to switch from acroread to evince, bit it has a few serious
> usability problems for me:
> 
>  1) You can't copy/paste text from evince _at_all_.  At least it works
> right most of the time with acroread.  I really like being able
> paste example commands or bits of code or a sentance or three from
> PDF docs into a shell or editor window.  Pasting tables is a bit
> more work, but it can at least be done with acroread.
> 
>  2) You can't print the current view.  I find that invaluable for
> printing portions of documents (e.g. I want just a section of a C
> size schematic printed on letter sized paper, or just one table
> table from a manual sized to fill a 8.5x11 page).  If it did have
> 'print view' then lack of a marquee zoom would become another
> inconvenience.
> 
>  3) There's no way to collapse-all in the TOC panel.  When I open a
> 1200 page document with 30 sections and several hundred sections
> and subsections, I don't want to see all of them all of the time.
> Closing them one at a time by hand is pretty tedious.
> 
> I find that about 20-30% of the time I start up evince, I end up
> closing it and re-opening the document in acroread.

Sounds like Evince has really gone down hill since I last used Gnome.  I
use Atril on Mate desktop and it works as well as Evince ever used to
for me, which is expected seeing as it was forked from Gnome 2 sources.
 I have never had any problems cutting and pasting text.  And you can
definitely close the TOC panel.

I wouldn't be at all surprised to see that Evince has lost capabilities.
 Seems to be the way Gnome apps are going these days.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Gene Heskett
On Tuesday 21 July 2015 13:25:32 Laura Creighton wrote:
> In a message of Wed, 22 Jul 2015 00:48:06 +1000, Chris Angelico writes:
> >Actually, maybe don't use PDF at all. I keep having to help my Mum
> >deal with stupid problems with PDF documents she gets, and I'm never
> >sure whether the fault is with the PDF creation software, the human
> >operating said software, or limitations in the file format itself.
> >
> >ChrisA
>
> Lots of the problems are with the free reader, adobe acrobat.  It is
> designed so that the user is kept very much in a straight-jacket which
> is a problem when your Mum needs, for instance, things to be in 36
> point for her to be able to read things at all because she is nearly
> blind.
>
> Laura

TBE, acroread is a P.O.E.  Its first sin is in not sending the printer a 
blank page so that the printout of something novel sized at 450 pages or 
so, actually stays in synch with the ditch settings in your driver used 
in duplex mode.

Linux has several replacements that do this better, and fast enough to 
keep even a fast laser printer busy.  Look them over and I am sure you 
will find something that is both friendlier and more useful for your 
usage needs.


Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-21 Thread Mark Lawrence

On 20/07/2015 03:36, Steven D'Aprano wrote:

On Mon, 20 Jul 2015 06:21 am, breamore...@gmail.com wrote:


All in all though I have to admit that overall it's a really onerous task.
  Once you've produced the patch you have to go to all the trouble of
logging on to the issue tracker, finding the appropriate issue and
uploading the patch.  You may even be inclined to make a comment.  In this
case this entire process could take as much as two whole minutes.


It's very interesting that you ignore the two hardest parts of the process:

(1) Producing the patch in the first place.

(2) Convincing those with appropriate commit rights to accept the patch.




I didn't actually intend to ignore anything, only the whole context has 
been altered as you've snipped the previous paragraph that led into the 
above.


I don't know about the hardest part of the process, but I believe that 
the actual commit part is a PITA regardless of the size of the patch 
involved.  The good news on that front is that the core workflow project 
has kick started again.  The bad news is I haven't got the faintest idea 
what the timescale is, a year, two, I've simply no idea?


One thing I do know is that it has to be made to work, as I doubt that 
there's a single member of the community who can be happy with the 
current workflow.  Still in a way that is a good sign as it shows that 
currently Python is a victim of its own success.


Once the core workflow project has succeeded, and I'll repeat that it 
has to, then Python will definitely achieve what Pinky and the Brain 
failed to do :)


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 8:36 AM, Michael Torrie  wrote:
> Sounds like Evince has really gone down hill since I last used Gnome.  I
> use Atril on Mate desktop and it works as well as Evince ever used to
> for me, which is expected seeing as it was forked from Gnome 2 sources.
>  I have never had any problems cutting and pasting text.  And you can
> definitely close the TOC panel.

I use Evince on Debian, where it came prepackaged with my Xfce
desktop. It identifies itself as "GNOME Document Viewer 3.14.1",
leaving me wondering if the next version would be 3.14.12 in
Knuth-style numbering, but that's beside the point. Copying and
pasting works perfectly from some documents, and imperfectly from
others. Notably, it seems sometimes to be completely unaware of
columns, and copy and paste text straight across the page, which
leaves me staring at "zombie Ring Gates" and other gems. But it's
generally good enough for my purposes.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Grant Edwards
On 2015-07-21, Emile van Sebille  wrote:
> On 7/21/2015 2:47 PM, Grant Edwards wrote:
>> On 2015-07-21, Emile van Sebille  wrote:
>>> On 7/21/2015 1:32 PM, Grant Edwards wrote:
>>>
 But, it apears foxit reader is Windows-only so it's a moot point for
 Linux/Unix/Mac users.
>>>
>>> I've been happy with https://wiki.gnome.org/Apps/Evince on linux.
>>
>> I'm trying to switch from acroread to evince, bit it has a few serious
>> usability problems for me:
>>
>>   1) You can't copy/paste text from evince _at_all_.
>
> Hmm, i just copied "Acorsa Artichoke Heart - Quarter, Water, Can" from a 
> catalog pdf, so _at_all_ depends on something -- I couldn't copy text 
> from scanned documents, but that's to be expected.

Interesting. How do you do it?  For all other apps, all you have to do
is select the text and then center-click in the window where you want
the selected text inserted.

I've tried everything I can think of with evince, and it's not putting
the selected text in any of the three X11 clipboards or buffers, so
I'm stumped.

--
Grant




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Grant Edwards
On 2015-07-21, Michael Torrie  wrote:
> On 07/21/2015 03:47 PM, Grant Edwards wrote:
>> I'm trying to switch from acroread to evince, bit it has a few serious
>> usability problems for me:
>> 
>>  1) You can't copy/paste text from evince _at_all_.  At least it works
>> right most of the time with acroread.  I really like being able
>> paste example commands or bits of code or a sentance or three from
>> PDF docs into a shell or editor window.  Pasting tables is a bit
>> more work, but it can at least be done with acroread.
>> 
>>  2) You can't print the current view.  I find that invaluable for
>> printing portions of documents (e.g. I want just a section of a C
>> size schematic printed on letter sized paper, or just one table
>> table from a manual sized to fill a 8.5x11 page).  If it did have
>> 'print view' then lack of a marquee zoom would become another
>> inconvenience.
>> 
>>  3) There's no way to collapse-all in the TOC panel.  When I open a
>> 1200 page document with 30 sections and several hundred sections
>> and subsections, I don't want to see all of them all of the time.
>> Closing them one at a time by hand is pretty tedious.
>> 
>> I find that about 20-30% of the time I start up evince, I end up
>> closing it and re-opening the document in acroread.

> Sounds like Evince has really gone down hill since I last used Gnome.

Even though I have quite a bit of Gnome stuff installed, I don't use
the Gnome desktop, I use XFCE. That may be part of the problem: most
"Gnome" apps seem to go out of their way not to work with other
desktops.

> I use Atril on Mate desktop and it works as well as Evince ever used
> to for me, which is expected seeing as it was forked from Gnome 2
> sources.  I have never had any problems cutting and pasting text.
> And you can definitely close the TOC panel.

I don't want to close the TOC panel.  I want to collapse all the
entries in the TOC tree widget _in_ the TOC panel.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: convert output to list(and nested dictionary)

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 7:12 AM, max scalf  wrote:
> SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(80-80)  source: 
> [67.184.225.222/32]
>

>
>
> Here is the output i am looking for
>
>
> rule1 = [{
>
> 'cidr': '67.184.225.222/32',
>
> 'proto': 'tcp',
>
> 'port': 80
>
> },{

So if I'm understanding you correctly, one line (from your previous
iteration) will become one dictionary, right?

In that case, start by figuring out how to parse that line and produce
that output. In the example I've quoted, it should be pretty easy (the
'rule' seems to have your proto and port, and your 'rule.grants' has
the cidr), but looking over your data, I see some snags. Firstly, some
of your port numbers are None-None or -1--1, and I'm not sure what
those mean. (My guess: None-None occurs only when proto is -1, and
-1--1 happens when proto is icmp, which doesn't use port numbers. But
you'd have to investigate that.) Also, your cidr might be a list,
rather than a single item. What do you do if it's empty, or if it has
multiple? Third, your ports are very obviously a range (1024-65535
comes up), so you'll need to handle that. And finally, some of those
rules look like things I would permit, and some look like things I'd
reject. You may need to look into the rule definitions to see what you
can find. But the first thing to try would be to get hold of one of
those rule objects and start doing some introspection; dir(rule) and
help(rule) would be where I'd start.

Good luck! This shouldn't be too hard; the data seems to be all there already.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Steven D'Aprano
On Wed, 22 Jul 2015 03:25 am, Laura Creighton wrote:

> Lots of the problems are with the free reader, adobe acrobat.  It is
> designed so that the user is kept very much in a straight-jacket which
> is a problem when your Mum needs, for instance, things to be in 36 point
> for her to be able to read things at all because she is nearly blind.

Surely Acrobat gives you the ability to set the scaling factor of the
displayed page? E.g. 25%, 50%, 100%, 200%, etc?



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Integers with leading zeroes

2015-07-21 Thread Steven D'Aprano
On Wed, 22 Jul 2015 03:21 am, Antoon Pardon wrote:

> On 07/19/2015 07:39 AM, Steven D'Aprano wrote:
>> In Python 2, integer literals with leading zeroes are treated as octal,
>> so 09 is a syntax error and 010 is 8.
>> 
>> This is confusing to those not raised on C-style octal literals, so in
>> Python 3 leading zeroes are prohibited in int literals. Octal is instead
>> written using the prefix 0o, similar to hex 0x and binary 0b.
>> 
>> Consequently Python 3 makes both 09 and 010 a syntax error.
>> 
>> However there is one exception: zero itself is allowed any number of
>> leading zeroes, so 0 is a legal way to write zero as a base-10 int
>> literal.
>> 
>> Does anyone use that (mis)feature?
>> 
> 
> Yes. I like to sometime write numbers with leading zeros.

In Python 2, those numbers will be in octal:

nums = [, 0001, 0002, 0003, 
0004, 0005, 0006, 0007, 
# 0008 and 0009 are syntax errors
0010, ... ]


In Python 3, using leading zeroes is always a syntax error, unless all the
numbers are zero:

# Okay
nums = [, , , , ... ]

# Fails
nums = [, 0001, 0002, 0003, ...]


I'm not interested in the Python 2 case with octal numbers. Can you show an
example of how you would use this in Python 3? Or at least explain what
benefit you get from typing out a block of all zeroes by hand, instead of
(say) this?

nums = [0]*10


> Sometimes these numbers represent codeblocks of a fixed
> number of digits. Always writing those numbers with this
> number of digits helps being aware of this. It is also
> easier for when you need to know how many leading zero's
> such a number has.

I'm not sure what you mean here. Python ints don't have a fixed number of
digits.



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: convert output to list(and nested dictionary)

2015-07-21 Thread Pablo Lucena
​str.split and re are a nice quick way to do it:

>>> def get_data(data):
import re
port_re = re.compile(r'(\w+)\((\S+-\S+)\)')
cidr_re = re.compile(r'\[(.*?)\]')
_, proto_port, cidr = data.rsplit(":", 2)
port_match = port_re.search(proto_port)
proto, port = port_match.group(1), port_match.group(2)
port = port.split("-")[0]
cidr_match = cidr_re.search(cidr)
cidr = cidr_match.group(1)
return dict(port=port, proto=proto, cidr=cidr)

>>> get_data("SecurityGroup:default sg-e1304484 inbound:
IPPermissions:tcp(80-80)  source: [67.184.225.222/32]")
{'cidr': '67.184.225.222/32', 'proto': 'tcp', 'port': '80'}
>>> get_data("SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
IPPermissions:-1(None-None)  source: [sg-e632d982-995635159130]")
{'cidr': 'sg-e632d982-995635159130', 'proto': '1', 'port': 'None'}


​You can alter this and add whatever extra checks you need as Chris A
mentioned (when proto is -1 and port is None-None, or the icmp case). This
is just a very crude example, but hopefully you get the drift.

Most text parsing problems can easily be solved with these simple tools.
Fire up your shell and test it - this is really the best way to learn how
to do something like this.


On Tue, Jul 21, 2015 at 5:12 PM, max scalf  wrote:

> Hello all,
>
> For Each SecurityGroup, how can i convert that into a List that in turn
> will have a dictionary of the cidr block, protocol type and the port...so
> from output below, the SecurityGroup called "default" had 2
> rules...allowing TCP port from 80 and 5500 to the source IP and then
> SecurityGroup called "Pub_HDP_SG" had only one rule...so on and so
> forthhere is the output that i am trying to get out in the form of a
> list
>
> what I am planning to do is, take the list(and nested dictionary) and pass
> that to a function that will in turn spitout a cloudformation template
> using troposphere (something like "
> http://imil.net/wp/2015/06/04/rock-your-cloudformation-with-troposphere-and-boto/
> ")
>
>
> For Better Readablity (http://pastebin.com/rT6Aswwz)
>
> import boto.ec2
>
> sgs = boto.ec2.connect_to_region('us-east-1').get_all_security_groups()
>
> for sg in sgs:
>
> for rule in sg.rules:
>
> print sg, sg.id, "inbound:", rule, " source:", rule.grants
>
>
> SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(80-80)
>  source: [67.184.225.222/32]
>
> SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(5500-5500)
>  source: [67.184.225.222/32]
>
> SecurityGroup:Pub_HDP_SG sg-e632d982 inbound: IPPermissions:tcp(80-80)
>  source: [0.0.0.0/0]
>
> SecurityGroup:sg3-MySecurityGroup-LB0QF9UQAOEF sg-4fe73728 inbound:
> IPPermissions:tcp(22-22)  source: [0.0.0.0/0]
>
> SecurityGroup:sg3-MySecurityGroup-LB0QF9UQAOEF sg-4fe73728 inbound:
> IPPermissions:tcp(80-80)  source: [0.0.0.0/0]
>
> SecurityGroup:RDP Rule - open everyone  sg-42d58d27 inbound:
> IPPermissions:-1(None-None)  source: [0.0.0.0/0]
>
> SecurityGroup:us-east-open-all sg-97ffa7f2 inbound:
> IPPermissions:tcp(22-22)  source: [10.0.20.100/32]
>
> SecurityGroup:us-east-open-all sg-97ffa7f2 inbound:
> IPPermissions:tcp(53-53)  source: [10.0.20.100/32]
>
> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
> IPPermissions:-1(None-None)  source: [sg-e632d982-995635159130]
>
> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
> IPPermissions:tcp(22-22)  source: [67.184.225.222/32]
>
> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
> IPPermissions:tcp(1024-65535)  source: [10.0.20.100/32]
>
> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
> IPPermissions:tcp(80-80)  source: [24.12.30.198/32]
>
> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
> IPPermissions:udp(138-138)  source: [10.0.20.100/32]
>
> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
> IPPermissions:udp(53-53)  source: [24.12.30.198/32]
>
> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
> IPPermissions:tcp(30015-30015)  source: [0.0.0.0/0]
>
> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
> IPPermissions:icmp(-1--1)  source: [10.0.20.100/32]
>
> SecurityGroup:default sg-c65a20a3 inbound: IPPermissions:-1(None-None)
>  source: [sg-c65a20a3-995635159130]
>
> SecurityGroup:default sg-c65a20a3 inbound: IPPermissions:-1(None-None)
>  source: [sg-99c4befc-995635159130]
>
> SecurityGroup:sg3-MySecurityGroup2-1HGPN4UF57XN6 sg-4ee73729 inbound:
> IPPermissions:tcp(22-22)  source: [192.168.1.12/32]
>
> SecurityGroup:AWS-AMI-SG sg-35568d51 inbound: IPPermissions:tcp(22-22)
>  source: [0.0.0.0/0]
>
> SecurityGroup:launch-wizard-2 sg-932255f6 inbound:
> IPPermissions:tcp(22-22)  source: [10.0.20.100/32]
>
> SecurityGroup:launch-wizard-2 sg-932255f6 inbound:
> IPPermissions:tcp(443-443)  source: [0.0.0.0/0]
>
> >>>
>
>
> Here is the output i am looking for
>
>
> rule1 = [{
>
> 'cidr': '67.184.225.222/32',
>
> 'proto': 'tcp',
>
> 'port': 80
>
> },{
>
> 'cidr': '67.184.225.222/32',
>
> 'proto': 'tcp',
>
> 'port': 5500
>
> }]
>
>
> rule2 = [{
>
> 'cidr': '[0.0.0.0/0',
>
>

Re: Can I copy/paste Python code?

2015-07-21 Thread Michael Torrie
On 07/21/2015 06:12 PM, Grant Edwards wrote:
> 
> I don't want to close the TOC panel.  I want to collapse all the
> entries in the TOC tree widget _in_ the TOC panel.

Ahh.  Atril does not do this either.  It can collapse the TOC to the
first level items but not the tree itself.  I'm curious as to what good
collapsing the whole tree down to one node would be.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: convert output to list(and nested dictionary)

2015-07-21 Thread Steven D'Aprano
On Wed, 22 Jul 2015 07:12 am, max scalf wrote:

> Hello all,
> 
> For Each SecurityGroup, how can i convert that into a List that in turn
> will have a dictionary of the cidr block, protocol type and the port...


Start with this:

def sg_to_list(sg):
return [rule_to_dict(r) for r in sg.rules]

def rule_to_dict(rule):
d = {} # expected {'cidr': '0.0.0.0/0', 'proto': 'tcp', 'port': 80}
d['cidr'] = rule.cidr
d['proto'] = rule.proto
d['port'] = rule.port
return d


and adjust until working.



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Integers with leading zeroes

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 10:55 AM, Steven D'Aprano  wrote:
>> Sometimes these numbers represent codeblocks of a fixed
>> number of digits. Always writing those numbers with this
>> number of digits helps being aware of this. It is also
>> easier for when you need to know how many leading zero's
>> such a number has.
>
> I'm not sure what you mean here. Python ints don't have a fixed number of
> digits.

Sometimes your numbers carry specific payloads or structures. A few examples:

Date: 20150722 [decimal]
Unix permissions: 10777 [octal]
MAC address: 0014a466fba9 [hex]

In the MAC address example, it doesn't make sense to elide the leading
zeroes. I can't currently think of a common, real-world example that
uses decimal and isn't gong to push itself to the full eight digits,
apart from Northern Territory postcodes with their silly 08nn pattern,
but I'm sure they exist.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: convert output to list(and nested dictionary)

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 11:03 AM, Pablo Lucena  wrote:
> str.split and re are a nice quick way to do it:
>
 def get_data(data):
> import re
> port_re = re.compile(r'(\w+)\((\S+-\S+)\)')
> cidr_re = re.compile(r'\[(.*?)\]')
> _, proto_port, cidr = data.rsplit(":", 2)
> port_match = port_re.search(proto_port)
> proto, port = port_match.group(1), port_match.group(2)
> port = port.split("-")[0]
> cidr_match = cidr_re.search(cidr)
> cidr = cidr_match.group(1)
> return dict(port=port, proto=proto, cidr=cidr)

The textual output is coming from his quick little Python loop. No
need to parse that when you can go to the underlying objects :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can I copy/paste Python code?

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 11:03 AM, Michael Torrie  wrote:
> On 07/21/2015 06:12 PM, Grant Edwards wrote:
>>
>> I don't want to close the TOC panel.  I want to collapse all the
>> entries in the TOC tree widget _in_ the TOC panel.
>
> Ahh.  Atril does not do this either.  It can collapse the TOC to the
> first level items but not the tree itself.  I'm curious as to what good
> collapsing the whole tree down to one node would be.

Collapse everything, then open out just the one you want. More compact
display. And yes, it's a minor problem in evince, though not too bad
for my usage (I can close one sub-branch, just not the whole tree).

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-21 Thread Rick Johnson
On Tuesday, July 21, 2015 at 4:22:50 PM UTC-5, bream...@gmail.com wrote:

> It was actually Rustom who posted inaccurate data as only
> core-devs have commit rights.

Well-well. We now find ourselves before the royal court of
logic: If we are to take your statement as fact, then only
two possibilities exist:

  (a) Mark is a core dev who has committed patches and is a
  bully.
  
  (b) Mark is not a core dev, and therefor can not commit
  anything, therefor he's a bully *AND* a hypocrite!

Which is it?

> It would appear that your knowledge of the current
> development process is as good as your knowledge of
> European geography.

So you've been lurking in that thread also? As with this
thread, folks have mis-interpreted my words. When i get a
chance to respond over there, you shall become enlightened
and humbled.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: convert output to list(and nested dictionary)

2015-07-21 Thread max scalf
Thank you all.  I have gotten some great response, so i am going to play
around with this and see how it turns out.  As Pablo pointed out, best way
to learn is to try it out and see how it goes.  Thanks again and i will
keep the list posted.

On Tue, Jul 21, 2015 at 8:03 PM, Pablo Lucena  wrote:

> ​str.split and re are a nice quick way to do it:
>
> >>> def get_data(data):
> import re
> port_re = re.compile(r'(\w+)\((\S+-\S+)\)')
> cidr_re = re.compile(r'\[(.*?)\]')
> _, proto_port, cidr = data.rsplit(":", 2)
> port_match = port_re.search(proto_port)
> proto, port = port_match.group(1), port_match.group(2)
> port = port.split("-")[0]
> cidr_match = cidr_re.search(cidr)
> cidr = cidr_match.group(1)
> return dict(port=port, proto=proto, cidr=cidr)
>
> >>> get_data("SecurityGroup:default sg-e1304484 inbound:
> IPPermissions:tcp(80-80)  source: [67.184.225.222/32]")
> {'cidr': '67.184.225.222/32', 'proto': 'tcp', 'port': '80'}
> >>> get_data("SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
> IPPermissions:-1(None-None)  source: [sg-e632d982-995635159130]")
> {'cidr': 'sg-e632d982-995635159130', 'proto': '1', 'port': 'None'}
>
>
> ​You can alter this and add whatever extra checks you need as Chris A
> mentioned (when proto is -1 and port is None-None, or the icmp case). This
> is just a very crude example, but hopefully you get the drift.
>
> Most text parsing problems can easily be solved with these simple tools.
> Fire up your shell and test it - this is really the best way to learn how
> to do something like this.
>
>
> On Tue, Jul 21, 2015 at 5:12 PM, max scalf  wrote:
>
>> Hello all,
>>
>> For Each SecurityGroup, how can i convert that into a List that in turn
>> will have a dictionary of the cidr block, protocol type and the port...so
>> from output below, the SecurityGroup called "default" had 2
>> rules...allowing TCP port from 80 and 5500 to the source IP and then
>> SecurityGroup called "Pub_HDP_SG" had only one rule...so on and so
>> forthhere is the output that i am trying to get out in the form of a
>> list
>>
>> what I am planning to do is, take the list(and nested dictionary) and
>> pass that to a function that will in turn spitout a cloudformation template
>> using troposphere (something like "
>> http://imil.net/wp/2015/06/04/rock-your-cloudformation-with-troposphere-and-boto/
>> ")
>>
>>
>> For Better Readablity (http://pastebin.com/rT6Aswwz)
>>
>> import boto.ec2
>>
>> sgs = boto.ec2.connect_to_region('us-east-1').get_all_security_groups()
>>
>> for sg in sgs:
>>
>> for rule in sg.rules:
>>
>> print sg, sg.id, "inbound:", rule, " source:", rule.grants
>>
>>
>> SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(80-80)
>>  source: [67.184.225.222/32]
>>
>> SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(5500-5500)
>>  source: [67.184.225.222/32]
>>
>> SecurityGroup:Pub_HDP_SG sg-e632d982 inbound: IPPermissions:tcp(80-80)
>>  source: [0.0.0.0/0]
>>
>> SecurityGroup:sg3-MySecurityGroup-LB0QF9UQAOEF sg-4fe73728 inbound:
>> IPPermissions:tcp(22-22)  source: [0.0.0.0/0]
>>
>> SecurityGroup:sg3-MySecurityGroup-LB0QF9UQAOEF sg-4fe73728 inbound:
>> IPPermissions:tcp(80-80)  source: [0.0.0.0/0]
>>
>> SecurityGroup:RDP Rule - open everyone  sg-42d58d27 inbound:
>> IPPermissions:-1(None-None)  source: [0.0.0.0/0]
>>
>> SecurityGroup:us-east-open-all sg-97ffa7f2 inbound:
>> IPPermissions:tcp(22-22)  source: [10.0.20.100/32]
>>
>> SecurityGroup:us-east-open-all sg-97ffa7f2 inbound:
>> IPPermissions:tcp(53-53)  source: [10.0.20.100/32]
>>
>> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
>> IPPermissions:-1(None-None)  source: [sg-e632d982-995635159130]
>>
>> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
>> IPPermissions:tcp(22-22)  source: [67.184.225.222/32]
>>
>> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
>> IPPermissions:tcp(1024-65535)  source: [10.0.20.100/32]
>>
>> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
>> IPPermissions:tcp(80-80)  source: [24.12.30.198/32]
>>
>> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
>> IPPermissions:udp(138-138)  source: [10.0.20.100/32]
>>
>> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
>> IPPermissions:udp(53-53)  source: [24.12.30.198/32]
>>
>> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
>> IPPermissions:tcp(30015-30015)  source: [0.0.0.0/0]
>>
>> SecurityGroup:wordpress-app-SG sg-99c4befc inbound:
>> IPPermissions:icmp(-1--1)  source: [10.0.20.100/32]
>>
>> SecurityGroup:default sg-c65a20a3 inbound: IPPermissions:-1(None-None)
>>  source: [sg-c65a20a3-995635159130]
>>
>> SecurityGroup:default sg-c65a20a3 inbound: IPPermissions:-1(None-None)
>>  source: [sg-99c4befc-995635159130]
>>
>> SecurityGroup:sg3-MySecurityGroup2-1HGPN4UF57XN6 sg-4ee73729 inbound:
>> IPPermissions:tcp(22-22)  source: [192.168.1.12/32]
>>
>> SecurityGroup:AWS-AMI-SG sg-35568d51 inbound: IPPermissions:tcp(22-22)
>>  source: [0.0.0.0/0]
>>
>> SecurityGroup:launch-wizard-2 sg-932255f6 inbound:
>> IPPerm

Re: Integers with leading zeroes

2015-07-21 Thread Steven D'Aprano
On Wed, 22 Jul 2015 11:10 am, Chris Angelico wrote:

> On Wed, Jul 22, 2015 at 10:55 AM, Steven D'Aprano 
> wrote:
>>> Sometimes these numbers represent codeblocks of a fixed
>>> number of digits. Always writing those numbers with this
>>> number of digits helps being aware of this. It is also
>>> easier for when you need to know how many leading zero's
>>> such a number has.
>>
>> I'm not sure what you mean here. Python ints don't have a fixed number of
>> digits.
> 
> Sometimes your numbers carry specific payloads or structures. A few
> examples:
> 
> Date: 20150722 [decimal]
> Unix permissions: 10777 [octal]
> MAC address: 0014a466fba9 [hex]

I don't see the relevance of any of those examples. Only the date is
kinda-sort in decimal, the others are in octal and hex and so need to be
written as octal or hex numbers:

perm = 0o10777  # not 25031 as the above will give
addr = 0x0014a466fba9  # the above will give a syntax error


The date example should be a string, not an integer.

today = 20151231
tomorrow = today + 1
assert tomorrow == 20160101  # fails

I guess you can have 0 as Unix permissions, there might even be a 0 MAC
address, but would you write them in decimal as  (etc.) when all the
other perms and addresses are written in oct or hex?

addresses = [
0x0014a466fba9, 
0x0014a00b3fb1, 
, 
0x003744a9012a, 
]


> In the MAC address example, it doesn't make sense to elide the leading
> zeroes. I can't currently think of a common, real-world example that
> uses decimal and isn't gong to push itself to the full eight digits,
> apart from Northern Territory postcodes with their silly 08nn pattern,
> but I'm sure they exist.

Postcodes, or zip codes, also should be written as strings, even if they
happen to be all digits.

I'm still looking for an example of where somebody would write the int zero
in decimal using more than one 0-digit. While I'm sure they are fascinating
in and of themselves, examples of numbers written as strings, in hex or
octal, non-zero numbers written without leading zeroes, or zero written
with only a single digit don't interest me :-)



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to install ALL Python packages?

2015-07-21 Thread ryguy7272
On Monday, July 20, 2015 at 10:57:47 PM UTC-4, ryguy7272 wrote:
> I'd like to install ALL Python packages on my machine.  Even if it takes up 
> 4-5GB, or more, I'd like to get everything, and then use it when I need it.  
> Now, I'd like to import packages, like numpy and pandas, but nothing will 
> install.  I figure, if I can just install everything, I can simply use it 
> when I need it, and if I don't need it, then I just won't use it.
> 
> I know R offers this as an option.  I figure Python must allow it too.
> 
> Any idea  how to grab everything?
> 
> Thanks all.


Thanks for the tip.  I just downloaded and installed Anaconda.  I just 
successfully ran my first Python script.  So, so happy now.  Thanks again!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Integers with leading zeroes

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 12:14 PM, Steven D'Aprano  wrote:
> On Wed, 22 Jul 2015 11:10 am, Chris Angelico wrote:
>
>> On Wed, Jul 22, 2015 at 10:55 AM, Steven D'Aprano 
>> wrote:
 Sometimes these numbers represent codeblocks of a fixed
 number of digits. Always writing those numbers with this
 number of digits helps being aware of this. It is also
 easier for when you need to know how many leading zero's
 such a number has.
>>>
>>> I'm not sure what you mean here. Python ints don't have a fixed number of
>>> digits.
>>
>> Sometimes your numbers carry specific payloads or structures. A few
>> examples:
>>
>> Date: 20150722 [decimal]
>> Unix permissions: 10777 [octal]
>> MAC address: 0014a466fba9 [hex]
>
> I don't see the relevance of any of those examples. Only the date is
> kinda-sort in decimal, the others are in octal and hex and so need to be
> written as octal or hex numbers:
>
> perm = 0o10777  # not 25031 as the above will give
> addr = 0x0014a466fba9  # the above will give a syntax error

Right, I'm just giving examples of structured numbers. I don't have a
good example of a decimal structured number, but there are good
examples in other bases, and the possibility is there for someone to
have one that makes sense in decimal.

> The date example should be a string, not an integer.
>
> today = 20151231
> tomorrow = today + 1
> assert tomorrow == 20160101  # fails

All that proves is that there are certain operations that don't work
on date-stored-as-integer. The same operations equally won't work on
date-stored-as-string. If you want date arithmetic, you MUST use a
proper date/time library; but if all you want is simple and efficient
comparisons, integers work fine. So do strings, but integers are
right-justified. If you imagine a situation in which it's not dates
with four digit years, but some other starting figure - maybe it's the
year in some arbitrary calendar on which today is the 6th of Cuspis in
the year 411 of the Common Reckoning. Those dates can go back before
year 100, so the date numbers would lose a digit compared to today's
4110206. Hence it's useful to be able to right-justify them.

Dates aren't a great example (because good date/time libraries do
exist), but they're more universally understood than domain-specific
examples.

> I guess you can have 0 as Unix permissions, there might even be a 0 MAC
> address, but would you write them in decimal as  (etc.) when all the
> other perms and addresses are written in oct or hex?
>
> addresses = [
> 0x0014a466fba9,
> 0x0014a00b3fb1,
> ,
> 0x003744a9012a,
> ]

Right, so those aren't ideal examples either, because they're not decimal.

> Postcodes, or zip codes, also should be written as strings, even if they
> happen to be all digits.

Hmm, maybe. I'm on the fence about that one. Of course, most of the
time, I advocate a single multi-line text field "Address", and let
people key them in free-form. No postcode field whatsoever.

> I'm still looking for an example of where somebody would write the int zero
> in decimal using more than one 0-digit. While I'm sure they are fascinating
> in and of themselves, examples of numbers written as strings, in hex or
> octal, non-zero numbers written without leading zeroes, or zero written
> with only a single digit don't interest me :-)

Frankly, I'm in broad agreement: using 000 to represent 0
isn't particularly useful, given that 0001 is an error. But since
C-like languages (and Py2) use the leading zero to mean octal, and
mathematics ignores the leading zero, there's no way to avoid
confusing people other than by having an instant error. There's
probably code out there that uses 000 to mean 0, but personally, I
wouldn't be against deprecating it.

One thing that's really REALLY annoying is running into something that
uses virtually the same syntax to mean something almost, but not
entirely, identical... and completely incompatible. If Py3 allowed
0009 to mean 9, we would have nightmares all over the place, even
without Py2/Py3 conversion. Unadorned octal still shows up in one
place in Py3, and that's string escapes:

>>> "\33"
'\x1b'
>>> b"\33"
b'\x1b'

I hope this *never* gets changed to decimal or hex. If it's considered
a problem, the only solution is to excise it altogether. Please do NOT
do what BIND9 did, and have "\033" mean 33 decimal... it bugged me no
end when I tried to move some binary around between DNS and other
systems...

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Address field [was: Integers with leading zeroes]

2015-07-21 Thread Jason Friedman
> Of course, most of the
> time, I advocate a single multi-line text field "Address", and let
> people key them in free-form. No postcode field whatsoever.

I'm curious about that statement.
I could see accepting input as you describe above, but I'm thinking
you'd want to *store* a postcode field.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Address field [was: Integers with leading zeroes]

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 2:31 PM, Jason Friedman  wrote:
>> Of course, most of the
>> time, I advocate a single multi-line text field "Address", and let
>> people key them in free-form. No postcode field whatsoever.
>
> I'm curious about that statement.
> I could see accepting input as you describe above, but I'm thinking
> you'd want to *store* a postcode field.

Actually, no. Apart from statisticking, there's not a lot I can do
with a postcode. Due to the nature of international addressing, it's
usually safest to go to one extreme or the other: either full-on
address validation that knows about every delivery point in every
nation that you support (viable if you support only one country, and
that country's postal service offers an API - happens here in
Australia), or no validation whatsoever, and a simple free-form field
for people to enter what they will. Most of the times I've been
setting things up, they're too low-end to justify the former, so I
recommend the latter. Sure, there might be typos... but there might be
those anyway, with a classic multi-part form. (I do recommend having a
drop-down select box for the country, incidentally. That's easily
validated.)

Storing postcodes works nicely once you've settled that they're all
part of a single country. When you want to do statistics on postcodes,
it's not usually too hard to rip them out of the blob and work with
them, but they're unreliable anyway unless you've gone the full-on
validation route. So I tend to just not do the stats at all :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Interactive, test-driven coding challenges (algorithms and data structures)

2015-07-21 Thread Orochi
On Monday, 13 July 2015 16:50:54 UTC+5:30, donne@gmail.com  wrote:
> Repo:
> https://github.com/donnemartin/interactive-coding-challenges
> 
> Shortlink:
> https://bit.ly/git-code 
> 
> Hi Everyone,
> 
> I created a number of interactive, test-driven coding challenges. I will 
> continue to add to the repo on a regular basis. I'm hoping you find it useful 
> as a fun, hands-on way to learn or to sharpen your skills on algorithms and 
> data structures, while helping yourself prep for coding interviews and coding 
> challenges.
> 
> Let me know if you have any questions or comments. Contributions are welcome!
> 
> -Donne

wow! Cool the challenges are awesome. will try them to improve my Algorithm and 
Data Structures Skills.
Just a suggestion. why don't you set Python Algorithm and Data Structures 
challenges for "HackerRank.com" or "HackerEarth.com"
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-21 Thread Terry Reedy

On 7/21/2015 10:07 PM, Rick Johnson wrote:


two possibilities exist:

   (a) Mark is a core dev who has committed patches and is a
   bully.

   (b) Mark is not a core dev, and therefor can not commit
   anything, therefor he's a bully *AND* a hypocrite!

Which is it?


Mark is not a core dev, cannot commit, and as far as I know, has never 
claimed such.  However, he has participated on the tracker, has reviewed 
patches, and has submitted patches, at least one of which has been 
committed.  His user name is BreamoreBoy and his tracker email is the 
same breamore@ address that recently upset you.  'BreamoreBoy' has been 
nosy on at least 1483 issues, over half as many as me.


You, as 'RantingRick' have opened 1 issue, quickly closed, but not 
posted under than name on any others.

https://bugs.python.org/issue8970
You sent one patch to me which I applied.
Maybe there is some other activity that I missed.

I would prefer it if you both stopped snipping and sniping at each other.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list