Re: TypeError: 'kwarg' is an invalid keyword argument for this function

2014-10-14 Thread alex23

On 13/10/2014 8:04 PM, Dave Angel wrote:

It would also help to spell it the same.  In the OP's
  implementation,  he defined kwargs, and tried to use it as
  kwarg.


That's perfectly okay, though: if `kwargs` is the name used to reference 
the dictionary of keyword arguments, `kwarg` would be an instance of a 
keyword argument.


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


Re: Need help in pulling SQL query out of log file...

2014-10-14 Thread Sagar Deshmukh
On Monday, 13 October 2014 22:40:07 UTC-7, alex23  wrote:
 On 14/10/2014 11:47 AM, Sagar Deshmukh wrote:
 
  I have a log file which has lot of information like..SQL query.. number of 
  records read...records loaded etc..
 
  My requirement is i would like to read the SQL query completly and write it 
  to another txt file..
 
 
 
 Generally we encourage people to post what they've tried to the list. It 
 
 helps us identify what you know and what you need help with.
 
 
 
 However, given:
 
 
 
   the log file may not be always same so can not make static choices...
 
 
 
 You'll probably want to use regular expressions:
 
 
 
  https://docs.python.org/howto/regex.html
 
 
 
 Regexps let you search through the text for known patterns and extract 
 
 any that match. To extract all SQL query sections, you'll need to come 
 
 up with a way of uniquely identifying them from all other sections. 
 
 Looking at your example log file, it looks like they're all of the format:
 
 
 
  SQL Query [the actual sql query]
 
 
 
  From that we can determine that all SQL queries are prefixed by 'SQL 
 
 Query [' and suffixed by ']', so the content you want is everything 
 
 between those markers. So a possible regular expression might be:
 
 
 
  SQL Query \[(.*?)\]
 
 
 
 To quickly explain this:
 
 
 
  1. SQL Query  matches on that string
 
  2. Because [] have meaning for regexes, to match on literal 
 
 brackets you need to escape them via \[ and \]
 
  3. ( ) is a group, whats contained in here will be returned
 
  4. .* means to grab all matching text
 
  5. ? means to do an ungreedy grab ie it'll stop at the first \] 
 
 it encounters.
 
 
 
 Pulling the queries out of your log file should be as simple as:
 
 
 
  import re
 
 
 
  log = open('logfile').read()
 
  queries = re.findall(SQL Query \[(.*?)\], log, re.DOTALL)
 
 
 
 Because the queries can fall across multiple lines, the re.DOTALL flag 
 
 is required to treat EOL markers as characters.
 
 
 
 Hope this helps.

Hi,

This helps and its working... Thank you so much
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to install and run a script?

2014-10-14 Thread Mark Lawrence

On 14/10/2014 06:19, Michael Torrie wrote:

On 10/12/2014 08:05 PM, ryguy7272 wrote:

Ah!!!  I didn't know I needed to run it from the command prompt!  Ok, not 
it makes sense, and everything works.

Thanks to all!


You don't have to run python apps from the command line.  Apps that
throw up windows can usually be run by double-clicking the py file in
windows.  But apps that communicate solely on the terminal or console
have to be run in that environment.



No, you need to double click a pyw file to get a windows app, py files 
always give you a console.


--
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


Code Review for Paper, Rock, Scissors

2014-10-14 Thread Revenant
Hi all!

I'm new to Python and programming in general, and am trying to learn as much as 
I can about it. 

Anyway, for a basic first program I made a simple game of Paper, Rock, 
Scissors. For this program, I incorporated a main menu that presented three 
different options, allowed the user to play a game of Paper, Rock, Scissors, 
allowed them to play the game again, and most importantly checked the user's 
input to make sure the program doesn't fail due to errors. 

One thing I want to try to add is a Press any key to continue function that 
occurs at the end of the program when the user decides to quit. I looked at 
some options online, but haven't quite figured it out yet. 

As previously stated, I am new to Python and would also like to see if any of 
you programming gurus have some suggestions about how I can simplify code, and 
also if there are any other good starter programs to work on to improve my 
skills. 

Thanks for reading! Code is below:


# Creates the main menu.
def menu():
# Sets the scores to 0.
global playerscore
global compscore
global draws
playerscore = 0
compscore = 0
draws = 0
menuselection = input('Please enter a selection: (Play/Help/About): ')
# Checks for an invalid selection.
while menuselection != 'Play' and menuselection != 'play' and menuselection 
!= 'Help' and menuselection != 'help' \
and menuselection != 'About' and menuselection != 'about':
print('You have entered an invalid selection.')
menuselection = input('\nPlease type a selection: (Play/Help/About): ')
else:
if menuselection == 'Play' or menuselection == 'play':
play()
elif menuselection == 'Help' or menuselection == 'help':
instructions()
else:
about()


# Creates the game.
def play():
global playerscore
global compscore
global draws
# Player chooses Paper, Rock, or Scissors.
playerselect = input('\nPlease choose Paper, Rock, or Scissors: ')
# Checks for an invalid selection.
while playerselect != 'Paper' and playerselect != 'paper' and playerselect 
!= 'Rock' and playerselect != 'rock' \
and playerselect != 'Scissors' and playerselect != 'scissors':
print('You have entered an invalid selection.')
playerselect = input('\nPlease choose Paper, Rock, or Scissors: ')
else:
if playerselect == 'Paper' or playerselect == 'paper':
print('\nYou have selected Paper.')
playerselect = 1
elif playerselect == 'Rock' or playerselect == 'rock':
print('\nYou have selected Rock.')
playerselect = 2
else:
print('\nYou have selected Scissors.')
playerselect = 3
# Computer chooses Paper, Rock, or Scissors.
import random
compselect = random.randint(1, 3)
if compselect == 1:
print('The Computer has selected Paper')
elif compselect == 2:
print('The Computer has selected Rock.')
else:
print('The Computer has selected Scissors.')
# Results if player selects paper.
if playerselect == 1 and compselect == 1:
print('Draw!')
draws += 1
score()
else:
if playerselect == 1 and compselect == 2:
print('Paper beats rock. You win!')
playerscore += 1
score()
elif playerselect == 1 and compselect == 3:
print('Paper is beaten by scissors. You lose!')
compscore += 1
score()
# Results if player selects rock.
if playerselect == 2 and compselect == 2:
print('Draw!')
draws += 1
score()
else:
if playerselect == 2 and compselect == 1:
print('Rock is beaten by paper. You lose!')
compscore += 1
score()
elif playerselect == 2 and compselect == 3:
print('Rock beats scissors. You win!')
playerscore += 1
score()
# Results if player selects rock.
if playerselect == 3 and compselect == 3:
print('Draw!')
draws += 1
score()
else:
if playerselect == 3 and compselect == 1:
print('Scissors beat paper. You win!')
playerscore += 1
score()
elif playerselect == 3 and compselect == 2:
print('Scissors are beaten by rock. You lose!')
compscore += 1
score()
again()


# Determines if the player wants to play another game.
def again():
replay = input('\nDo you want to play again (Y/N)? ')
while replay != 'Y' and replay != 'y' and replay != 'N' and replay != 'n':
print('You have entered an invalid selection.')
replay = input('\nDo you want to play again (Y/N)? ')
else:
if replay == 'Y' or replay == 'y':
play()
else:
print('\nThanks for playing!')


# Creates the instructions.
def instructions():
print('\nPaper, 

Re: Code Review for Paper, Rock, Scissors

2014-10-14 Thread Glenn Hutchings
Hi there!   Welcome to Python.

On Tuesday, 14 October 2014 09:04:51 UTC+1, Revenant  wrote:
 I am new to Python and would also like to see if any of you programming
 gurus have some suggestions about how I can simplify code, and also if
 there are any other good starter programs to work on to improve my
 skills.

I'm sure you'll get a lot of helpful advice here.  Here's a start: you have
a lot of places where you're comparing variables to the capitalized and
lower-case versions of the same string.  You could halve that number if you
converted your input to lowercase first.  For example:

if menuselection == 'play' or menuselection == 'Play':

changes to:

if menuselection.lower() == 'play':

There are plenty of other string methods you might find useful.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Jython or Pyton issue-- Kindly Help me....

2014-10-14 Thread Venugopal Reddy
Ok, I will explain my problem in details :

I have below XML:

?xml version=1.0? 
data 
country name=Liechtenstein 
rank1/rank 
year2008/year 
year2009/year 
gdppc141100/gdppc 
neighbor name=Austria direction=E/ 
neighbor name=Switzerland direction=W/ 
/country 
country name=Singapore 
rank4/rank 
year2011/year 
gdppc59900/gdppc 
neighbor name=Malaysia direction=N/ 
/country 
country name=Panama 
rank68/rank 
year2011/year 
gdppc13600/gdppc 
neighbor name=Costa Rica direction=W/ 
neighbor name=Colombia direction=E/ 
/country 
/data 


From I want output below format:

CountrynameRankYeargdppc 
Liechtenstein   1  2008141100 
Singapore   4  201159900 
Panama  68 201113600

Please help how to do it..


On Monday, October 13, 2014 9:14:27 PM UTC+5:30, Ian wrote:
 On Mon, Oct 13, 2014 at 5:39 AM, Venugopal Reddy
 
 venugopal.re...@tspl.com wrote:
 
  Dear All,
 
 
 
  How to write a program for reading or parsing the XML file in Sub root Wise.
 
 
 
 I don't know what Sub root Wise is. You can find an overview of
 
 Python's XML parsing interfaces at
 
 https://docs.python.org/2/library/xml.html. I would recommend using
 
 the ElementTree API unless you have a specific reason to use something
 
 else.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re:Code Review for Paper, Rock, Scissors

2014-10-14 Thread Dave Angel
Revenant faceofoblivionoffic...@gmail.com Wrote in message:
 
 

 One thing I want to try to add is a Press any key to continue function that 
 occurs at the end of the program when the user decides to quit. I looked at 
 some options online, but haven't quite figured it out yet. 
 

Use the curses function getch, as documented on:
https://docs.python.org/3/howto/curses.html

Or if you're on Windows, try msvcrt.getch.

If you're writing code that needs to be portable, look at:
http://code.activestate.com/recipes/577977-get-single-keypress/


 As previously stated, I am new to Python and would also like to see if any of 
 you programming gurus have some suggestions about how I can simplify code, 
 and also if there are any other good starter programs to work on to improve 
 my skills. 
 
 Thanks for reading! Code is below:
 
 
 # Creates the main menu.
 def menu():
 # Sets the scores to 0.
 global playerscore
 global compscore
 global draws
 playerscore = 0
 compscore = 0
 draws = 0
 menuselection = input('Please enter a selection: (Play/Help/About): ')

Save yourself trouble by using the lower method on the result of
 each input function. I'll assume that for subsequent comments.
 

 # Checks for an invalid selection.
 while menuselection != 'Play' and menuselection != 'play' and 
 menuselection != 'Help' and menuselection != 'help' \
 and menuselection != 'About' and menuselection != 'about':

Simplify to:
while menuselection not in (play, help, about):

 print('You have entered an invalid selection.')
 menuselection = input('\nPlease type a selection: (Play/Help/About): 
 ')
 else:
 if menuselection == 'Play' or menuselection == 'play':
 play()
 elif menuselection == 'Help' or menuselection == 'help':
 instructions()
 else:
 about()
 

func = {play:play, help:instructions, about:about}
func[menuselection]()
 
 # Creates the game.
 def play():
 global playerscore
 global compscore
 global draws
 # Player chooses Paper, Rock, or Scissors.
 playerselect = input('\nPlease choose Paper, Rock, or Scissors: ')
 # Checks for an invalid selection.
 while playerselect != 'Paper' and playerselect != 'paper' and 
 playerselect != 'Rock' and playerselect != 'rock' \
 and playerselect != 'Scissors' and playerselect != 'scissors':

Again use playerselect not in (pap... form

 print('You have entered an invalid selection.')
 playerselect = input('\nPlease choose Paper, Rock, or Scissors: ')
 else:
 if playerselect == 'Paper' or playerselect == 'paper':
 print('\nYou have selected Paper.')
 playerselect = 1
 elif playerselect == 'Rock' or playerselect == 'rock':
 print('\nYou have selected Rock.')
 playerselect = 2
 else:
 print('\nYou have selected Scissors.')
 playerselect = 3
 # Computer chooses Paper, Rock, or Scissors.
 import random
 compselect = random.randint(1, 3)

You could make life a little easier by using 0 to 2 instead,  here
and above.

 if compselect == 1:
 print('The Computer has selected Paper')
 elif compselect == 2:
 print('The Computer has selected Rock.')
 else:
 print('The Computer has selected Scissors.')

 print (None, paper, rock, scissors)[compselect])

The next section can be simplified a lot by exploiting some
 symmetries. 
diff = (playerselect - compselect ) % 3

This number will be zero for a draw, 1 for computer win, and 2 for
 player win. So you can have 3 cases below instead of
 9.


 # Results if player selects paper.
 if playerselect == 1 and compselect == 1:
 print('Draw!')
 draws += 1
 score()
 else:
 if playerselect == 1 and compselect == 2:
 print('Paper beats rock. You win!')
 playerscore += 1
 score()
 elif playerselect == 1 and compselect == 3:
 print('Paper is beaten by scissors. You lose!')
 compscore += 1
 score()
 # Results if player selects rock.
 if playerselect == 2 and compselect == 2:
 print('Draw!')
 draws += 1
 score()
 else:
 if playerselect == 2 and compselect == 1:
 print('Rock is beaten by paper. You lose!')
 compscore += 1
 score()
 elif playerselect == 2 and compselect == 3:
 print('Rock beats scissors. You win!')
 playerscore += 1
 score()
 # Results if player selects rock.
 if playerselect == 3 and compselect == 3:
 print('Draw!')
 draws += 1
 score()
 else:
 if playerselect == 3 and compselect == 1:
 print('Scissors beat paper. You win!')
 playerscore += 1
 score()
 

Re: How to install and run a script?

2014-10-14 Thread Dave Angel
Michael Torrie torr...@gmail.com Wrote in message:
 On 10/12/2014 08:05 PM, ryguy7272 wrote:
 Ah!!!  I didn't know I needed to run it from the command prompt!  Ok, 
 not it makes sense, and everything works.
 
 Thanks to all!
 
 You don't have to run python apps from the command line.  Apps that
 throw up windows can usually be run by double-clicking the py file in
 windows.  But apps that communicate solely on the terminal or console
 have to be run in that environment.
 
 
 

If the command he's typing starts

python 

Then he needs to run it from the cmd prompt.

-- 
DaveA

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


Re: Jython or Pyton issue-- Kindly Help me....

2014-10-14 Thread Peter Otten
Venugopal Reddy wrote:

 Ok, I will explain my problem in details :
 
 I have below XML:
 
 ?xml version=1.0?
 data
 country name=Liechtenstein
 rank1/rank
 year2008/year
 year2009/year
 gdppc141100/gdppc
 neighbor name=Austria direction=E/
 neighbor name=Switzerland direction=W/
 /country
 country name=Singapore
 rank4/rank
 year2011/year
 gdppc59900/gdppc
 neighbor name=Malaysia direction=N/
 /country
 country name=Panama
 rank68/rank
 year2011/year
 gdppc13600/gdppc
 neighbor name=Costa Rica direction=W/
 neighbor name=Colombia direction=E/
 /country
 /data
 
 
 From I want output below format:
 
 CountrynameRankYeargdppc
 Liechtenstein   1  2008141100
 Singapore   4  201159900
 Panama  68 201113600
 
 Please help how to do it..

Read up on elementtree:

http://pymotw.com/2/xml/etree/ElementTree/parse.html

You can load the data from the file with parse(), get the countries with 
findall(), the name with country_node.attrib[name], and rank, year and 
gdppc with country_node.find(rank).text etc.

If you run into problems come back with some code of yours.


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


Re: windows 7 pysqlite build error

2014-10-14 Thread Robin Becker

On 13/10/2014 22:00, Terry Reedy wrote:

On 10/13/2014 4:31 PM, Dennis Lee Bieber wrote:

On Mon, 13 Oct 2014 10:49:27 +0100, Robin Becker ro...@reportlab.com
declaimed the following:


c:\users\rptlab\tmp\tmcallister\build\pysqlite\src\connection.h(33) : fatal
error C1083: Cannot open include file: 'sqli
te3.h': No such file or directory


Did \n get stuck in the name of the file in connection.h, or is that purely an
artifact of the error reporting?


it's an artefact.

error: command 'c:\\Program Files (x86)\\Microsoft Visual Studio
9.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2



I do have the various compilers installed and other extensions are building OK,
so is this an error in pysqlite or in my general setup? The include path looks
like it might relate to Python builds. I suppose it's feasible that pyqslite
builds need to be installed specially. I don't remember this happening on my old
win32 XP system, but that died and I now am forced to use 64bit win7.


Off hand, you don't have the SQLite3 /development package/.

PySQLite is just an adapter to the sqlite3 DLL; the sqlite3.h file
would be part of the source code for sqlite3, not part of pysqlite itself.




OK so I need to install sqlite3 prior to the pip install. This stuff gets tested 
more on linux and I suppose it's already there.

--
Robin Becker

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


I'm looking to start a team of developers, quants, and financial experts, to setup and manage an auto-trading-money-making-machine

2014-10-14 Thread ryguy7272
I'm looking to start a team of developers, quants, and financial experts, to 
setup and manage an auto-trading-money-making-machine

#1) Setup a VM; must be a Windows machine (maybe Azure)
#2) Load  configure the software (Matlab, Python, R, Excel, and SQL Server)
#3) Develop and test code (Matlab or Pythonmost likely)
#4) Hook into trading tool for order execution (system to be determined; 
depends on API)
#5) Setup a corporate business structure (this is virtually done, we just need 
to flip a switch)
#5) Shop around for clients (if we have a real money-making machine, this 
should be super-easy)


Just so you know, I've done this kind of thing before, using Excel and VBA, as 
well as an execution program called Sterling Trader. It was quite profitable, 
and typically had less than 1 down day in a 22-trading-day month. The system 
was profitable about 95% of the time. However, I don't want to use Excel for 
this project; I want this to be a real system. I think we can use Matlab, or 
Python. If this is project turns out to be very profitable, I know we can raise 
capital very quickly and very easily. At the beginning, I believe it will take 
a fair amount of work, but if we put in the effort, we can have a system that 
constantly monitors the equity markets during trading hours, finds the best 
profit opportunities, according to the trading strategies that we deploy, and 
once it is setup and running, we really won't have to do a whole lot. Ideally, 
once you turn it on, the whole process will require almost no intervention. I 
know this can be done; many banks have groups that do exactly 
 what I'm proposing here. The top hedge funds do this too.

In conclusion, I think the trading strategies that we choose to employ should 
be easy to setup and test (a well-defined Google search will reveal countless 
trading strategies). I think getting the data should be pretty easy as well (we 
can load all kinds of indices into the tool). I think the hard part will be 
developing the automation processes; the tool will have to follow MANY rules 
and run all by itself. Finally, as neither Matlab nor Python are really 
execution tools, we'll have to connect to some type of system that allows us to 
send trade orders. This may, or may not, present somewhat of a challenge.


As an alternative, if we decide we don't want to manage money for other people, 
we could setup the business as a subscription service, and charge users, let's 
say $25k/year or whatever, and let people run simulations in our hosted 
environment, and they can manage money themselves...we simply provide all kinds 
of analytic tools for them to do what they want to do.



Hopefully everyone is close to New York City or Washington DC, or somewhere 
close, like Boston or Philadelphia.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I'm looking to start a team of developers, quants, and financial experts, to setup and manage an auto-trading-money-making-machine

2014-10-14 Thread Skip Montanaro
On Tue, Oct 14, 2014 at 7:16 AM, ryguy7272 ryanshu...@gmail.com wrote:

 I'm looking to start a team of developers, quants, and financial experts,
 to setup and manage an auto-trading-money-making-machine


Two things:

1. That's obviously much easier said than done. (I happen to develop
automated trading systems for a trading firm in Chicago. Like other firms,
we have lots of developers, quants and financial experts on staff. Even for
a well-established company, success isn't guaranteed.)

2. You'd probably be better off with a posting to the Python Job Board
(once it's back up and running).

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


Re: I'm looking to start a team of developers, quants, and financial experts, to setup and manage an auto-trading-money-making-machine

2014-10-14 Thread Marko Rauhamaa
ryguy7272 ryanshu...@gmail.com:

 I'm looking to start a team of developers, quants, and financial
 experts, to setup and manage an auto-trading-money-making-machine

This has already been done: http://en.wikipedia.org/wiki/Sampo


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


Re: CLI framework using python

2014-10-14 Thread vijnaana bhairava
Hi Folks,

The requirement is to develop a CLI framework in python for a linux router.
The suggestions i got is to use PyCli/Cliff. Not sure which would be the right 
choice!  Also, a few APIs are mentioned here: 

https://pythonhosted.org/pyCLI/#module-cli.app

Since i couldn't find any actual implementation which uses pyCli,
i can't figure out how to make use of pyCLI.

Another question i have is whether it uses argparse?
If so, what value add does PYCLI do?

Regards,
vij

On Thursday, October 9, 2014 5:50:51 PM UTC+5:30, vijnaana bhairava wrote:
 Hi,
 
 
 
 I need to develop a python CLI framework.
 
 
 
 For example if i need to set an ip address in linux:
 
 
 
 ifconfig eth0 172.16.25.125
 
 
 
 I should be able to use python to do the above.
 
 
 
 1. The user will execute a python script to which i will pass the params eth0 
 and ip address (something like ifconf.py  eth0 172.16.25.125)
 
 
 
 2. Within the script i grab the params and do something to the effect of user 
 executing 'ifconfig eth0 172.16.25.125' from the shell.
 
 
 
 3. There are other such commands for which i will be using python scripts. I 
 came across pyCLI, but it doesn't have much documentation, so couldn't figure 
 out how to move forward.
 
 
 
 4. The CLI framework needs to reuse code so i didn't want to use pure python 
 and develop a framework from scratch. Rather use something like pyCLI/CLIFF.
 
 
 
 The problem is lack of documentation with examples on how to use the above.
 
 
 
 Any guidance would be greatly appreciated.
 
 
 
 Regards  Thanks,
 
 Vij
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Code Review for Paper, Rock, Scissors

2014-10-14 Thread Chris Angelico
On Tue, Oct 14, 2014 at 7:04 PM, Revenant
faceofoblivionoffic...@gmail.com wrote:
 As previously stated, I am new to Python and would also like to see if any of 
 you programming gurus have some suggestions about how I can simplify code, 
 and also if there are any other good starter programs to work on to improve 
 my skills.


Hi! Happy to help out. But first, there's one meta-suggestion that I'd
like to make: Use something other than Google Groups. As shown by the
line above, Google Groups has some issues with line breaks and text
wrapping; and it gets much worse when you reply to someone else's
post. I suggest using the mailing list instead:

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

Also, it can be helpful to state what version of Python you're using,
and on what platform. Your press any key to quit request suggests
you're probably invoking the script using a GUI, quite possibly
Windows, but that's far from certain; and as Dave's response shows,
the solutions depend on platform. I'm presuming you're using some 3.x
version of Python, as you use input() and print() functions, but I
can't tell whether you're on 3.2, 3.3, 3.4, or even an unreleased 3.5.
It's not likely to make a huge amount of difference with a script this
simple, but as a general rule, more information is better than less.

So, on to the code!

 # Creates the main menu.
 def menu():
 # Sets the scores to 0.
 global playerscore
 global compscore
 global draws
 playerscore = 0
 compscore = 0
 draws = 0

You're importing these globals into several places that don't need
them. The menu shouldn't have to concern itself with these scores; you
could initialize them all to zero at top-level, and then keep the
different functions more self-contained. The displaying of the menu
doesn't logically involve zeroing out the scores; imagine making the
very slight (and quite logical) change of having the full menu
redisplayed after each game, instead of just having the Again? (Y/N)
prompt - suddenly your scores aren't getting carried over.

 menuselection = input('Please enter a selection: (Play/Help/About): ')
 # Checks for an invalid selection.
 while menuselection != 'Play' and menuselection != 'play' and 
 menuselection != 'Help' and menuselection != 'help' \
 and menuselection != 'About' and menuselection != 'about':
 print('You have entered an invalid selection.')
 menuselection = input('\nPlease type a selection: (Play/Help/About): 
 ')
 else:
 if menuselection == 'Play' or menuselection == 'play':
 play()
 elif menuselection == 'Help' or menuselection == 'help':
 instructions()
 else:
 about()

The else clause on a while loop isn't necessary here, because you're
not using break. All you need is to put your code outside the loop.
Alternatively, you can combine the verification and iteration into one
pass, which reduces redundancy and makes it easier to add more
options. I'm also incorporating some suggestions already made,
including Dave's dispatch dictionary.

func = {play:play, help:instructions, about:about}
while True:
menuselection = input('Please enter a selection:
(Play/Help/About): ').lower()
if menuselection in func: break
print('You have entered an invalid selection.')
func[menuselection]()

Note how the loop condition is now inside the loop (if ...: break),
with the while statement simply creating an infinite loop (while
True:).

 def play():
 # Player chooses Paper, Rock, or Scissors.
 playerselect = input('\nPlease choose Paper, Rock, or Scissors: ')

Try to avoid comments that simply state what the next line(s) of code
do. At best, they're redundant; at worst, they're confusing, because
they can get out of sync with the code. Imagine adding a fourth option
(Claw Hammer) and forgetting to change the comment.

(Why claw hammer?
http://www.theregister.co.uk/2003/06/09/the_bastard_interviewer_from_hell/
)

 import random

It's much more common to put your imports at the top of the script,
rather than inside a function.

 # Creates the instructions.
 def instructions():
 print('\nPaper, Rock, Scissors is a simple game played against a computer 
 opponent.')
 print('The player will have a choice of selecting paper, rock, or 
 scissors.')
 print('The player\'s result will be compared with that of the computer to 
 determine who wins the round.')
 print('In the event that both the player and the computer have the same 
 selection, the round will end in a tie.')
 print('\nPaper beats rock but loses to scissors.')
 print('\nRock beats scissors but loses to paper.')
 print('\nScissors beats paper but loses to rock.')
 print('\nGood luck, and have fun!\n')
 menu()

As noted elsewhere, you have mutual recursion happening here. That's
not an advised technique in Python, as you can blow your stack
(there's no tail call optimization here). Much 

Re: I'm looking to start a team of developers, quants, and financial experts, to setup and manage an auto-trading-money-making-machine

2014-10-14 Thread Johann Hibschman
Marko Rauhamaa ma...@pacujo.net writes:

 ryguy7272 ryanshu...@gmail.com:

 I'm looking to start a team of developers, quants, and financial
 experts, to setup and manage an auto-trading-money-making-machine

 This has already been done: http://en.wikipedia.org/wiki/Sampo

And mocked by MST3K (sampo means flavor!):

  https://www.youtube.com/watch?v=cdfUkrbNvwA

-Johann (whose cousins are all Mattinens and Nikkanens)
-- 
https://mail.python.org/mailman/listinfo/python-list


Sqlite3 help

2014-10-14 Thread Chuck
I am building a simple podcast program where I download all the data from a 
feed with feedparser and store the data in sqlite3.  I am spanking new to 
sqlite and database programming.  Should I create the database in the __init__ 
method of my class, or is that a bad idea.  I haven't done any designing that 
included databases.  

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


Re: CLI framework using python

2014-10-14 Thread Chris Angelico
On Wed, Oct 15, 2014 at 12:33 AM, vijnaana bhairava vijna...@gmail.com wrote:
 Another question i have is whether it uses argparse?
 If so, what value add does PYCLI do?

It depends what you mean by CLI framework. If you simply mean
something like hg, where you have subcommands and options and so on,
all you really need is argument parsing. Take the simplest possible
solution and run with it!

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


Short syntax for try/pass

2014-10-14 Thread Leonardo Giordani
Hi all,

a lot of times the following pattern pops out in Python code:

try:
 somecode
except SomeException:
 pass

A very simple example could be if you want to process a list that may be
empty

def process_list(lst):
 try:
  lst[0] = lst[0] + 1
 except IndexError:
  pass

or in more complex cases in which however an exception just signals that
there is nothing to do there.

Converting the code to a non-EAFP version, for example

if len(lst) != 0:
 lst[0] = lst[0] + 1

is in my opinion generally against the Python nature, since it relies on a
specific check on the object, instead of trusting the object as being able
to either satisfy the request or raise an exception. That is, this solution
is non-polymorphic.

In such cases sometimes ABC may help, but generally speaking they it is not
always the case of being an instance of a given ABC or not. The problem
here is if the code raises an exception or not.

Would it be feasible to propose a short syntax like this?

pass SomeException:
  somecode

where the above example would become:

pass IndexError:
 lst[0] = lst[0] + 1

I could not find if such a syntax has been already discussed elsewhere, so
please let me know if this is the case.

Otherwise, what do you think about it?

Thank you

Leonardo



Leonardo Giordani
@tw_lgiordani http://twitter.com/tw_lgiordani - lgiordani.com
My profile on About.me http://about.me/leonardo.giordani - My GitHub page
https://github.com/lgiordani
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: CLI framework using python

2014-10-14 Thread Naoki INADA
Click_ is another CLI framework.

It support multi-level nested command like git and it has some nice utilities.

I love it's design.






.. _click: http://click.pocoo.org/3/




—
Sent from Mailbox

On Tue, Oct 14, 2014 at 10:35 PM, vijnaana bhairava vijna...@gmail.com
wrote:

 Hi Folks,
 The requirement is to develop a CLI framework in python for a linux router.
 The suggestions i got is to use PyCli/Cliff. Not sure which would be the 
 right choice!  Also, a few APIs are mentioned here: 
 https://pythonhosted.org/pyCLI/#module-cli.app
 Since i couldn't find any actual implementation which uses pyCli,
 i can't figure out how to make use of pyCLI.
 Another question i have is whether it uses argparse?
 If so, what value add does PYCLI do?
 Regards,
 vij
 On Thursday, October 9, 2014 5:50:51 PM UTC+5:30, vijnaana bhairava wrote:
 Hi,
 
 
 
 I need to develop a python CLI framework.
 
 
 
 For example if i need to set an ip address in linux:
 
 
 
 ifconfig eth0 172.16.25.125
 
 
 
 I should be able to use python to do the above.
 
 
 
 1. The user will execute a python script to which i will pass the params 
 eth0 and ip address (something like ifconf.py  eth0 172.16.25.125)
 
 
 
 2. Within the script i grab the params and do something to the effect of 
 user executing 'ifconfig eth0 172.16.25.125' from the shell.
 
 
 
 3. There are other such commands for which i will be using python scripts. I 
 came across pyCLI, but it doesn't have much documentation, so couldn't 
 figure out how to move forward.
 
 
 
 4. The CLI framework needs to reuse code so i didn't want to use pure python 
 and develop a framework from scratch. Rather use something like pyCLI/CLIFF.
 
 
 
 The problem is lack of documentation with examples on how to use the above.
 
 
 
 Any guidance would be greatly appreciated.
 
 
 
 Regards  Thanks,
 
 Vij
 -- 
 https://mail.python.org/mailman/listinfo/python-list-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Short syntax for try/pass

2014-10-14 Thread Chris Angelico
On Wed, Oct 15, 2014 at 1:08 AM, Leonardo Giordani
giordani.leona...@gmail.com wrote:
 a lot of times the following pattern pops out in Python code:

 try:
  somecode
 except SomeException:
  pass

 Converting the code to a non-EAFP version, for example

 if len(lst) != 0:
  lst[0] = lst[0] + 1

This could be just if lst:, but I agree, LBYL is not Python's style
(and isn't always possible anyway).

You can at least squish it up onto less lines, which might look better:

try: lst[0] += 1
except IndexError: pass

Alternatively, you can use this style:

from contextlib import suppress

with suppress(IndexError):
lst[0] += 1

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


Re: Short syntax for try/pass

2014-10-14 Thread Ned Batchelder

On 10/14/14 10:08 AM, Leonardo Giordani wrote:

Would it be feasible to propose a short syntax like this?

pass SomeException:
   somecode

where the above example would become:

pass IndexError:
  lst[0] = lst[0] + 1

I could not find if such a syntax has been already discussed elsewhere,
so please let me know if this is the case.

Otherwise, what do you think about it?


PEP 463 proposes a short syntax for this use case: 
http://legacy.python.org/dev/peps/pep-0463/


I'm not sure what became of it.

--
Ned Batchelder, http://nedbatchelder.com

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


Re: Short syntax for try/pass

2014-10-14 Thread Chris Angelico
On Wed, Oct 15, 2014 at 1:28 AM, Ned Batchelder n...@nedbatchelder.com wrote:
 PEP 463 proposes a short syntax for this use case:
 http://legacy.python.org/dev/peps/pep-0463/

 I'm not sure what became of it.

Not quite; PEP 463 is about the case where you then want a different
value instead. I'm fairly sure the PEP is in a virtually rejected
state, but I nudged about it a couple of times and didn't get any
certain response on the subject.

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


downloading from links within a webpage

2014-10-14 Thread Shiva
Hi,

Here is a small code that I wrote that downloads images from a webpage url
specified (you can limit to how many downloads you want). However, I am
looking at adding functionality and searching external links from this page
and downloading the same number of images from that page as well.(And
limiting the depth it can go to)

Any ideas?  (I am using Python 3.4  I am a beginner)

import urllib.request
import re
url=http://www.abc.com;

pagehtml = urllib.request.urlopen(url)
myfile = pagehtml.read()
matches=re.findall(r'http://\S+jpg|jpeg',str(myfile))


for urltodownload in matches[0:50]:
  imagename=urltodownload[-12:]
  urllib.request.urlretrieve(urltodownload,imagename)

print('Done!')
 
Thanks,
Shiva

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


Re: downloading from links within a webpage

2014-10-14 Thread Chris Angelico
On Wed, Oct 15, 2014 at 1:42 AM, Shiva
shivaji...@yahoo.com.dmarc.invalid wrote:
 Here is a small code that I wrote that downloads images from a webpage url
 specified (you can limit to how many downloads you want). However, I am
 looking at adding functionality and searching external links from this page
 and downloading the same number of images from that page as well.(And
 limiting the depth it can go to)

 Any ideas?  (I am using Python 3.4  I am a beginner)

First idea: Use wget, it does all this for you :)

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


Re: downloading from links within a webpage

2014-10-14 Thread Joel Goldstick
On Tue, Oct 14, 2014 at 10:54 AM, Chris Angelico ros...@gmail.com wrote:
 On Wed, Oct 15, 2014 at 1:42 AM, Shiva
 shivaji...@yahoo.com.dmarc.invalid wrote:
 Here is a small code that I wrote that downloads images from a webpage url
 specified (you can limit to how many downloads you want). However, I am
 looking at adding functionality and searching external links from this page
 and downloading the same number of images from that page as well.(And
 limiting the depth it can go to)

 Any ideas?  (I am using Python 3.4  I am a beginner)

 First idea: Use wget, it does all this for you :)

You might look at Requests and BeautifulSoup python modules.  Requests
is easier for many things than urllib.  BS is an HTML parser that may
be easier, and more powerful than what you can do with regex

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



-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: scipy errors and gfortran

2014-10-14 Thread slyost
On Monday, October 13, 2014 1:14:27 PM UTC-5, sly...@ilstu.edu wrote:
 Trying to get scipy 0.14 running on python 3.4.1 on SLES 11 SP2 LINUX system.
 
 Scipy seemed to compile fine using the command python setup.py install but 
 when I try the scipy.test(full), I get errors regarding gfortran.  I am 
 using GCC(gfortran) version 4.9.1.
 
 
 
 The error states that /usr/lib/libgfortran.so.3: version 'gfortran_1.4' was 
 not found (required by).  Google tells me that this is the name of the 
 symbol node whatever that means.
 
 
 
 What do I need to do to fix these errors?  Please help.

Was able to fix the issue with an export of LD_LIBRARY_PATH, thank goodness.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I'm looking to start a team of developers, quants, and financial experts, to setup and manage an auto-trading-money-making-machine

2014-10-14 Thread ryguy7272
On Tuesday, October 14, 2014 9:38:55 AM UTC-4, Johann Hibschman wrote:
 Marko Rauhamaa ma...@pacujo.net writes:
 
 
 
  ryguy7272 ryanshu...@gmail.com:
 
 
 
  I'm looking to start a team of developers, quants, and financial
 
  experts, to setup and manage an auto-trading-money-making-machine
 
 
 
  This has already been done: http://en.wikipedia.org/wiki/Sampo
 
 
 
 And mocked by MST3K (sampo means flavor!):
 
 
 
   https://www.youtube.com/watch?v=cdfUkrbNvwA
 
 
 
 -Johann (whose cousins are all Mattinens and Nikkanens)


Good stuff!  Very funny!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: downloading from links within a webpage

2014-10-14 Thread Rustom Mody
On Tuesday, October 14, 2014 8:12:56 PM UTC+5:30, Shiva wrote:
 Hi,

 Here is a small code that I wrote that downloads images from a webpage url
 specified (you can limit to how many downloads you want). However, I am
 looking at adding functionality and searching external links from this page
 and downloading the same number of images from that page as well.(And
 limiting the depth it can go to)

 Any ideas?  (I am using Python 3.4  I am a beginner)

 import urllib.request
 import re

Read this:
http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454
-- 
https://mail.python.org/mailman/listinfo/python-list


Parsing Python dictionary with multiple objects

2014-10-14 Thread anuragpatibandla7
I have a dictionary that looks like this:
{1:{Key1:Value1, Key2:Value2, Key3:Value3}, 
2:{Key1:Value1, Key2:Value2, Key3:Value3}, 
3:{Key1:Value1, Key2:Value2, Key3:Value3}, 
4:{Key1:Value1, Key2:Value2, Key3:Value3}}

Now if I have 100 objects like these and I need to split them into 3 smaller 
dicts in a ratio 2:3:5, how could I do that?
I tried using numpy.random.choice(), but it says it needs to be a 1-d array.

Can someone please help with this?
Thanks
-- 
https://mail.python.org/mailman/listinfo/python-list


Re:Parsing Python dictionary with multiple objects

2014-10-14 Thread Dave Angel
anuragpatiband...@gmail.com Wrote in message:
 I have a dictionary that looks like this:
 {1:{Key1:Value1, Key2:Value2, Key3:Value3}, 
 2:{Key1:Value1, Key2:Value2, Key3:Value3}, 
 3:{Key1:Value1, Key2:Value2, Key3:Value3}, 
 4:{Key1:Value1, Key2:Value2, Key3:Value3}}
 
 Now if I have 100 objects like these and I need to split them into 3 smaller 
 dicts in a ratio 2:3:5, how could I do that?

I really have no idea what that means.  You have 100 dicts of
 dicts? Are the keys unique? If so, you could combine them with a
 loop of update.

 I tried using numpy.random.choice(), but it says it needs to be a 1-d array.
 

How about random.choice?  It needs a sequence.

To get anything more concrete, you need to specify Python version,
  and make a clearer problem statement,  perhaps with example of
 what you expect.


-- 
DaveA

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


GENIUS, KING MIDAS, CIVIL HERO MICHELE NISTA micheleni...@gmx.com + 44 (0) 7939508007! HE GET IT RIGHT ON WORLDWIDE STOCKS, CURRENCIES COMMODITIES ALWAYS! ABOUT 5000 PREDICTIONS ON INTERNET SINCE 9.

2014-10-14 Thread MICHELE CALZOLARI CREDIT SUISSE ASSOSIM
 GENIUS, KING MIDAS, CIVIL HERO MICHELE NISTA micheleni...@gmx.com + 44 (0) 
7939508007! HE GET IT RIGHT ON WORLDWIDE STOCKS, CURRENCIES  COMMODITIES 
ALWAYS! ABOUT 5000 PREDICTIONS ON INTERNET SINCE 9.2007: 5000 SUCCESS! 100% 
SHOCKING WINNING SCORE!!! GENIUS, KING MIDAS, CIVIL HERO MICHELE NISTA 
(micheleni...@gmx.com+ 44 (0) 7939508007) ADVANCED IN EXTREMELY PERFECT WAY THE 
CONTINUOUS WALL STREET CRASH OF 1987 ( AND HE WAS, MORE OR LESS, JUST 20, AT 
THE TIME)! AS THE ONE OF 2007, 2008 AND BEGINNING OF 2009 WITH JUST 1 AND 
HALF YEAR OF INCREDIBLY WINNING FORETASTE! GENIUS, KING MIDAS, CIVIL HERO 
MICHELE NISTA micheleni...@gmx.com AVDANCED IN EXTREMELY PERFECT WAY, THEN, THE 
MORE OF DOUBLING OF WALL STREET, SINCE 3.2009! HE PROPHESIED ALL THIS ON 
INTERNET, AGAIN, WITH MONTHS AND MONTHS IN ADVANCE! ALL AT FANTASTIC LIGHT OF 
SUNSHINE!!! ALL PROVABLE AND VISIBLE STILL NOW!!! GENIUS, KING MIDAS, CIVIL 
HERO MICHELE NISTA (micheleni...@gmx.com + 44 (0) 7939508007) WAS ONE OF THE 
NUMBER ON
 ES OF ITALIAN STOCK EXCHANGE, IN THE 90S, PRODUCING OVER 10 MILIONS OF EUROS 
OF COMMISSIONS OF THE 90S ( SO, 15 MILIONS OF NOW), FROM BELOW ZERO: WAS THE 
ABSOLUTE IDOL OF GOLDMAN SACHS, MERRILL LYNCH, AND NEARLY ANY FOR GOOD 
INVESTMENT BANK IN THE WORLD! THAT'S WHY EVERYONE WAS GIVING HIM AND STILL GIVE 
HIM THE NICK OF KING MIDAS! INGENIOUS HERO MICHELE NISTA HAS A GREAT HEART TOO, 
NOT JUST A SORT OF INVINCIBLE INTUITION! HE DEDICATES, SINCE HE WAS 17, ALL 
HIS GIFTS OF HEAVEN HE HAS TO POOREST PEOPLE IN THE WORLD, VOLUNTEERING AND NOT 
ONLY, FOR MANY ORGANIZATIONS SAVING OR IMPROVING SUFFERING LIVES IN LATIN 
AMERICA AND AFRICA. HE IS CERTAINLY A CIVIL INCORRUPTIBLE HERO TOO! IN THE LAST 
21 YEARS, IN MILAN, WAS THE MOST TENACIOUS MAN HUNTING TO DESTROY THE ASSASSIN 
DICTATORSHIP OF MAFIOSO, MEGA MAFIA MONEY LAUNDERER, EXTREME NAZIFASCIST, LIAR, 
MEGA THIEF, CORRUPTING PIG, PRINCIPAL OF HUNDREDS OF MURDERS AND SLAUGHTERS, 
VERY ASCERTAINED PEDOPHILE SILVIO BERLUSCONI! FOR ALL THIS, T
 HERE WERE FOUR ATTEMPTS OF KILLING HIM, ORDERED BY BASTARD SANGUINARY, AS WELL 
AS METASTASES OF THE ENTIRE WORLD: SILVIO BERLUSCONI!!! AND HIS FATHER LOST 
LIFE ON ORDER OF NAZIFASCIST AND COSA NOSTRA'S BRUTAL, VICIOUS, CRUEL, 
FEROCIOUS PRINCIPAL OF KILLING SILVIO BERLUSCONI ( MAKING SHREWDLY TO PASS, VIA 
HIS PRIVATE OR PUBLIC NEW OVRA, GESTAPO AND DINA AL HIS ABSOLUTE REPELLENT 
HINDREDS OF HOMICIDES FOR FALSE ACCIDENTS, FALSE SUICIDES, FALSE ILLNESS, ALL 
THE TIMES)! AS A MATTER OF FACT, GENIUS, KING MIDAS, DEMOCRAT HERO MICHELE 
NISTA micheleni...@gmx.com + 44 (0) 7939508007  DECIDED TO EMIGRATE TO 
LONDON, ON 2003, TO REMAIN ALIVE!! BUT GOD, IF HE'LL CONTINUE TO DESERVE SO, 
WILL MAKE HIM WIN!!! GROUP OF FRIENDS AND CLIENTS, EXTREMELY GRATEFUL TO THIS 
KING MIDAS, TO THIS INGENIOUS AND CIVIL HERO OF OUR TIMES: MICHELE NISTA 
(micheleni...@gmx.com + 44 (0) 7939508007)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re:downloading from links within a webpage

2014-10-14 Thread Dave Angel
Shiva shivaji...@yahoo.com.dmarc.invalid Wrote in message:
 Hi,
 
 Here is a small code that I wrote that downloads images from a webpage url
 specified (you can limit to how many downloads you want). However, I am
 looking at adding functionality and searching external links from this page
 and downloading the same number of images from that page as well.(And
 limiting the depth it can go to)
 
 Any ideas?  (I am using Python 3.4  I am a beginner)
 
 import urllib.request
 import re
 url=http://www.abc.com;
 
 pagehtml = urllib.request.urlopen(url)
 myfile = pagehtml.read()
 matches=re.findall(r'http://\S+jpg|jpeg',str(myfile))
 
 
 for urltodownload in matches[0:50]:
   imagename=urltodownload[-12:]
   urllib.request.urlretrieve(urltodownload,imagename)
 
 print('Done!')
  
 Thanks,
 Shiva
 
 

I'm going to make the wild assumption that you can safely do both
 parses using regex, and that finding the jpegs works well enough
 with your present one.

First thing is to make most of your present code a function
 fetch(), starting with pagehtml and ending before the print. The
 function should take two arguments,  url and depthlimit.

Now, at the end of the function,  add something like

If depthlimit  0:
matches = ... some regex that finds links
for link in matches [:40]:
 fetch (link, depthlimit - 1)

Naturally, the rest of the top level code needs to be moved after
 the function definition,  and is called by doing something
 like:

fetch (url, 10)   to have a depth limit of 10.

-- 
DaveA

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


strange thing that disturbs

2014-10-14 Thread tntsugar
hello guys,

for half an hour now i am searching for something simple...

not IRC, not Fakebook, not Twitter...

simply an email where i can ask a question to a problem i have in python
3.4.2 and the tkinter (it doesnt seem to be present and doesnt react to the
python -m tkinter -module not present-)...

can you please tell me where i can find help here... i would like to learn
python but... 

greetings

G.

p.s. i dont use twitter, irc or fakebook...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: strange thing that disturbs

2014-10-14 Thread Skip Montanaro
On Tue, Oct 14, 2014 at 1:13 PM, tntsu...@googlemail.com wrote:

 it doesnt seem to be present and doesnt react to the python -m tkinter
 -module not present


I don't know how it's spelled in 3.4.x, but in 2.7 it's spelled Tkinter.
Give that a try. (Sorry, no 3.4 install handy or I'd verify it myself.)

The other alternative is that the tkinter module wasn't built when you
installed Python because the build system couldn't find Tcl or Tk libraries
to link to. If that's the case, let us know your computing platform
(Windows, Linux/Unix, MacOSX) and how 3.4 was installed on your system.

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


Re: strange thing that disturbs

2014-10-14 Thread Skip Montanaro
Adding python-list back into the CC list. I know nothing about Windows.
Perhaps someone else here can help. (Sorry about the top post all you
bottom post mavens. It seemed warranted in this case...)

Skip

On Tue, Oct 14, 2014 at 2:10 PM, tntsu...@googlemail.com wrote:

 hi,

 thank you so much for the quick reply :-D

 i run win7 home premium...

 during the installation of python 3.4.2 i have seen the tcl/tk option
 activated!

 the change between the T and t i tried but still the module wasnt found...

 ... ... ...

 its strange... you know... i dealed with C, C++, and many other
 programming languages and it was ALWAYS the same... never it was easy and
 always there was a problem with the instalation or the editor... even
 buying a book never it was like described in the book and i got stuck at a
 point where the example in the book and the software didnt match... so that
 happening noow isnt something new to me...

 another question that you might be able to help me is if you can recommend
 me a simple editor for writing python programs... right now i took IEP...
 any tips?

 be well and thank you!

 GD

 p.s. i only installed 3.4.2... thats enough right? or do i have to install
 the 2.X version as well?

 2014-10-14 20:32 GMT+02:00 Skip Montanaro skip.montan...@gmail.com:


 On Tue, Oct 14, 2014 at 1:13 PM, tntsu...@googlemail.com wrote:

 it doesnt seem to be present and doesnt react to the python -m tkinter
 -module not present


 I don't know how it's spelled in 3.4.x, but in 2.7 it's spelled
 Tkinter. Give that a try. (Sorry, no 3.4 install handy or I'd verify it
 myself.)

 The other alternative is that the tkinter module wasn't built when you
 installed Python because the build system couldn't find Tcl or Tk libraries
 to link to. If that's the case, let us know your computing platform
 (Windows, Linux/Unix, MacOSX) and how 3.4 was installed on your system.

 Skip



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


stressing problem with Python 3.3.3 / 2.7.6 and Mac OS 10.9 Mavericks

2014-10-14 Thread Wolfgang Maier

Hi,

I'm not a regular MacPython user, but today I had to build Mac wheels 
for different versions of Python. To test the wheel files I set up a 
fresh Mac OS 10.9 Mavericks and and installed Python 3.2, 3.3, 3.4 from 
the python.org download page on it. Then I struggled for the rest of the 
afternoon to try to figure out why Python 3.2 crashed when I used my 
package in interactive mode until I finally realized that it's not the 
package but Python that's responsible.


Turns out that I had run into http://bugs.python.org/issue18458 which 
probably every MacPython user here is so familiar with that the download 
page doesn't even mention it ? ;)


Seriously, I think the official download page for a OS shouldn't offer 
me a version that will not work well with the latest version of that OS 
without a warning. Why not add such a warning (like: versions below will 
crash in interactive mode on Mac OS 10.9) in the list of downloads at 
https://www.python.org/downloads/mac-osx/ between Python 2.7.6 (the 
first version with the issue fixed) and Python 3.2.5 (the last affected 
version).


Wolfgang

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


Re: stressing problem with Python 3.3.3 / 2.7.6 and Mac OS 10.9 Mavericks

2014-10-14 Thread Ned Deily
In article m1juu7$tmn$1...@ger.gmane.org,
 Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de wrote:
 I'm not a regular MacPython user, but today I had to build Mac wheels 
 for different versions of Python. To test the wheel files I set up a 
 fresh Mac OS 10.9 Mavericks and and installed Python 3.2, 3.3, 3.4 from 
 the python.org download page on it. Then I struggled for the rest of the 
 afternoon to try to figure out why Python 3.2 crashed when I used my 
 package in interactive mode until I finally realized that it's not the 
 package but Python that's responsible.
 
 Turns out that I had run into http://bugs.python.org/issue18458 which 
 probably every MacPython user here is so familiar with that the download 
 page doesn't even mention it ? ;)
 
 Seriously, I think the official download page for a OS shouldn't offer 
 me a version that will not work well with the latest version of that OS 
 without a warning. Why not add such a warning (like: versions below will 
 crash in interactive mode on Mac OS 10.9) in the list of downloads at 
 https://www.python.org/downloads/mac-osx/ between Python 2.7.6 (the 
 first version with the issue fixed) and Python 3.2.5 (the last affected 
 version).

Sorry you ran into that problem.  Unfortunately, that's a general 
problem when using older versions of Python that are in 
security-fix-only mode, e.g. those no longer in active maintenance mode. 
Currently only 3.2.x and 3.3.x are in that category.

The only changes made to a security branch are those fixing issues 
exploitable by attackers such as crashes, privilege escalation and, 
optionally, other issues such as denial of service attacks. Any other 
changes are not considered a security risk and thus not backported to a 
security branch.

https://docs.python.org/devguide/devcycle.html#security-branches

Fixes for new operating system releases do not fall in this category.  
There are certainly other problems that one will run into on platform 
releases newer than those supported and tested at the time of the final 
maintenance release.  However, we did add a warning about this 
particular issue to the release page of the final security release of 
2.6.x.  That warning is now copied into the 3.2.6 release page.

In the future, if you encounter problems with the python.org website, 
follow the Help link at the bottom of each page to the website issue 
tracker.

-- 
 Ned Deily,
 n...@acm.org

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


Re: stressing problem with Python 3.3.3 / 2.7.6 and Mac OS 10.9 Mavericks

2014-10-14 Thread Wolfgang Maier

On 14.10.2014 22:30, Ned Deily wrote:

In article m1juu7$tmn$1...@ger.gmane.org,
  Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de wrote:

I'm not a regular MacPython user, but today I had to build Mac wheels
for different versions of Python. To test the wheel files I set up a
fresh Mac OS 10.9 Mavericks and and installed Python 3.2, 3.3, 3.4 from
the python.org download page on it. Then I struggled for the rest of the
afternoon to try to figure out why Python 3.2 crashed when I used my
package in interactive mode until I finally realized that it's not the
package but Python that's responsible.

Turns out that I had run into http://bugs.python.org/issue18458 which
probably every MacPython user here is so familiar with that the download
page doesn't even mention it ? ;)

Seriously, I think the official download page for a OS shouldn't offer
me a version that will not work well with the latest version of that OS
without a warning. Why not add such a warning (like: versions below will
crash in interactive mode on Mac OS 10.9) in the list of downloads at
https://www.python.org/downloads/mac-osx/ between Python 2.7.6 (the
first version with the issue fixed) and Python 3.2.5 (the last affected
version).


Sorry you ran into that problem.  Unfortunately, that's a general
problem when using older versions of Python that are in
security-fix-only mode, e.g. those no longer in active maintenance mode.
Currently only 3.2.x and 3.3.x are in that category.

The only changes made to a security branch are those fixing issues
exploitable by attackers such as crashes, privilege escalation and,
optionally, other issues such as denial of service attacks. Any other
changes are not considered a security risk and thus not backported to a
security branch.

https://docs.python.org/devguide/devcycle.html#security-branches

Fixes for new operating system releases do not fall in this category.
There are certainly other problems that one will run into on platform
releases newer than those supported and tested at the time of the final
maintenance release.  However, we did add a warning about this
particular issue to the release page of the final security release of
2.6.x.  That warning is now copied into the 3.2.6 release page.



Thanks for the fast response, Ned.

I fully understand how the issue arose and why it hasn't been fixed. No 
complaints about that.
I just thought that, if you cannot use the interactive interpreter on a 
standard version of the OS you're downloading for, that deserves a 
prominent mention.


The added warning in the 3.2.6 release page may have saved me a bit of 
searching *after* I figured out what's going on, but I wouldn't have 
discovered it *before* downloading.



In the future, if you encounter problems with the python.org website,
follow the Help link at the bottom of each page to the website issue
tracker.



Thanks for pointing that out. I thought such a link must exist, but 
posting to this list seemed simpler than looking for it. I'll remember 
it for next time.


Best,
Wolfgang
--
https://mail.python.org/mailman/listinfo/python-list


Re: Parsing Python dictionary with multiple objects

2014-10-14 Thread Anurag Patibandla
On Tuesday, October 14, 2014 12:59:27 PM UTC-4, Dave Angel wrote:
 anuragpatiband...@gmail.com Wrote in message:
 
  I have a dictionary that looks like this:
 
  {1:{Key1:Value1, Key2:Value2, Key3:Value3}, 
 
  2:{Key1:Value1, Key2:Value2, Key3:Value3}, 
 
  3:{Key1:Value1, Key2:Value2, Key3:Value3}, 
 
  4:{Key1:Value1, Key2:Value2, Key3:Value3}}
 
  
 
  Now if I have 100 objects like these and I need to split them into 3 
  smaller dicts in a ratio 2:3:5, how could I do that?
 
 
 
 I really have no idea what that means.  You have 100 dicts of
 
  dicts? Are the keys unique? If so, you could combine them with a
 
  loop of update.
 
 
 
  I tried using numpy.random.choice(), but it says it needs to be a 1-d array.
 
  
 
 
 
 How about random.choice?  It needs a sequence.
 
 
 
 To get anything more concrete, you need to specify Python version,
 
   and make a clearer problem statement,  perhaps with example of
 
  what you expect.
 
 
 
 
 
 -- 
 
 DaveA

Hey DaveA,
I am using Python 2.7.
Yes. I have a dict of dicts with keys ranging from 1..100
And the value of each of these keys is another dict. What I need to do is make 
3 smaller dicts and assign the values of keys 1..100 in the ratio 2:3:5.
For example, if my original dict is 

d={1:{Key1:Value1, Key2:Value2, Key3:Value3}, 
   2:{Key1:Value1, Key2:Value2, Key3:Value3}, 
   3:{Key1:Value1, Key2:Value2, Key3:Value3}, 
   4:{Key1:Value1, Key2:Value2, Key3:Value3}}
   ...
   ...
  100:{Key1:Value1, Key2:Value2, Key3:Value3}

I need to have three dicts d1, d2, d3 with d1 containing the values of first 20 
keys, d2 containing the values on next 30 keys and d3 containing the values of 
the next 50.
Can you please help me with this?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parsing Python dictionary with multiple objects

2014-10-14 Thread Skip Montanaro
Shuffle the keys, then grab the first 20 for one dictionary, the next 30
for the second, and the last 50 for the third.

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


Re: strange thing that disturbs

2014-10-14 Thread Terry Reedy

i run win7 home premium.
during the installation of python 3.4.2 i have seen the tcl/tk
option activated!


Then python -m tkinter in Command Prompt should bring up a tk windows 
with a bit a text and two buttons, one for exit. First try to find 
Python 3.4 on the Start menu and start Python 3.4 (command   Then 
try import sys, then import tkinter.  If this does not work, try 
re-installing.


If you respond, do so to the list, not me.

--
Terry Jan Reedy

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


Re: Parsing Python dictionary with multiple objects

2014-10-14 Thread Anurag Patibandla
On Tuesday, October 14, 2014 5:33:01 PM UTC-4, Skip Montanaro wrote:
 Shuffle the keys, then grab the first 20 for one dictionary, the next 30 for 
 the second, and the last 50 for the third.
 
 Skip

Could you please be more specific?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parsing Python dictionary with multiple objects

2014-10-14 Thread MRAB

On 2014-10-14 22:15, Anurag Patibandla wrote:

On Tuesday, October 14, 2014 12:59:27 PM UTC-4, Dave Angel wrote:

anuragpatiband...@gmail.com Wrote in message:

 I have a dictionary that looks like this:
 {1:{Key1:Value1, Key2:Value2, Key3:Value3},
 2:{Key1:Value1, Key2:Value2, Key3:Value3},
 3:{Key1:Value1, Key2:Value2, Key3:Value3},
 4:{Key1:Value1, Key2:Value2, Key3:Value3}}

 Now if I have 100 objects like these and I need to split them into 3 smaller 
dicts in a ratio 2:3:5, how could I do that?

I really have no idea what that means.  You have 100 dicts of
 dicts? Are the keys unique? If so, you could combine them with a
 loop of update.

 I tried using numpy.random.choice(), but it says it needs to be a 1-d array.


How about random.choice?  It needs a sequence.

To get anything more concrete, you need to specify Python version,
and make a clearer problem statement,  perhaps with example of
what you expect.



Hey DaveA,
I am using Python 2.7.
Yes. I have a dict of dicts with keys ranging from 1..100
And the value of each of these keys is another dict. What I need to do is make 
3 smaller dicts and assign the values of keys 1..100 in the ratio 2:3:5.
For example, if my original dict is

d={1:{Key1:Value1, Key2:Value2, Key3:Value3},
2:{Key1:Value1, Key2:Value2, Key3:Value3},
3:{Key1:Value1, Key2:Value2, Key3:Value3},
4:{Key1:Value1, Key2:Value2, Key3:Value3}}
...
...
   100:{Key1:Value1, Key2:Value2, Key3:Value3}

I need to have three dicts d1, d2, d3 with d1 containing the values of first 20 
keys, d2 containing the values on next 30 keys and d3 containing the values of 
the next 50.
Can you please help me with this?


You can get a list of the entries using the dict's .items method. It's
then a simple matter of slicing the list.

Note that dicts aren't ordered, i.e. its keys aren't in a fixed order,
so if you want then in a particular order, you'll need to sort the list.
--
https://mail.python.org/mailman/listinfo/python-list


Re: while loop - multiple condition

2014-10-14 Thread giacomo boffi
Tim Chase python.l...@tim.thechases.com writes:

 On 2014-10-12 22:16, Marko Rauhamaa wrote:
 is equivalent with
 
 while ans.lower()[0] != 'y':
  ans = input('Do you like python?')

 And still better improved with

   while ans[:1].lower() != 'y':
 ans = input('Do you like python?')

 yok is Turkish for an EMPHATIC NO
(or, at least, that's what I was led to think many years ago)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: while loop - multiple condition

2014-10-14 Thread Chris Angelico
On Wed, Oct 15, 2014 at 10:04 AM, giacomo boffi pec...@pascolo.net wrote:
 Tim Chase python.l...@tim.thechases.com writes:

 On 2014-10-12 22:16, Marko Rauhamaa wrote:
 is equivalent with

 while ans.lower()[0] != 'y':
  ans = input('Do you like python?')

 And still better improved with

   while ans[:1].lower() != 'y':
 ans = input('Do you like python?')

  yok is Turkish for an EMPHATIC NO
 (or, at least, that's what I was led to think many years ago)

Corrupted core, are you ready to start the procedure?
What do you think?
Interpreting vague answer as: Yes!

If your program misinterprets a non-English response to an English
question, that's not critical. It just means you haven't implemented
full i18n. :)

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


Re:Parsing Python dictionary with multiple objects

2014-10-14 Thread Dave Angel
anuragpatiband...@gmail.com Wrote in message:
 I have a dictionary that looks like this:
 {1:{Key1:Value1, Key2:Value2, Key3:Value3}, 
 2:{Key1:Value1, Key2:Value2, Key3:Value3}, 
 3:{Key1:Value1, Key2:Value2, Key3:Value3}, 
 4:{Key1:Value1, Key2:Value2, Key3:Value3}}
 
 Now if I have 100 objects like these and I need to split them into 3 smaller 
 dicts in a ratio 2:3:5, how could I do that?
 I tried using numpy.random.choice(), but it says it needs to be a 1-d array.

 

What have you actually tried? You haven't shown any actual code.

Look up the method dict.keys, and see how you might use that. Then
 look up random.shuffle, and see what it would do. Also look up
 dict.sort, since your two messages on this thread imply two
 conflicting goals as to which sub dictionaries should go in which
 of your buckets. 

As for extracting 20% of the keys, slicing is your answer. If
 there are 100 keys, 20, 30, and 50 need to be sliced
 off.

Then you'll need a loop to build each result dictionary from its keys.

There are shortcuts,  but it's best to learn the fundamentals first.

Try writing the code. If it doesn’t all work show us what you've
 tried, and what you think is wrong. And when you get an
 exception, show the whole traceback,  don't just paraphrase one
 of the lines.


-- 
DaveA

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


Is there an easy way to control indents in Python

2014-10-14 Thread ryguy7272
I'm just learning Python.  It seems like indents are EXTREMELY important.  I 
guess, since there are no brackets, everything is controlled by indents.  Well, 
I'm reading a couple books on Python now, and in almost all of the examples 
they don't have proper indents, so when I copy/paste the code (from the PDF to 
the IDE) the indents are totally screwed up.  I'm thinking that there should be 
some control, or setting, for this.  I hope.  :)

I have PyCharm 3.4 and Python 3.4.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there an easy way to control indents in Python

2014-10-14 Thread Juan Christian
Using PyCharm is easy:

File  Settings  (IDE Settings) Editor  Smart Keys  Reformat on paste 
choose Reformat Block

On Tue, Oct 14, 2014 at 11:13 PM, ryguy7272 ryanshu...@gmail.com wrote:

 I'm just learning Python.  It seems like indents are EXTREMELY important.
 I guess, since there are no brackets, everything is controlled by indents.
 Well, I'm reading a couple books on Python now, and in almost all of the
 examples they don't have proper indents, so when I copy/paste the code
 (from the PDF to the IDE) the indents are totally screwed up.  I'm thinking
 that there should be some control, or setting, for this.  I hope.  :)

 I have PyCharm 3.4 and Python 3.4.
 --
 https://mail.python.org/mailman/listinfo/python-list

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


Re: Is there an easy way to control indents in Python

2014-10-14 Thread Chris Angelico
On Wed, Oct 15, 2014 at 1:13 PM, ryguy7272 ryanshu...@gmail.com wrote:
 I'm just learning Python.  It seems like indents are EXTREMELY important.  I 
 guess, since there are no brackets, everything is controlled by indents.  
 Well, I'm reading a couple books on Python now, and in almost all of the 
 examples they don't have proper indents, so when I copy/paste the code (from 
 the PDF to the IDE) the indents are totally screwed up.  I'm thinking that 
 there should be some control, or setting, for this.  I hope.  :)


That probably depends on the person who made the PDF. You may simply
have to copy and paste one line at a time; if you're using an editor
that understands Python syntax, it'll do some of your indenting for
you, and you'll just have to manually mark the unindents.
Alternatively, just paste it all in without indentation, then go
through and select blocks of code and hit Tab; in many editors,
that'll indent the selected code by one level. But ultimately, the
fault is almost certainly with the PDF.

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


Re: Parsing Python dictionary with multiple objects

2014-10-14 Thread Rustom Mody
On Wednesday, October 15, 2014 7:35:18 AM UTC+5:30, Dave Angel wrote:
 anurag Wrote in message:
  I have a dictionary that looks like this:
  {1:{Key1:Value1, Key2:Value2, Key3:Value3}, 
  2:{Key1:Value1, Key2:Value2, Key3:Value3}, 
  3:{Key1:Value1, Key2:Value2, Key3:Value3}, 
  4:{Key1:Value1, Key2:Value2, Key3:Value3}}
  Now if I have 100 objects like these and I need to split them into 3 
  smaller dicts in a ratio 2:3:5, how could I do that?
  I tried using numpy.random.choice(), but it says it needs to be a 1-d array.


 What have you actually tried? You haven't shown any actual code.

 Look up the method dict.keys, and see how you might use that. Then
  look up random.shuffle, and see what it would do. Also look up
  dict.sort, since your two messages on this thread imply two
  conflicting goals as to which sub dictionaries should go in which
  of your buckets. 

 As for extracting 20% of the keys, slicing is your answer. If
  there are 100 keys, 20, 30, and 50 need to be sliced
  off.

 Then you'll need a loop to build each result dictionary from its keys.

 There are shortcuts,  but it's best to learn the fundamentals first.

 Try writing the code. If it doesn't all work show us what you've
  tried, and what you think is wrong. And when you get an
  exception, show the whole traceback,  don't just paraphrase one
  of the lines.

Yes that is what is in general expected out here -- code --
maybe working, maybe not, maybe incomplete, maybe 'pseudo' etc
Then others here will improve it

However there is one conceptual thing that perhaps should be mentioned: order.

Is your data *essentially* ordered?

And by 'essentially' I mean you think of it independent of python.
Yeah in python dicts are unordered and lists are ordered and one can fudge
one to behave a bit like the other.  But before you fudge, please ponder which
you really need/want.

Below a bit of going from one to other 


# dict - list
 d = {a:1,b:2,c:3}
 d
{'a': 1, 'c': 3, 'b': 2}
 list(d)
['a', 'c', 'b']

# alternate
 d.keys()
['a', 'c', 'b']

 d.items()
[('a', 1), ('c', 3), ('b', 2)]
 d.values()
[1, 3, 2]

# list - dict
 dict(d.items())
{'a': 1, 'c': 3, 'b': 2}

# round-tripping
 dict(d.items()) == d
True
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there an easy way to control indents in Python

2014-10-14 Thread Dan Stromberg
On Tue, Oct 14, 2014 at 7:13 PM, ryguy7272 ryanshu...@gmail.com wrote:
 I'm just learning Python.  It seems like indents are EXTREMELY important.  I 
 guess, since there are no brackets, everything is controlled by indents.  
 Well, I'm reading a couple books on Python now, and in almost all of the 
 examples they don't have proper indents, so when I copy/paste the code (from 
 the PDF to the IDE) the indents are totally screwed up.  I'm thinking that 
 there should be some control, or setting, for this.  I hope.  :)

Perhaps if you share a screenshot of your PDF and the name of your PDF
viewer, we can help you more.

Here's a URL about Python and Whitespace:
http://stromberg.dnsalias.org/~strombrg/significant-whitespace.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there an easy way to control indents in Python

2014-10-14 Thread Zachary Ware
On Tue, Oct 14, 2014 at 9:18 PM, Chris Angelico ros...@gmail.com wrote:
 On Wed, Oct 15, 2014 at 1:13 PM, ryguy7272 ryanshu...@gmail.com wrote:
 I'm just learning Python.  It seems like indents are EXTREMELY important.  I 
 guess, since there are no brackets, everything is controlled by indents.  
 Well, I'm reading a couple books on Python now, and in almost all of the 
 examples they don't have proper indents, so when I copy/paste the code (from 
 the PDF to the IDE) the indents are totally screwed up.  I'm thinking that 
 there should be some control, or setting, for this.  I hope.  :)


 That probably depends on the person who made the PDF. You may simply
 have to copy and paste one line at a time; if you're using an editor
 that understands Python syntax, it'll do some of your indenting for
 you, and you'll just have to manually mark the unindents.
 Alternatively, just paste it all in without indentation, then go
 through and select blocks of code and hit Tab; in many editors,
 that'll indent the selected code by one level. But ultimately, the
 fault is almost certainly with the PDF.

Agreed, although I'd say the PDF viewer could also be at fault.
Earlier today I tried to copy just a paragraph of mostly plain text
from the Firefox built-in PDF viewer, but when pasting it elsewhere,
it was pasted one character per line.  Opening it in the Windows 8.1
default PDF viewer (of all things...), copying and pasting worked like
a charm.

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


Re: Is there an easy way to control indents in Python

2014-10-14 Thread Chris Angelico
On Wed, Oct 15, 2014 at 1:35 PM, Zachary Ware
zachary.ware+pyl...@gmail.com wrote:
 But ultimately, the
 fault is almost certainly with the PDF.

 Agreed, although I'd say the PDF viewer could also be at fault.

Good point, there are some really terrible PDF viewers around. Either
way, the workaround of grabbing one line at a time will be effective -
albeit tedious for anything more than a dozen lines or so.

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


Re: Parsing Python dictionary with multiple objects

2014-10-14 Thread Anurag Patibandla
Thanks for the response.
Here is the code that I have tried.

from operator import itemgetter
keys = json.keys()
order = list(keys)
q1 = int(round(len(keys)*0.2))
q2 = int(round(len(keys)*0.3))
q3 = int(round(len(keys)*0.5))
b = [q1,q2,q3]
n=0
for i in b:
queues = order[n:n+i]

n = n+i
print queues

for j in range(len(queues)):
q = (queues[j], json.get(queues[j]))
print q

By this I am able to get the 3 smaller dicts I want, but can you help me assign 
them to 3 variables?
The dicts need not be ordered but it would be better if they are ordered.

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


Re: Parsing Python dictionary with multiple objects

2014-10-14 Thread Anurag Patibandla
'json' has my original larger dict
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parsing Python dictionary with multiple objects

2014-10-14 Thread Rustom Mody
On Wednesday, October 15, 2014 9:10:54 AM UTC+5:30, Anurag Patibandla wrote:
 Thanks for the response.
 Here is the code that I have tried.

 from operator import itemgetter
 keys = json.keys()
 order = list(keys)
 q1 = int(round(len(keys)*0.2))
 q2 = int(round(len(keys)*0.3))
 q3 = int(round(len(keys)*0.5))
 b = [q1,q2,q3]
 n=0
 for i in b:
 queues = order[n:n+i]

 n = n+i
 print queues

 for j in range(len(queues)):
 q = (queues[j], json.get(queues[j]))
 print q

Converting the end for loop (last 3 lines) into:


print [(queues[j], json.get(queues[j])) for j in range(len(queues))]

Does that help?

General advice:
1. Instead of writing 'naked' code as you have done, if you wrap it into
functions (preferably small)
2. Contents similar to the original naked code but with print's replaced by 
return's

you make your as well as those trying to help/collaborate with you
life easier

Also the above is a more or mechanical translation. However

something[j] ... for j in range(len(something))

is usually a sign of a C programmer writing python :-)
Usually better to write

x for x in something

So...
Better to write that comprehension as

print [(q, json.get(q)) for q in queues]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Jython or Pyton issue-- Kindly Help me....

2014-10-14 Thread Venugopal Reddy
Actuvally am having below XML File:

?xml version=1.0 encoding=UTF-8?
soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
soapenv:Body
c:RetriveByVehicleLineModelYearResponse 
xmlns:a=urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0 
xmlns:b=urn:ford/VehicleOrder/SingleOrderEdit/v1.0 
xmlns:c=urn:ford/interface/VehicleOrder/LegacyFeatureMapping/v2
c:PortInstalledOptionFeature
a:VehicleLineId13001/a:VehicleLineId
a:ModelYear2014/a:ModelYear
a:LegacyColumn12/a:LegacyColumn
a:LegacyValue178   /a:LegacyValue
a:SalesCodeW78/a:SalesCode
a:MappingId41859/a:MappingId
a:MappingSeq0/a:MappingSeq
a:MappingDirectionB/a:MappingDirection
a:TargetFeature
a:TargetCatgegory
a:Id181/a:Id
a:NameLIGHT TRUCK WHEELBASES  
  /a:Name
a:TypeP/a:Type
a:FamilyCodeAA5/a:FamilyCode
/a:TargetCatgegory

a:OrderFeatureId15615/a:OrderFeatureId
a:WersCodeAA5K8/a:WersCode
a:OrderFeatureName178 /4521MM 
WHEELBASE /a:OrderFeatureName
a:PIOfalse/a:PIO

a:SummaryFeaturefalse/a:SummaryFeature
/a:TargetFeature
a:TargetFeature
a:TargetCatgegory
a:Id181/a:Id
a:NameLIGHT TRUCK WHEELBASES  
  /a:Name
a:TypeP/a:Type
a:FamilyCodeAA5/a:FamilyCode
/a:TargetCatgegory

a:OrderFeatureId15615/a:OrderFeatureId
a:WersCodeAA5K8_second 
time/a:WersCode
a:OrderFeatureName178 /4521MM 
WHEELBASE /a:OrderFeatureName
a:PIOfalse/a:PIO

a:SummaryFeaturefalse/a:SummaryFeature
/a:TargetFeature
/c:PortInstalledOptionFeature
c:PortInstalledOptionFeature
a:VehicleLineId13001/a:VehicleLineId
a:ModelYear2014/a:ModelYear
a:LegacyColumn12/a:LegacyColumn
a:LegacyValue190   /a:LegacyValue
a:SalesCodeW90/a:SalesCode
a:MappingId41860/a:MappingId
a:MappingSeq0/a:MappingSeq
a:MappingDirectionB/a:MappingDirection
a:TargetFeature
a:TargetCatgegory
a:Id181/a:Id
a:NameLIGHT TRUCK WHEELBASES  
  /a:Name
a:TypeP/a:Type
a:FamilyCodeAA5/a:FamilyCode
/a:TargetCatgegory

a:OrderFeatureId15616/a:OrderFeatureId
a:WersCodeAA5MA/a:WersCode
a:OrderFeatureName190 /4826MM 
WHEELBASE /a:OrderFeatureName
a:PIOfalse/a:PIO

a:SummaryFeaturefalse/a:SummaryFeature
/a:TargetFeature
/c:PortInstalledOptionFeature
/c:RetriveByVehicleLineModelYearResponse
/soapenv:Body
/soapenv:Envelope


My expected Output is:


WersCode
AA5K8
AA5MA

== For this I have used below Code:

mport glob   
import xml.etree.ElementTree as ET

Fatfile = open('#Var_SOE_VLIS_Response_Output\\Sales_to_Wers_Code2.txt', 'a')
try:
   tree = ET.parse('#Var_ENG_Response_Files\\SoapResponse1.xml')
   Fatfile.write('')
   WersCodeList = 
tree.findall('./{urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0}PortInstalledOptionFeature')
   Fatfile.write('\n')
  # x = len(WersCodeList)
  # Fatfile.write(x)
   

[issue22627] Calling timestamp() on a datetime object modifies the timestamp of a different datetime object.

2014-10-14 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This has nothing to do with the datetime module. Attached script reduces the 
issue to a bug (?) in time.mktime() with the corresponding timezone. 
time.mktime() is a thin wrapper around the C library's mktime() function, so it 
is probably not a bug in Python at all.

Note your script is fixed by removing .replace(tzinfo=None). It seems 
conter-productive to take the pain to create an aware timezone and then make it 
naive, IMHO. datetime.timestamp() falls back on time.mktime() when the datetime 
is naive (i.e. it asks the OS to do the computation).

(I did my tests under Ubuntu 13.10, btw)

--
nosy: +belopolsky, pitrou
Added file: http://bugs.python.org/file36907/mkbug.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22627
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22627] Calling timestamp() on a datetime object modifies the timestamp of a different datetime object.

2014-10-14 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +lemburg

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22627
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22624] Bogus usage of floatclock in timemodule

2014-10-14 Thread STINNER Victor

STINNER Victor added the comment:

See also the PEP 418:
http://legacy.python.org/dev/peps/pep-0418/#time-process-time

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22624
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22624] Bogus usage of floatclock in timemodule

2014-10-14 Thread STINNER Victor

STINNER Victor added the comment:

What is your platform?

time.process_time() supports many functions:

 - GetProcessTimes() (Windows only)
 - clock_gettime(CLOCK_PROF)
 - clock_gettime(CLOCK_PROCESS_CPUTIME_ID)
 - getrusage(RUSAGE_SELF)
 - times()
 - clock()

On POSIX, clock() is always tried as a fallback. Does your platform support at 
least one of these functions?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22624
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14102] argparse: add ability to create a man page

2014-10-14 Thread Josh Rosenberg

Changes by Josh Rosenberg shadowranger+pyt...@gmail.com:


--
nosy: +josh.rosenberg

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14102
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22630] `concurrent.futures.Future.set_running_or_notify_cancel` does not notify cancel

2014-10-14 Thread Ben Mather

New submission from Ben Mather:

The documentation for the `set_running_or_notify_cancel` method on 
`concurrent.futures.Future` states that it will notify waiting threads and 
trigger callbacks after the `Future` has been cancelled, however currently this 
is done immediately by the call to `cancel`.

Oddly waiters (private interface used to implement `wait` and `as_completed`) 
do follow the behaviour documented for callbacks (they are called in 
`set_running_or_notify_cancel`) which means that they are not equivalent to 
setting a callback on each future.


I have attached three possible patches:
 1) change-callbacks.patch - this changes the behaviour to match the 
documentation.
 2) change-docs.patch - this fixes the documentation to match the current 
behaviour.
 3) change-docs-and-waiters.patch - in addition to fixing the documentation, 
this also fixes the inconsistency between waiters and callbacks by invoking 
waiters' `add_cancelled` method in `cancel`.

I believe moving to the documented behaviour (1) would be a mistake as 
currently `set_running_or_notify_cancel` and the `RUNNING` state can be skipped 
entirely allowing Futures to be used just as a way to send results.

Should mention that I have a separate patch (which I will submit separately (or 
here?)) that re-implements `wait` and `as_completed` using only publicly 
exposed methods.  This makes it possible to extend or replace `Future` without 
having to preserve its private interface.  Unfortunately this slightly breaks 
compatibility due to the difference between waiters and callbacks.  I thought 
it would be best to discuss this issue first as I don't believe the current 
behaviour is as intended.

--
assignee: docs@python
components: Documentation, Library (Lib)
files: change-callbacks.patch
keywords: patch
messages: 229282
nosy: bwhmather, docs@python
priority: normal
severity: normal
status: open
title: `concurrent.futures.Future.set_running_or_notify_cancel` does not notify 
cancel
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36908/change-callbacks.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22630
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22630] `concurrent.futures.Future.set_running_or_notify_cancel` does not notify cancel

2014-10-14 Thread Ben Mather

Changes by Ben Mather bwhmat...@bwhmather.com:


Added file: http://bugs.python.org/file36909/change-docs.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22630
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22630] `concurrent.futures.Future.set_running_or_notify_cancel` does not notify cancel

2014-10-14 Thread Ben Mather

Changes by Ben Mather bwhmat...@bwhmather.com:


Added file: http://bugs.python.org/file36910/change-docs-and-waiters.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22630
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22624] Bogus usage of floatclock in timemodule

2014-10-14 Thread Link Mauve

Link Mauve added the comment:

I’m building against the Newlib libc, for the Wii, and it seems the issue 
leading to all of those functions not working is:
(.text.clock+0x18): undefined reference to `_times_r'

Threading is disabled, and reentrant functions as well, which could explain 
that.

But still, when pyconfig.h doesn’t define any HAVE_ macro to get the system 
time, I would expect py_process_time() to return None or something instead of 
failing to build.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22624
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22624] Bogus usage of floatclock in timemodule

2014-10-14 Thread STINNER Victor

STINNER Victor added the comment:

Please attach your pyconfig.h file.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22624
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22624] Bogus usage of floatclock in timemodule

2014-10-14 Thread Link Mauve

Changes by Link Mauve b...@linkmauve.fr:


Added file: http://bugs.python.org/file36911/pyconfig.h

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22624
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1610654] cgi.py multipart/form-data

2014-10-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I doubt we can use io.BufferedReader or handmade buffering here. Current code 
doesn't read more bytes than necessary. Buffered reader will read ahead, and 
there is no way to return read bytes back to the stream in general case (an 
exception is seekable streams). It can be blocked in attempt to fill a buffer 
with unnecessary bytes.

I think that the user of the cgi module is responsible for wrapping a stream in 
io.BufferedReader (if it is acceptable), the cgi module shouldn't do this 
itself.

But we can implement special cases for buffered or seekable streams. However 
this optimization will not work in general case (e.g. for stdin or socket).

--
keywords:  -easy
stage: patch review - needs patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1610654
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21842] Fix IDLE in unicodeless build

2014-10-14 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
dependencies: +Fix Tkinter in unicodeless build
priority: normal - low

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21842
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22557] Local import is too slow

2014-10-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, my CPU is slow.

Here is a patch which factors out IMPORT_NAME into a separate import_name() 
function and adds optimization for more general case when __import__ is not 
overloaded.

--
Added file: http://bugs.python.org/file36912/faster_import_3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22557
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15859] PyUnicode_EncodeFSDefault win32 inconsistancy.

2014-10-14 Thread Campbell Barton

Changes by Campbell Barton ideasma...@gmail.com:


--
resolution: out of date - remind

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15859
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16726] expat ParseFile expects bytes, not string

2014-10-14 Thread Sebastien Bardeau

Sebastien Bardeau added the comment:

Same problem here with:
Python 3.4.1 (default, Jul 30 2014, 14:02:54)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux

What is unclear to me if this is a bug or a feature. In particular, as 
described here 
http://stackoverflow.com/questions/1179305/expat-parsing-in-python-3, one can 
open the xml file as binary to solve the issue. But is this /really/ intended? 
Opening standard ASCII xml files as binaries!?

--
nosy: +sbardeau

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16726
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15859] PyUnicode_EncodeFSDefault win32 inconsistancy.

2014-10-14 Thread Campbell Barton

Campbell Barton added the comment:

Updated the patch for '93049:d9a3d23cf8f0'

Note, the link for the original bug report has changed: See 
https://developer.blender.org/T31856

--
status: closed - open
Added file: http://bugs.python.org/file36913/fix_unicode_v2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15859
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22631] Feature Request CAN_RAW_FD_FRAME

2014-10-14 Thread Stefan Tatschner

New submission from Stefan Tatschner:

CAN support was introduced with issue #10141. Python still seems to lack 
support for CAN FD which is available with the socket option CAN_RAW_FD_FRAMES, 
see here (chapter 4.1.5): 
https://www.kernel.org/doc/Documentation/networking/can.txt

--
components: IO
messages: 229289
nosy: rumpelsepp
priority: normal
severity: normal
status: open
title: Feature Request CAN_RAW_FD_FRAME
type: enhancement
versions: Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22631
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3068] IDLE - Add an extension configuration dialog

2014-10-14 Thread Saimadhav Heblikar

Saimadhav Heblikar added the comment:

1. Can we have more padding at the right end of the text widget? For me, it 
appears attached to the scrollbar.

2. Shortcut key for Configure extensions should be different from Configure 
Extensions. By this I mean, with the Options menu open, there is no way to open 
Configure Extensions using the keyboard.(Also see sidenote 1).

3. Is there a need for ... after Configure Extensions? I am asking this as 
don't know why it was there for Configure IDLE... in the first place.

4. User extension config files are created even if extension config settings 
are not dirty. Clicking OK or Apply without changing anything creates them. 
Even if I change the setting for only 1 extension, extension config for all 
extensions are written to disk. This is unlike the behavior of Configure IDLE 
dialog.

5. There are a couple of places where Ok and Cancel are used. If I have 
understood PEP8 correctly, aren't they not following it? Should they be ok and 
cancel instead?

6. Is there a reason to comment out the unittest and Htest in 
configDialog.py?(Other than application has been destroyed .. messages?)


Sidenote 1 : Options menu unreachable via keyboard shortcut because both format 
and options have O as the keyboard shortcut.

Sidenote 2: I am writing the review comments here as review tool does not 
detect all the files affected by this patch. Please confirm, so that I will 
post this issue to the developer list.

-- 
Regards
Saimadhav Heblikar

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3068
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-10-14 Thread Colton Leekley-Winslow

Colton Leekley-Winslow added the comment:

What's the status on this?

--
nosy: +lwcolton

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21600
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-10-14 Thread Michael Foord

Michael Foord added the comment:

It just needs committing, I believe Kushal Das has volunteered to do it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21600
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12965] longobject: documentation improvements

2014-10-14 Thread Stefan Krah

Stefan Krah added the comment:

This seems like too much trouble for 2.7. Closing, since I was the
one who opened the issue (just reopen if you think it is still worth
it).

--
assignee: skrah - 
resolution:  - fixed
stage: patch review - resolved
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12965
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-10-14 Thread Kushal Das

Kushal Das added the comment:

I will do that. New job is taking time.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21600
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12974] array module: deprecate '__int__' conversion support for array elements

2014-10-14 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12834] memoryview.to_bytes() and PyBuffer_ToContiguous() incorrect for non-contiguous arrays

2014-10-14 Thread Stefan Krah

Stefan Krah added the comment:

2.7 is the only remaining candidate for the fix. I'm not going to
work on it: somehow seems too risky for 2.7 at this stage.

--
assignee: skrah - 
resolution:  - fixed
stage: needs patch - resolved
status: open - pending
versions:  -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12834
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15857] memoryview: complete support for struct packing/unpacking

2014-10-14 Thread Stefan Krah

Stefan Krah added the comment:

Closing, since the main request is tracked in #3132.

--
resolution:  - duplicate
stage: needs patch - 

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15857
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6171] IDLE - Class Browser selection in Ubuntu

2014-10-14 Thread Saimadhav Heblikar

Changes by Saimadhav Heblikar saimadhavhebli...@gmail.com:


--
nosy: +sahutd

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6171
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14262] Allow using decimals as arguments to `timedelta`

2014-10-14 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14262
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15671] PEP 3121, 384 Refactoring applied to struct module

2014-10-14 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15671
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13124] Add Running a Build Slave page to the devguide

2014-10-14 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13124
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7406] int arithmetic relies on C signed overflow behaviour

2014-10-14 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7406
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12834] memoryview.to_bytes() and PyBuffer_ToContiguous() incorrect for non-contiguous arrays

2014-10-14 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
status: pending - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12834
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14757] INCA: Inline Caching meets Quickening in Python 3.3

2014-10-14 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14757
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15672] PEP 3121, 384 Refactoring applied to testbuffer module

2014-10-14 Thread Stefan Krah

Stefan Krah added the comment:

Thanks, but this is just a module for testing the buffer API. :)
So let's keep it simple and close the issue.

--
keywords: +gsoc, needs review -pep3121
resolution:  - rejected
stage:  - resolved
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15672
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8876] distutils should not assume that hardlinks will work

2014-10-14 Thread Matt Wright

Matt Wright added the comment:

Here's another example of where this is a pain. An emerging workflow is using 
Docker for a Python environment. However, on OS X, its common to use 
boot2docker (a lightweight VM). With VirtualBox on OS X, its common to setup a 
shared folder between the host and boot2docker so one can mount volumes to 
Docker containers from the host to the container(s) on the VM. So when running 
something like `tox` or `python setup.py sdist` things fail because VirtualBox 
does not allow hard links on the shared folder filesystem. Changing this would 
be grand. Otherwise I have the, arguably, ugly `del os.link` in my setup.py.

--
nosy: +Matt.Wright

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8876
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15945] memoryview + bytes fails

2014-10-14 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15945
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21991] The new email API should use MappingProxyType instead of returning new dicts.

2014-10-14 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Hi David,

I didn't find an other example of a copy(dict), the rest is just some lists. If 
you have an other example in the email library, I will agree to provide an 
other patch.

--
keywords: +patch
Added file: http://bugs.python.org/file36914/issue21991.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21991
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21991] The new email API should use MappingProxyType instead of returning new dicts.

2014-10-14 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

In fact, I am really dubious with my patch because this one is really small and 
I think there is a missing part somewhere because the description of this issue 
takes 4 lines and the patch only 2.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21991
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10581] Review and document string format accepted in numeric data type constructors

2014-10-14 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10581
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13918] locale.atof documentation is missing func argument

2014-10-14 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13918
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14260] re.groupindex is available for modification and continues to work, having incorrect data inside it

2014-10-14 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14260
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22327] test_gdb failures on Ubuntu 14.10

2014-10-14 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22327
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   >