Python -COMMETHOD ,No return value obtained/received

2013-09-13 Thread sanju dhoomakethu
I am very new to COM programming, Our project requires the Python script to 
make communication with a COM dll which is written in C#.

The generated COM signature in Python is as below

COMMETHOD([dispid(1610743820)], HRESULT, 'test',
  ( ['in', 'out'], POINTER(_midlSAFEARRAY(c_double)), 'test' ),
  ( ['retval', 'out'], POINTER(VARIANT_BOOL), 'pRetVal' )),
Where as the C# code for the same is

public bool test(ref double[,] test)
{
if (test == null)
test = new double[1,2];


test[0,0] = 0.0;
test[0,1] = 0.5;

return true;
}
Note: the above is the dummy functions i have created to explain the issue

Now when I try to invoke the COM method from Python , I am only getting the 
values passed by reference to the method (sweepValuesX) as return value and not 
the actual return value (which has to be either true/false)

My function call is as below

print apxWrapper.test()
and the output is ((0.0, 0.5),)

Note: Since i was not able to find a way to pass the last arguement from Python 
,I just omitted the last argument for trial purpose

Any hints why this is happening is highly appreciated or to be specific I have 
two questions

1 How Can i pass the argument to be passed by reference from Python especially 
array (both single and multidimensional)(POINTER(_midlSAFEARRAY(c_double)))
2 How can i get the actual return value (true/false)
Sanjay
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Language design

2013-09-13 Thread Antoon Pardon
Op 10-09-13 12:20, Chris Angelico schreef:
 On Tue, Sep 10, 2013 at 4:09 PM, Steven D'Aprano st...@pearwood.info wrote:
 What design mistakes, traps or gotchas do you think Python has? Gotchas
 are not necessarily a bad thing, there may be good reasons for it, but
 they're surprising.
 
 Significant indentation. It gets someone every day, it seems.
 

Not only that. There are a lot of python code snippets on the net
that for whatever reason lost their indentation. There is no
algorithm that can restore the lost structure.

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


Re: Language design

2013-09-13 Thread Chris Angelico
On Fri, Sep 13, 2013 at 3:08 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 For example, take intersection of two sets s and t. It is a basic
 principle of set intersection that st == ts.

Note that, while this is true, the two are not actually identical:

 set1 = {0,1,2}
 set2 = {0.0,1.0,3.0}
 set1set2
{0.0, 1.0}
 set2set1
{0, 1}
 (set1set2) == (set2set1)
True

I'd actually posit that Python has this particular one backward (I'd
be more inclined to keep the left operand's value), but it's
completely insignificant to most usage. But in any case, there's
already the possibility that a set union can be forced to make a
choice between two equal objects, so we're already a bit beyond the
purity of mathematics. Python could have implemented dicts much more
like sets with values, with set semantics maintained throughout, but
it'd require some oddities:

 {1:asdf} == {1:asdf}
True
 {1:asdf} == {1:qwer}
False

Sets with values semantics would demand that these both be True,
which is grossly unintuitive.

So while it may be true in pure mathematics that a set is-a dict (or a
dict is-a set), it's bound to create at least as many gotchas as it
solves.

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


Re: Language design

2013-09-13 Thread Steven D'Aprano
On Fri, 13 Sep 2013 09:04:06 +0200, Antoon Pardon wrote:

 Op 10-09-13 12:20, Chris Angelico schreef:
 On Tue, Sep 10, 2013 at 4:09 PM, Steven D'Aprano st...@pearwood.info
 wrote:
 What design mistakes, traps or gotchas do you think Python has?
 Gotchas are not necessarily a bad thing, there may be good reasons for
 it, but they're surprising.
 
 Significant indentation. It gets someone every day, it seems.
 
 
 Not only that. There are a lot of python code snippets on the net that
 for whatever reason lost their indentation. There is no algorithm that
 can restore the lost structure.

Is there an algorithm that will restore the lost structure if you delete 
all the braces from C source code?

Perhaps if web sites and mail clients routinely deleted braces, we'd see 
the broken-by-design software being fixed instead of blaming the language.



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


Re: Python in XKCD today

2013-09-13 Thread Duncan Booth
Roy Smith r...@panix.com wrote:

 http://xkcd.com/1263/

So now I guess someone has to actually implement the script. At least, 
that's (sort of) what happened for xkcd 353 so there's a precedent.


-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: When i leave a LineEdit widget and run slot

2013-09-13 Thread Vincent Vande Vyvre

Le 13/09/2013 02:33, Mohsen Pahlevanzadeh a écrit :

Dear all,

QtCore.QObject.connect(self.checkBox,
QtCore.SIGNAL(_fromUtf8(clicked(bool))), lambda:
self.interfaceCodesConstructor.setFilterList(self,name,self.lineEdit.text()))
I code pyqt, I have the following code:

///
QtCore.QObject.connect(self.checkBox,
QtCore.SIGNAL(_fromUtf8(clicked(bool))), lambda:
self.interfaceCodesConstructor.setFilterList(self,name,self.lineEdit.text()))
//

Abobe code causes When i click on checkbox, my function : setFilterList
will be run.

i need to run above function:
setFilterList(self,name,self.lineEdit.text()) When i leave a
LineEdit widget, But i don't know its signal.

My question is : What's its signal when you leave a widget such as
LineEdit?

Yours,
Mohsen



The signal editingFinished() is made for that.

http://pyqt.sourceforge.net/Docs/PyQt4/qlineedit.html#editingFinished

--
Vincent V.V.
Oqapy https://launchpad.net/oqapy . Qarte 
https://launchpad.net/qarte . PaQager https://launchpad.net/paqager

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


Re: Language design

2013-09-13 Thread Chris Angelico
On Fri, Sep 13, 2013 at 8:13 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 On Fri, 13 Sep 2013 09:04:06 +0200, Antoon Pardon wrote:

 Op 10-09-13 12:20, Chris Angelico schreef:
 On Tue, Sep 10, 2013 at 4:09 PM, Steven D'Aprano st...@pearwood.info
 wrote:
 What design mistakes, traps or gotchas do you think Python has?
 Gotchas are not necessarily a bad thing, there may be good reasons for
 it, but they're surprising.

 Significant indentation. It gets someone every day, it seems.


 Not only that. There are a lot of python code snippets on the net that
 for whatever reason lost their indentation. There is no algorithm that
 can restore the lost structure.

 Is there an algorithm that will restore the lost structure if you delete
 all the braces from C source code?

 Perhaps if web sites and mail clients routinely deleted braces, we'd see
 the broken-by-design software being fixed instead of blaming the language.

While I don't deny your statement, I'd like to point out that English
usually isn't overly concerned with formatting. You can take this
paragraph of text, unwrap it, and then reflow it to any width you
like, without materially changing my points. C follows a rule of
English which Python breaks, ergo software designed to cope only with
English can better cope with C code than with Python code. Removing
all braces would be like removing all punctuation - very like, in fact
- a very real change to the content, and destruction of important
information. Python is extremely unusual in making indentation
important information, thus running afoul of systems that aren't meant
for any code.

But if you look at the quoted text above, I specifically retained your
declaration that Gotchas are not necessarily a bad thing when citing
significant indentation. I'm not here to argue that Python made the
wrong choice; I'm only arguing that it frequently confuses people.

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


Re: Language design

2013-09-13 Thread Antoon Pardon
Op 13-09-13 12:13, Steven D'Aprano schreef:
 On Fri, 13 Sep 2013 09:04:06 +0200, Antoon Pardon wrote:
 
 Op 10-09-13 12:20, Chris Angelico schreef:
 On Tue, Sep 10, 2013 at 4:09 PM, Steven D'Aprano st...@pearwood.info
 wrote:
 What design mistakes, traps or gotchas do you think Python has?
 Gotchas are not necessarily a bad thing, there may be good reasons for
 it, but they're surprising.

 Significant indentation. It gets someone every day, it seems.


 Not only that. There are a lot of python code snippets on the net that
 for whatever reason lost their indentation. There is no algorithm that
 can restore the lost structure.
 
 Is there an algorithm that will restore the lost structure if you delete 
 all the braces from C source code?

Yes, almost. Just look at the indentation of the program and you will
probably be able to restore the braces in 99% of the programs.

 Perhaps if web sites and mail clients routinely deleted braces, we'd see 
 the broken-by-design software being fixed instead of blaming the language.

The world is not perfect. If products in your design are hard to repair
after some kind of hiccup, then I think the design can be blamed for
that. Good design is more than being ok when nothing goes wrong. Good
design is also about being recoverable when things do go wrong.

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


Re: Telnet to remote system and format output via web page

2013-09-13 Thread Jean-Michel Pichavant
- Original Message -
 I would use something like fabric to automatically login to hosts via
 ssh then parse the data myself to generate static HTML pages in a
 document root.
 
 Having a web app execute remote commands on a server is so wrong in
 many ways.

Such as ?

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Telnet to remote system and format output via web page

2013-09-13 Thread Chris Angelico
On Fri, Sep 13, 2013 at 10:31 PM, Jean-Michel Pichavant
jeanmic...@sequans.com wrote:
 - Original Message -
 I would use something like fabric to automatically login to hosts via
 ssh then parse the data myself to generate static HTML pages in a
 document root.

 Having a web app execute remote commands on a server is so wrong in
 many ways.

 Such as ?

It depends exactly _how_ it's able to execute remote commands. If it
can telnet in as a fairly-privileged user and transmit arbitrary
strings to be executed, then any compromise of the web server becomes
a complete takedown of the back-end server. You're basically
circumventing the protection that most web servers employ, that of
running in a highly permissions-restricted user.

On the other hand, if the execute remote commands part is done by
connecting to a shell that executes its own choice of command safely,
then you're not forfeiting anything. Suppose you make this the login
shell for the user foo@some-computer:

#!/bin/sh
head -4 /proc/meminfo

You can then telnet to that user to find out how much RAM that
computer has free. It's telnet, it's executing a command on the remote
server... but it's safe. (For something like this, I'd be inclined to
run a specific memory usage daemon that takes connections on some
higher port, rather than having it look like a shell, but this is a
viable demo.) I've done things like this before, though using SSH
rather than TELNET.

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


Another question about JSON

2013-09-13 Thread Anthony Papillion
Hello Again Everyone,

I'm still working to get my head around JSON and I thought I'd done so
until I ran into this bit of trouble. I'm trying to work with the
CoinBase API. If I type this into my browser:

https://coinbase.com/api/v1/prices/buy

I get the following JSON returned

{subtotal:{amount:128.00,currency:USD},fees:[{coinbase:{amount:1.28,currency:USD}},{bank:{amount:0.15,currency:USD}}],total:{amount:129.43,currency:USD},amount:129.43,currency:USD}

So far, so good. Now, I want to simply print out that bit of JSON (just
to know I've got it) and I try to use the following code:

returnedJSON = json.loads('https://coinbase.com/api/v1/prices/buy')
print returnedString

And I get a traceback that says: No JSON object could be decoded. The
specific traceback is:

Traceback (most recent call last):
  File coinbase_bot.py, line 31, in module
getCurrentBitcoinPrice()
  File coinbase_bot.py, line 28, in getCurrentBitcoinPrice
returnedString = json.loads(BASE_API_URL + '/prices/buy')
  File /usr/lib/python2.7/json/__init__.py, line 326, in loads
return _default_decoder.decode(s)
  File /usr/lib/python2.7/json/decoder.py, line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File /usr/lib/python2.7/json/decoder.py, line 384, in raw_decode
raise ValueError(No JSON object could be decoded)
ValueError: No JSON object could be decoded


I'm very confused since the URL is obviously returned a JSON string. Can
anyone help me figure this out? What am I doing wrong?

Thanks in advance!
Anthony


-- 
Anthony Papillion
XMPP/Jabber:  cypherp...@patts.us
OTR Fingerprint:  4F5CE6C07F5DCE4A2569B72606E5C00A21DA24FA
SIP:  17772471...@callcentric.com
PGP Key:  0xE1608145

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


Re: Python GUI?

2013-09-13 Thread Kevin Walzer

On 9/11/13 4:55 PM, eamonn...@gmail.com wrote:

Tkinter -- Simple to use, but limited


With the themed widget introduced in Tk 8.5, Tkinter is now a peer to 
the other GUI toolkits in most respects, surpasses them in some (canvas 
widget), and lags behind in just two areas: printing (several 
platform-specific solutions but no cross-platform API) and HTML display 
(a few extensions but no standard widget set).


I've stayed with Tkinter because it fits my brain the best. Old 
complaints about it being ugly or limited no longer hold water.


--Kevin

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
https://mail.python.org/mailman/listinfo/python-list


Re: Another question about JSON

2013-09-13 Thread Peter Otten
Anthony Papillion wrote:

 Hello Again Everyone,
 
 I'm still working to get my head around JSON and I thought I'd done so
 until I ran into this bit of trouble. I'm trying to work with the
 CoinBase API. If I type this into my browser:
 
 https://coinbase.com/api/v1/prices/buy
 
 I get the following JSON returned
 
 {subtotal:{amount:128.00,currency:USD},fees:[{coinbase:
{amount:1.28,currency:USD}},{bank:
{amount:0.15,currency:USD}}],total:
{amount:129.43,currency:USD},amount:129.43,currency:USD}
 
 So far, so good. Now, I want to simply print out that bit of JSON (just
 to know I've got it) and I try to use the following code:
 
 returnedJSON = json.loads('https://coinbase.com/api/v1/prices/buy')
 print returnedString
 
 And I get a traceback that says: No JSON object could be decoded. The
 specific traceback is:
 
 Traceback (most recent call last):
   File coinbase_bot.py, line 31, in module
 getCurrentBitcoinPrice()
   File coinbase_bot.py, line 28, in getCurrentBitcoinPrice
 returnedString = json.loads(BASE_API_URL + '/prices/buy')
   File /usr/lib/python2.7/json/__init__.py, line 326, in loads
 return _default_decoder.decode(s)
   File /usr/lib/python2.7/json/decoder.py, line 366, in decode
 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
   File /usr/lib/python2.7/json/decoder.py, line 384, in raw_decode
 raise ValueError(No JSON object could be decoded)
 ValueError: No JSON object could be decoded
 
 
 I'm very confused since the URL is obviously returned a JSON string. Can
 anyone help me figure this out? What am I doing wrong?

Let's see:

 help(json.loads)
Help on function loads in module json:

loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, 
parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)
Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
document) to a Python object.
[...]

So json.loads() expects its first argument to b valid json, no a URL.
You have to retrieve the data using other means before you can deserialize 
it:

data = urllib2.urlopen(...).read()
returned_json = json.loads(data)

Replacing ... with something that works is left as an exercise. (It seems 
that you have to use a Request object rather than a URL, and that the 
default Python-urllib/2.7 is not an acceptable user agent.

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


Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-13 Thread stephen . boulet
On Thursday, September 12, 2013 10:43:46 PM UTC-5, Neil Hodgson wrote:
 Stephen Boulet:
 
 
 
   From the clipboard contents copied from the spreadsheet, the characters 
  s[:80684] were the visible cell contents, and s[80684:] all started with 
  b'\x0 and lack any useful info for what I'm trying to accomplish.
 
 
 
 Looks like Excel is rounding up its clipboard allocation to the next 
 
 64K. There used to be good reasons for trying to leave some extra room 
 
 on the clipboard and avoid reallocating the block but I thought that was 
 
 over a long time ago.
 
 
 
 To strip NULs off the end of the string use s.rstrip('\0')

Hm, that gives me a Type str doesn't support the buffer API message.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Another question about JSON

2013-09-13 Thread John Gordon
In mailman.355.1379077258.5461.python-l...@python.org Anthony Papillion 
papill...@gmail.com writes:

 I'm still working to get my head around JSON and I thought I'd done so
 until I ran into this bit of trouble. I'm trying to work with the
 CoinBase API. If I type this into my browser:

 https://coinbase.com/api/v1/prices/buy

 I get the following JSON returned

 {subtotal:{amount:128.00,currency:USD},fees:[{coinbase:{amount:1.28,currency:USD}},{bank:{amount:0.15,currency:USD}}],total:{amount:129.43,currency:USD},amount:129.43,currency:USD}

 So far, so good. Now, I want to simply print out that bit of JSON (just
 to know I've got it) and I try to use the following code:

 returnedJSON = json.loads('https://coinbase.com/api/v1/prices/buy')
 print returnedString

JSON is a notation for exchanging data; it knows nothing about URLs.

It's up to you to connect to the URL and read the data into a string,
and then pass that string to json.loads().

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, The Gashlycrumb Tinies

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


Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-13 Thread stephen . boulet
On Friday, September 13, 2013 9:31:45 AM UTC-5, stephen...@gmail.com wrote:
 On Thursday, September 12, 2013 10:43:46 PM UTC-5, Neil Hodgson wrote:
 
  Stephen Boulet:
 
  
 
  
 
  
 
From the clipboard contents copied from the spreadsheet, the characters 
   s[:80684] were the visible cell contents, and s[80684:] all started with 
   b'\x0 and lack any useful info for what I'm trying to accomplish.
 
  
 
  
 
  
 
  Looks like Excel is rounding up its clipboard allocation to the next 
 
  
 
  64K. There used to be good reasons for trying to leave some extra room 
 
  
 
  on the clipboard and avoid reallocating the block but I thought that was 
 
  
 
  over a long time ago.
 
  
 
  
 
  
 
  To strip NULs off the end of the string use s.rstrip('\0')
 
 
 
 Hm, that gives me a Type str doesn't support the buffer API message.

Aha, I need to use str(s, encoding='utf8').rstrip('\0').
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-13 Thread Neil Cerutti
On 2013-09-13, stephen.bou...@gmail.com stephen.bou...@gmail.com wrote:
 On Thursday, September 12, 2013 10:43:46 PM UTC-5, Neil Hodgson wrote:
 Stephen Boulet:
 
 
 
   From the clipboard contents copied from the spreadsheet, the characters 
  s[:80684] were the visible cell contents, and s[80684:] all started with 
  b'\x0 and lack any useful info for what I'm trying to accomplish.
 
 
 
 Looks like Excel is rounding up its clipboard allocation to the next 
 
 64K. There used to be good reasons for trying to leave some extra room 
 
 on the clipboard and avoid reallocating the block but I thought that was 
 
 over a long time ago.
 
 
 
 To strip NULs off the end of the string use s.rstrip('\0')

 Hm, that gives me a Type str doesn't support the buffer API
 message.

Type mismatch. Try:

s.rstrip(b\0)

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


Re: Another question about JSON

2013-09-13 Thread Anthony Papillion
On 09/13/2013 08:24 AM, Peter Otten wrote:
 Anthony Papillion wrote:
 
 And I get a traceback that says: No JSON object could be decoded. The
 specific traceback is:

 Traceback (most recent call last):
   File coinbase_bot.py, line 31, in module
 getCurrentBitcoinPrice()
   File coinbase_bot.py, line 28, in getCurrentBitcoinPrice
 returnedString = json.loads(BASE_API_URL + '/prices/buy')
   File /usr/lib/python2.7/json/__init__.py, line 326, in loads
 return _default_decoder.decode(s)
   File /usr/lib/python2.7/json/decoder.py, line 366, in decode
 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
   File /usr/lib/python2.7/json/decoder.py, line 384, in raw_decode
 raise ValueError(No JSON object could be decoded)
 ValueError: No JSON object could be decoded
 
 So json.loads() expects its first argument to b valid json, no a URL.
 You have to retrieve the data using other means before you can deserialize 
 it:
 
 data = urllib2.urlopen(...).read()
 returned_json = json.loads(data)
 
 Replacing ... with something that works is left as an exercise. (It seems 
 that you have to use a Request object rather than a URL, and that the 
 default Python-urllib/2.7 is not an acceptable user agent.

Thank you Peter! That was all I needed. So here's the code I came up
with that seems to work:

req = urllib2.Request(BASE_URL + '/prices/buy')
req.add_unredirected_header('User-Agent', USER_AGENT)
resp = urllib2.urlopen(req).read()
data - json.loads(resp)
return data['amount']

Thank you for the help!

Anthony






-- 
Anthony Papillion
XMPP/Jabber:  cypherp...@patts.us
OTR Fingerprint:  4F5CE6C07F5DCE4A2569B72606E5C00A21DA24FA
SIP:  17772471...@callcentric.com
PGP Key:  0xE1608145

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


Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-13 Thread random832
On Fri, Sep 13, 2013, at 10:38, stephen.bou...@gmail.com wrote:
  Hm, that gives me a Type str doesn't support the buffer API message.
 
 Aha, I need to use str(s, encoding='utf8').rstrip('\0').

It's not a solution to your problem, but why aren't you using
CF_UNICODETEXT, particularly if you're using python 3? And if you're
not, utf8 is the incorrect encoding, you should be using encoding='mbcs'
to interact with the CF_TEXT clipboard.

Anyway, to match behavior found in other applications when pasting from
the clipboard, I would suggest using:

if s.contains('\0'): s = s[:s.index('\0')]

Which will also remove non-null bytes after the first null (but if the
clipboard contains these, it won't be pasted into e.g. notepad).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python GUI?

2013-09-13 Thread eamonnrea
I don't like the idea of being able to drag and drop anything in the 
programming world. Outside of that, I use DD programs a lot. I got into GUI 
programming because I thought that I could get away from them, but I guess not.

Maybe I'm against them because if I can't code, I don't have anything else to 
do with my time. If I don't program, the only other thing I have to do is... 
well... nothing. So, because of this, they're making programming easier... by 
not coding as much. Oh well, guess coding is dead :(
-- 
https://mail.python.org/mailman/listinfo/python-list


Get the selected tab in a enthought traits application

2013-09-13 Thread petmertens
Hi,

I have a traits application with a tabbed group:

Group(
Group(label=a, dock='tab'),
Group(label=b, dock='tab'),
layout='tabbed')

Beneath the tabbed group, there is button which should perform some action 
depending on the selected tab.
So I would like to know which of both tabs, 'a' or 'b', is selected (i.e. 
active).

Any ideas?

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


Re: Python GUI?

2013-09-13 Thread petmertens
Enthought.traits !! http://code.enthought.com/projects/traits/
I started using traits a couple of months ago and I really like it.

Traits provides a framework which creates a UI based on your data structures. 
Using some hints you can do anything you want. Just check out their website 
and try the examples.
Even creating an executable out of it is quite easy using bbfreeze.

The negative thing about is that the user group doesn't seem to be very 
large. In other words: if you get stuck on something, there aren't many people 
to help you. This however should not prevent you from using traits.

Just try it and let me know what you think about it.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python GUI?

2013-09-13 Thread eamonnrea
On Friday, September 13, 2013 4:02:42 AM UTC+1, Michael Torrie wrote:
 On 09/12/2013 10:03 AM, eamonn...@gmail.com wrote:
I think your hate of gui designers is about 10 years out of date now, 
 even if you still prefer not to use them.

So, you are recommending not to code as much? :'( That is what depresses me. 
These tools depress me!

I don't understand why people don't want to code. It's time consuming: But 
that's the point!!! It *should* be time consuming. It *should* take time to 
make programs. Speed isn't the main thing, fun is. And these tools are taking 
the fun away.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python GUI?

2013-09-13 Thread John Gordon
In 76784bad-cd6d-48f9-b358-54afb2784...@googlegroups.com eamonn...@gmail.com 
writes:

 they're making programming easier... by not coding as much. Oh well,
 guess coding is dead :(

Pressing keys on a keyboard was never the hard part of coding.

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, The Gashlycrumb Tinies

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


Re: Python GUI?

2013-09-13 Thread Joe Junior
On 13 September 2013 15:39, John Gordon gor...@panix.com wrote:
 In 76784bad-cd6d-48f9-b358-54afb2784...@googlegroups.com 
 eamonn...@gmail.com writes:

 they're making programming easier... by not coding as much. Oh well,
 guess coding is dead :(

 Pressing keys on a keyboard was never the hard part of coding.


Nor the fun part.

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


Re: new to python

2013-09-13 Thread MRAB

On 13/09/2013 20:02, Abhishek Pawar wrote:

what should i do after learning python to get more comfortable with python?


There's really nothing better than practice, so start writing something
that will be interesting or useful to you. It doesn't have to be
amazing! :-)

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


Re: Language design

2013-09-13 Thread Terry Reedy

On 9/13/2013 7:16 AM, Chris Angelico wrote:

On Fri, Sep 13, 2013 at 8:13 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:

On Fri, 13 Sep 2013 09:04:06 +0200, Antoon Pardon wrote:

Not only that. There are a lot of python code snippets on the net that
for whatever reason lost their indentation. There is no algorithm that
can restore the lost structure.


I believe tabs are worse than spaces with respect to getting lost.


Is there an algorithm that will restore the lost structure if you delete
all the braces from C source code?

Perhaps if web sites and mail clients routinely deleted braces, we'd see
the broken-by-design software being fixed instead of blaming the language.


While I don't deny your statement, I'd like to point out that English
usually isn't overly concerned with formatting.


Poetry, including that in English, often *is* concerned with formatting. 
Code is more like poetry than prose.



You can take this
paragraph of text, unwrap it, and then reflow it to any width you
like, without materially changing my points.


But you cannot do that with poetry! Or mathematical formulas. Or tables. 
Or text with headers and paragraphs and indented quotations. Etc. What 
percentage of published books on your bookshelf have NO significant 
indentation? As far as I know for mine, it is 0.



C follows a rule of English


which you just made up, and which is drastically wrong,


which Python breaks,
ergo software designed to cope only with English


impoverished plain unformatted prose


can better cope with C code than with Python code.


Software that removes formatting info is broken for English as well as 
Python.



Python is extremely unusual in making indentation
important information


You have it backwards. Significant indentation is *normal* in English. C 
in unusual is being able to write a whole text on a single line.


When I was a child, paragraphs were marked by tab indents. The change to 
new-fangled double spacing with no indent seems to have come along with 
computer text processing. Perhaps this is because software is more prone 
to dropping tabs that return characters.


--
Terry Jan Reedy

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


Re: new to python

2013-09-13 Thread Ben Finney
Abhishek Pawar appabhish...@gmail.com writes:

 what should i do after learning python to get more comfortable with
 python?

Welcome! Congratulations on finding Python.

Get comfortable with Python by spending time working through beginner
documentation URL:http://wiki.python.org/moin/BeginnersGuide and doing
all the exercises.

Get comfortable with Python by spending time applying your skills to
some programming problems you already have. Isn't that the reason you
learned Python in the first place?

Good hunting to you!

-- 
 \ “[W]e are still the first generation of users, and for all that |
  `\  we may have invented the net, we still don't really get it.” |
_o__)   —Douglas Adams |
Ben Finney

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


Re: Python GUI?

2013-09-13 Thread eamonnrea
I disagree with you. It's not hard, and I apologise if its ever sounded that 
way, but it is the fun part for me. I love spending hours(days even) debugging.

Well, thanks all for depressing me. Time to give up programming and find 
something else to do with my life.
-- 
https://mail.python.org/mailman/listinfo/python-list


new to python

2013-09-13 Thread Abhishek Pawar
what should i do after learning python to get more comfortable with python?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python GUI?

2013-09-13 Thread Terry Reedy

On 9/13/2013 9:27 AM, Kevin Walzer wrote:

On 9/11/13 4:55 PM, eamonn...@gmail.com wrote:

Tkinter -- Simple to use, but limited


With the themed widget introduced in Tk 8.5, Tkinter is now a peer to
the other GUI toolkits in most respects, surpasses them in some (canvas
widget), and lags behind in just two areas: printing (several
platform-specific solutions but no cross-platform API) and HTML display
(a few extensions but no standard widget set).


I would add the ancient and limited image support, both for input and 
canvas output. Modern SVG output instead of ancient (possibly buggy) 
PostScript would be a real improvement.


Otherwise, I have become more impressed with the text widget as I have 
studied the Idle code. Even that does not use everything. I have not 
looked at the text widget in other guis to compare.


--
Terry Jan Reedy

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


Re: new to python

2013-09-13 Thread Abhishek Pawar
On Saturday, September 14, 2013 12:45:56 AM UTC+5:30, Ben Finney wrote:
 Abhishek Pawar appabhish...@gmail.com writes:
 
 
 
  what should i do after learning python to get more comfortable with
 
  python?
 
 
 
 Welcome! Congratulations on finding Python.
 thanks you inspire me
 
 
 Get comfortable with Python by spending time working through beginner
 
 documentation URL:http://wiki.python.org/moin/BeginnersGuide and doing
 
 all the exercises.
 
 
 
 Get comfortable with Python by spending time applying your skills to
 
 some programming problems you already have. Isn't that the reason you
 
 learned Python in the first place?
 
 
 
 Good hunting to you!
 
 
 
 -- 
 
  \ “[W]e are still the first generation of users, and for all that |
 
   `\  we may have invented the net, we still don't really get it.” |
 
 _o__)   —Douglas Adams |
 
 Ben Finney

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


Re: new to python

2013-09-13 Thread Abhishek Pawar
On Saturday, September 14, 2013 12:45:56 AM UTC+5:30, Ben Finney wrote:
 Abhishek Pawar appabhish...@gmail.com writes:
 
 
 
  what should i do after learning python to get more comfortable with
 
  python?
 
 
 
 Welcome! Congratulations on finding Python.
 
 
 
 Get comfortable with Python by spending time working through beginner
 
 documentation URL:http://wiki.python.org/moin/BeginnersGuide and doing
 
 all the exercises.
 
 
 
 Get comfortable with Python by spending time applying your skills to
 
 some programming problems you already have. Isn't that the reason you
 
 learned Python in the first place?
 
 
 
 Good hunting to you!
 
 
 
 -- 
 
  \ “[W]e are still the first generation of users, and for all that |
 
   `\  we may have invented the net, we still don't really get it.” |
 
 _o__)   —Douglas Adams |
 
 Ben Finney
thank you Ben
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python GUI?

2013-09-13 Thread Joe Junior
On 13 September 2013 16:37,  eamonn...@gmail.com wrote:
 I disagree with you. It's not hard, and I apologise if its ever sounded that 
 way, but it is the fun part for me. I love spending hours(days even) 
 debugging.

 Well, thanks all for depressing me. Time to give up programming and find 
 something else to do with my life.
 --
 https://mail.python.org/mailman/listinfo/python-list

lol! You made my day. :-D

Well, you can always ignore any and all graphical design tools if
you're working alone. And write all those Xs and Ys and widths and
heights all day long. None of the mentioned graphical toolkits forces
you to use them.

And if you like debugging, GUI is not the main dish! Try networking
and concurrent programming, loads and loads of fun!

Of course, that's lots of other unnecessary time consuming stuff you
can do. You just have to use your imagination.

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


Re: Python GUI?

2013-09-13 Thread Neil Cerutti
On 2013-09-13, Joe Junior joe.fbs.jun...@gmail.com wrote:
 On 13 September 2013 15:39, John Gordon gor...@panix.com wrote:
 In 76784bad-cd6d-48f9-b358-54afb2784...@googlegroups.com
 eamonn...@gmail.com writes:
 they're making programming easier... by not coding as much.
 Oh well, guess coding is dead :(

 Pressing keys on a keyboard was never the hard part of coding.

 Nor the fun part.

When John Henry was a little baby,
Sittin' on his daddy's knee,
He Telneted to the server with a tiny bit of code, and said:
Emacs will be the death of me, Lord, Lord!
Emacs will be the death of me.

Well John Henry said to the captain:
Go on and bring your toolkit round,
I'll pound out your GUI with a hundred thousand keystrokes,
And throw that GUI Builder down, Lord, Lord!
I'll throw that GUI Builder down.

Well John Henry hammered on his keyboard,
Till is fingers were bloody stumps,
And the very last words that were entered in his .blog were:
GUI Builders are for chumps, Lord, Lord!
Those GUI builders are for chumps.

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


Re: Python GUI?

2013-09-13 Thread eamonnrea
On Friday, September 13, 2013 8:56:15 PM UTC+1, Neil Cerutti wrote:
 On 2013-09-13, Joe Junior joe.fbs.jun...@gmail.com wrote:
 
  On 13 September 2013 15:39, John Gordon gor...@panix.com wrote:
 
  In 76784bad-cd6d-48f9-b358-54afb2784...@googlegroups.com
 
  eamonn...@gmail.com writes:
 
  they're making programming easier... by not coding as much.
 
  Oh well, guess coding is dead :(
 
 
 
  Pressing keys on a keyboard was never the hard part of coding.
 
 
 
  Nor the fun part.
 
 
 
 When John Henry was a little baby,
 
 Sittin' on his daddy's knee,
 
 He Telneted to the server with a tiny bit of code, and said:
 
 Emacs will be the death of me, Lord, Lord!
 
 Emacs will be the death of me.
 
 
 
 Well John Henry said to the captain:
 
 Go on and bring your toolkit round,
 
 I'll pound out your GUI with a hundred thousand keystrokes,
 
 And throw that GUI Builder down, Lord, Lord!
 
 I'll throw that GUI Builder down.
 
 
 
 Well John Henry hammered on his keyboard,
 
 Till is fingers were bloody stumps,
 
 And the very last words that were entered in his .blog were:
 
 GUI Builders are for chumps, Lord, Lord!
 
 Those GUI builders are for chumps.
 
 
 
 -- 
 
 Neil Cerutti

I don't fully understand the meaning of that, but that was a good poem!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python GUI?

2013-09-13 Thread eamonnrea
On Friday, September 13, 2013 8:50:13 PM UTC+1, Joe Junior wrote:
 On 13 September 2013 16:37,  eamonn...@gmail.com wrote:
 
  I disagree with you. It's not hard, and I apologise if its ever sounded 
  that way, but it is the fun part for me. I love spending hours(days even) 
  debugging.
 
 
 
  Well, thanks all for depressing me. Time to give up programming and find 
  something else to do with my life.
 
  --
 
  https://mail.python.org/mailman/listinfo/python-list
 
 
 
 lol! You made my day. :-D
 
 
 
 Well, you can always ignore any and all graphical design tools if
 
 you're working alone. And write all those Xs and Ys and widths and
 
 heights all day long. None of the mentioned graphical toolkits forces
 
 you to use them.
 
 
 
 And if you like debugging, GUI is not the main dish! Try networking
 
 and concurrent programming, loads and loads of fun!
 
 
 
 Of course, that's lots of other unnecessary time consuming stuff you
 
 can do. You just have to use your imagination.
 
 
 
 Joe

I was planning on getting into networking, but like I said, thanks to most 
people encouraging less coding, I don't code anymore. Glad I made your day 
though. :-) And unnecessary time consuming stuff -- That's my problem. Is 
*shouldn't* be unnecessary! It should be something that has to be done. That's 
what annoys me!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help please, why doesn't it show the next input?

2013-09-13 Thread William Bryant
On Thursday, September 12, 2013 9:39:33 PM UTC+12, Oscar Benjamin wrote:
 On 12 September 2013 07:04, William Bryant gogobe...@gmail.com wrote:
 
  Thanks everyone for helping but I did listen to you :3 Sorry. This is my 
  code, it works, I know it's not the best way to do it and it's the long way 
  round but it is one of my first programs ever and I'm happy with it:
 
 
 
 Hi William, I'm glad you've solved your initial problem and I just
 
 wanted to make a couple of comments about how your program could be
 
 simplified or improved. The comments are below.
 

Hello, I've done this so far but why doesn't the mode function work?

'''#*'''
#* Name:Mode-Median-Mean Calculator   *#
#**#
#* Purpose: To calculate the mode, median and mean of a list of numbers   *#
#*  and the mode of a list of strings because that is what we are *#
#*  learning in math atm in school :P *#
#**#
#* Author:  William Bryant*#
#**#
#* Created: 11/09/2013*#
#**#
#* Copyright:   (c) William 2013  *#
#**#
#* Licence: IDK :3*#
'''**'''




#-#   ~~Import things I am using~~   #-#

# |
#|
#   \/

import time
import itertools



#-#~~Variables that I am using, including the list.~~#-#

# |
#|
#   \/

List = []
NumberOfXItems = []
Themode = []

#-#   ~~Functions that I am using.~~ #-#

# |
#|
#   \/

def HMNs():
global TheStr, user_inputHMNs, List_input, List
user_inputHMNs = input(You picked string. This program cannot calculate 
the mean or median, but it can calculate the mode. :D  How many strings are you 
using in your list? (Can not be a decimal number)  \nEnter:  )
user_inputHMNs
time.sleep(1.5)
TheStr = int(user_inputHMNs)
for i in range(TheStr):
List_input = input(Enter your strings. (One in each input field):  )
List.append(List_input)
print(Your list - , List)
if List.count == int(user_inputHMNs):
break
mode()

def HMNn():
global TheNum, user_inputHMNn, List_input, List
user_inputHMNn = input(You picked number. :D How many numbers are you 
using in your list? (Can not be a decimal number) \nEnter:  )
user_inputHMNn
time.sleep(1.5)
TheNum = int(user_inputHMNn)
for i in range(TheNum):
List_input = input(Enter your numbers. (One in each input field):  )
List_input = int(List_input)
List.append(List_input)
print(Your list - , List)
if List.count == int(user_inputHMNn):
break
mode()
def NOS():
while True: # Loops forever (until the break)
answer = input(Does your list contain a number or a string?  \nEnter: 
)
answer = answer.lower()
if answer in (string, str, s):
HMNs()
break
elif answer in (number, num, n, int):
HMNn()
break
elif answer in (quit, q):
break  # Exits the while loop
else:
print(You did not enter a valid field, :P Sorry.  \nEnter: )
time.sleep(1.5)

def mode():
global NumberOfXItems, Themode
for i in List:
NumberOfXItems.append(i)
NumberOfXItems.append(List.count(i))
Themode = max(NumberOfXItems)
print(Themode)



#-#   ~~The functions which need calling~~   #-#

# |
#|
#   \/

NOS()
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help please, why doesn't it show the next input?

2013-09-13 Thread John Gordon
In 364bcdb3-fdd5-4774-b7d2-040e2ccb4...@googlegroups.com William Bryant 
gogobe...@gmail.com writes:

 Hello, I've done this so far but why doesn't the mode function work?

 def mode():
 global NumberOfXItems, Themode
 for i in List:
 NumberOfXItems.append(i)
 NumberOfXItems.append(List.count(i))
 Themode = max(NumberOfXItems)
 print(Themode)

As far as I can see, you're appending each of the user's numbers onto
NumberOfXItems, and you're also appending the number of times each number
occurs.

So, if the user had entered these numbers:

5 9 9 9 15 100 100

NumberOfXItems would end up looking like this:

5 1 9 3 9 3 9 3 15 1 100 2 100 2

The max is 100, but 9 is the most often-occuring number.

Also, since NumberOfXItems mixes user input and the counts of that input,
you risk getting a max that the user didn't even enter.  For example if the
user entered these numbers:

1 1 1 1 1 1 2 3

NumberOfXItems would end up looking like this:

1 6 1 6 1 6 1 6 1 6 1 6 2 1 3 1

The max is 6, which is a count, not user input.

mode would be much better written like this:

  def mode(mylist):

  max_occurrences = 0
  themode = None

  for i in mylist:
  thecount = mylist.count(i)
  if thecount  max_occurrences:
  max_occurrences = thecount
  themode = i

  print(themode)

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, The Gashlycrumb Tinies

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


Re: Help please, why doesn't it show the next input?

2013-09-13 Thread MRAB

On 13/09/2013 23:12, William Bryant wrote:

On Thursday, September 12, 2013 9:39:33 PM UTC+12, Oscar Benjamin wrote:

On 12 September 2013 07:04, William Bryant gogobe...@gmail.com wrote:

 Thanks everyone for helping but I did listen to you :3 Sorry. This is my 
code, it works, I know it's not the best way to do it and it's the long way round 
but it is one of my first programs ever and I'm happy with it:



Hi William, I'm glad you've solved your initial problem and I just

wanted to make a couple of comments about how your program could be

simplified or improved. The comments are below.



Hello, I've done this so far but why doesn't the mode function work?

'''#*'''
#* Name:Mode-Median-Mean Calculator   *#
#**#
#* Purpose: To calculate the mode, median and mean of a list of numbers   *#
#*  and the mode of a list of strings because that is what we are *#
#*  learning in math atm in school :P *#
#**#
#* Author:  William Bryant*#
#**#
#* Created: 11/09/2013*#
#**#
#* Copyright:   (c) William 2013  *#
#**#
#* Licence: IDK :3*#
'''**'''




#-#   ~~Import things I am using~~   #-#

# |
#|
#   \/

import time
import itertools



#-#~~Variables that I am using, including the list.~~#-#

# |
#|
#   \/


Global variables and no parameter passing: yuck! :-)


List = []
NumberOfXItems = []
Themode = []

#-#   ~~Functions that I am using.~~ #-#

# |
#|
#   \/


Your function names aren't meaningful.


def HMNs():
 global TheStr, user_inputHMNs, List_input, List
 user_inputHMNs = input(You picked string. This program cannot calculate the 
mean or median, but it can calculate the mode. :D  How many strings are you using in your 
list? (Can not be a decimal number)  \nEnter:  )


This line doesn't do anything:


 user_inputHMNs
 time.sleep(1.5)


This variable is an integer, yet it's called 'TheStr'.


 TheStr = int(user_inputHMNs)
 for i in range(TheStr):
 List_input = input(Enter your strings. (One in each input field):  )
 List.append(List_input)
 print(Your list - , List)


Here you're comparing the list's .count method with an integer. It'll 
never be true!



 if List.count == int(user_inputHMNs):
 break
 mode()

def HMNn():
 global TheNum, user_inputHMNn, List_input, List
 user_inputHMNn = input(You picked number. :D How many numbers are you using in 
your list? (Can not be a decimal number) \nEnter:  )
 user_inputHMNn
 time.sleep(1.5)
 TheNum = int(user_inputHMNn)
 for i in range(TheNum):
 List_input = input(Enter your numbers. (One in each input field):  )
 List_input = int(List_input)
 List.append(List_input)
 print(Your list - , List)


The same bug as above:


 if List.count == int(user_inputHMNn):
 break
 mode()
def NOS():
 while True: # Loops forever (until the break)
 answer = input(Does your list contain a number or a string?  \nEnter: 
)
 answer = answer.lower()
 if answer in (string, str, s):
 HMNs()
 break
 elif answer in (number, num, n, int):
 HMNn()
 break
 elif answer in (quit, q):
 break  # Exits the while loop
 else:
 print(You did not enter a valid field, :P Sorry.  \nEnter: )
 time.sleep(1.5)

def mode():
 global NumberOfXItems, Themode
 for i in List:


Here you're appending an item and then the number of times that the item 
occurs:



 NumberOfXItems.append(i)
 NumberOfXItems.append(List.count(i))


Here you're getting the maximum entry, be it an item or the number of 
times an item occurs (see above). Have a look at the Counter class from 
the collections module:



 Themode = max(NumberOfXItems)
 print(Themode)



#-#   ~~The functions which need calling~~   #-#

# |
#|
#   \/

NOS()



--

Re: Help please, why doesn't it show the next input?

2013-09-13 Thread William Bryant
Thanks for the contructive critisism - :D I'll try fix it up!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Language design

2013-09-13 Thread Chris Angelico
On Sat, Sep 14, 2013 at 5:32 AM, Terry Reedy tjre...@udel.edu wrote:
 Poetry, including that in English, often *is* concerned with formatting.
 Code is more like poetry than prose.


 You can take this
 paragraph of text, unwrap it, and then reflow it to any width you
 like, without materially changing my points.


 But you cannot do that with poetry!

Evangelical vicar in want of a portable second-hand font. Would
dispose, for the same, of a portrait, in frame, of the Bishop-elect of
Vermont.

I think you could quite easily reconstruct the formatting of that,
based on its internal structure. Even in poetry, English doesn't
depend on its formatting nearly as much as Python does; and even
there, it's line breaks, not indentation - so we're talking more like
REXX than Python. In fact, it's not uncommon for poetry to be laid out
on a single line with slashes to divide lines:

A boat beneath a sunny sky / Lingering onward dreamily / In an evening
of July / Children three that nestle near, / Eager eye and willing ear
/ Pleased a simple tale to hear...

in the same way that I might write:

call sqlexec connect to words; call sqlexec create table dict (word
varchar(20) not null); call sqlexec insert into dict values
('spam'); call sqlexec insert into dict values ('ham')

To be sure, it looks nicer laid out with line breaks; but it's
possible to replace them with other markers. And indentation still is
completely insignificant. The only case I can think of in English of
indentation mattering is the one you mentioned of first line of
subsequent paragraphs, not by any means a universal convention and
definitely not the primary structure of the entire document.

Making line breaks significant usually throws people. It took my
players a lot of time and hints to figure this out:
http://rosuav.com/1/?id=969

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


Re: Python GUI?

2013-09-13 Thread Steven D'Aprano
On Fri, 13 Sep 2013 12:37:03 -0700, eamonnrea wrote:

 I disagree with you. It's not hard, and I apologise if its ever sounded
 that way, but it is the fun part for me. I love spending hours(days
 even) debugging.
 
 Well, thanks all for depressing me. Time to give up programming and find
 something else to do with my life.

What on earth are you talking about?

If you like cutting trees down with an axe, the existence of chainsaws 
doesn't stop you from still using an axe.

If you don't like GUI app builders, don't use one.



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


Re: Language design

2013-09-13 Thread Mark Janssen
On Fri, Sep 13, 2013 at 4:57 PM, Chris Angelico ros...@gmail.com wrote:
 Evangelical vicar in want of a portable second-hand font. Would
 dispose, for the same, of a portrait, in frame, of the Bishop-elect of
 Vermont.

 I think you could quite easily reconstruct the formatting of that,
 based on its internal structure. Even in poetry, English doesn't
 depend on its formatting nearly as much as Python does;

(Just to dispose of this old argument:)  Both Python and English
depend on both syntactical, material delimiters and whitespace.  While
it may seem that Python depends more on whitespace than English, that
is highly contentious, poetry or not.  Take some literature, remove
all the tabs at paragraph start and CRs at paragraph-end so that it
all runs together and you'll find that it impossible to read -- you
just won't be able to enter into the universe that the author is
attempting to build.

-- 
MarkJ
Tacoma, Washington
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python GUI?

2013-09-13 Thread eamonnrea
But is it efficient to use an axe? Is it sensible to use an axe when there is a 
chainsaw? No. Eventually, everyone will be using chainsaws, and no one will be 
using axes. This is my point: to have fun and be productive, but apparently 
it's not possible.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: new to python

2013-09-13 Thread Steven D'Aprano
On Fri, 13 Sep 2013 12:02:26 -0700, Abhishek Pawar wrote:

 what should i do after learning python to get more comfortable with
 python?

Write programs with Python. Lots of programs.

Even just little programs which you throw away afterwards is fine. The 
important part is, write write write.

Don't forget to run them too. If you just write, you'll never know if 
they work or not. If they don't work, keep writing and debugging until 
they work.

Read programs. Lots of programs. I recommend you read the code in the 
standard library, you will learn a lot from it. Some of the code is a bit 
old and not necessarily best practice any more, but it is still good 
code.



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


Re: Python GUI?

2013-09-13 Thread Ben Finney
eamonn...@gmail.com writes:

 But is it efficient to use an axe?

Which criterion is more important to *you* — fun, or efficiency?

 Is it sensible to use an axe when there is a chainsaw? No.

Which criterion is more important to *you* — fun, or sensibility?

 Eventually, everyone will be using chainsaws, and no one will be using
 axes.

Which criterion is more important to *you* — fun, or popularity?

 This is my point: to have fun and be productive, but apparently it's
 not possible.

Who has said that's not possible? If you find using a tool to be both
fun and productive, use it and be happy. If not, use something else.

-- 
 \   “They can not take away our self respect if we do not give it |
  `\to them.” —Mohandas Gandhi |
_o__)  |
Ben Finney

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


Re: Python GUI?

2013-09-13 Thread Dave Angel
On 13/9/2013 15:37, eamonn...@gmail.com wrote:

 I disagree with you. It's not hard, and I apologise if its ever sounded that 
 way, but it is the fun part for me. I love spending hours(days even) 
 debugging.

 Well, thanks all for depressing me. Time to give up programming and find 
 something else to do with my life.

I expect that this thread has all been a troll, but on the off chance
that I'm wrong...

I spent 40+ years programming for various companies, and the only GUI
programs I wrote were for my personal use.  Many times I worked on
processors that weren't even in existence yet, and wrote my own tools to
deal with them.  Other times, there were tools I didn't like, and I
wrote my own to replace them.  One example of that is the keypunch.
Another is paper tape punch.  I was really glad to stop dealing with
either of those.

Still other times, tools were great, and I used them with pleasure.  If
the tool was flexible, I extended it.  And if it was limited, I
replaced it, or found a replacement.

Many times I've chosen a particular approach to solving a problem mainly
because it was something I hadn't done before.  On one project, I wrote
code whose job was to generate about 40,000 lines of C++ code that I
didn't feel like typing in, and maintaining afterward.  The data that
described what those lines should look like was under the control of
another (very large) company, and they could change it any time they
liked.  Most changes just worked.

If you seriously can't find anything interesting to do in software, and
tools to do it with, then maybe you should take up fishing.  With a
bamboo pole and a piece of string.

-- 
DaveA


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


Re: Python GUI?

2013-09-13 Thread Michael Torrie
On 09/13/2013 12:23 PM, eamonn...@gmail.com wrote:
 On Friday, September 13, 2013 4:02:42 AM UTC+1, Michael Torrie
 wrote:
 On 09/12/2013 10:03 AM, eamonn...@gmail.com wrote: I think your
 hate of gui designers is about 10 years out of date now, even if
 you still prefer not to use them.
 
 So, you are recommending not to code as much? :'( That is what
 depresses me. These tools depress me!

And some people think that automatic transmissions are depressing.  To
each his own.

 I don't understand why people don't want to code. It's time
 consuming: But that's the point!!! It *should* be time consuming. It
 *should* take time to make programs. Speed isn't the main thing, fun
 is. And these tools are taking the fun away.

And nothing in Gtk, Qt, Tk, wx, or any other modern toolkit prevents you
from declaratively creating your GUI.  And for small programs there's
nothing wrong with coding the gui by hand (and in fact I recommend it).

As complexity rises, though, I'd rather just code the creative parts of
things, and not busy-code, which is what gui code becomes.  Much of it
is boiler-plate, cut and pasted, etc.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Language design

2013-09-13 Thread Vito De Tullio
Chris Angelico wrote:

 Making line breaks significant usually throws people. It took my
 players a lot of time and hints to figure this out:
 http://rosuav.com/1/?id=969

fukin' Gaston!

-- 
By ZeD

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


[issue18902] Make ElementTree event handling more modular to allow custom targets for the non-blocking parser

2013-09-13 Thread Stefan Behnel

Stefan Behnel added the comment:

The way the XMLPullParser is implemented in lxml.etree now is that it simply 
inherits from XMLParser. This would also make sense for ElementTree, even 
before supporting arbitrary targets. The patch in ticket #18990 makes this 
simple to do.

For reference, here is the implementation in lxml.

Iterparse:

https://github.com/lxml/lxml/blob/master/src/lxml/iterparse.pxi

XMLPullParser:

https://github.com/lxml/lxml/blob/d9f7cd8d12a27cafc4d65c6e280ea36156e3b837/src/lxml/parser.pxi#L1357

SAX based parser that collects events and/or maps parser callbacks to callbacks 
on the target object:

https://github.com/lxml/lxml/blob/master/src/lxml/saxparser.pxi

--

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



[issue17741] event-driven XML parser

2013-09-13 Thread Stefan Behnel

Stefan Behnel added the comment:

The way the XMLPullParser is implemented in lxml.etree now is that it simply 
inherits from XMLParser. This would also make sense for ElementTree, even 
before supporting arbitrary targets. The patch in ticket #18990 makes this 
simple to do.

For reference, here is the implementation in lxml.

Iterparse:

https://github.com/lxml/lxml/blob/master/src/lxml/iterparse.pxi

XMLPullParser:

https://github.com/lxml/lxml/blob/d9f7cd8d12a27cafc4d65c6e280ea36156e3b837/src/lxml/parser.pxi#L1357

SAX based parser that collects events and/or maps parser callbacks to callbacks 
on the target object:

https://github.com/lxml/lxml/blob/master/src/lxml/saxparser.pxi

--

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



[issue1424152] urllib/urllib2: HTTPS over (Squid) Proxy fails

2013-09-13 Thread Senthil Kumaran

Senthil Kumaran added the comment:

I have a slight fear that this patch could be considered as a feature addition 
in 2.7 urllib.py, I would like to quell that and ensure that behaviour 
expectation is consistent when using urllib or urllib2 and latest 
urllib/request.py modules.

Also, tests + docs can help a lot in speedier reviews.

--

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



[issue17324] SimpleHTTPServer serves files even if the URL has a trailing slash

2013-09-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a58b620e4dc9 by Senthil Kumaran in branch '2.7':
Fix SimpleHTTPServer's request handling case on trailing '/'.
http://hg.python.org/cpython/rev/a58b620e4dc9

New changeset 1fcccbbe15e2 by Senthil Kumaran in branch '3.3':
Fix http.server's request handling case on trailing '/'.
http://hg.python.org/cpython/rev/1fcccbbe15e2

New changeset b85c9d2a5227 by Senthil Kumaran in branch 'default':
Fix http.server's request handling case on trailing '/'.
http://hg.python.org/cpython/rev/b85c9d2a5227

--
nosy: +python-dev

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



[issue17324] SimpleHTTPServer serves files even if the URL has a trailing slash

2013-09-13 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Thanks for the patches, Vajrasky and Karl. Fixed in currently active (3.4,3.3 
and 2.7) versions of python.

--
assignee:  - orsenthil
resolution:  - fixed
stage: test needed - committed/rejected
status: open - closed
versions:  -Python 3.2

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



[issue18725] Multiline shortening

2013-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch. It get rid of TextWrap.shorten() because TextWrap.fill() 
supersedes it and because placeholder now a parameter of TextWrap. Module 
level shorten() is left but I doubt about it.

--
keywords: +patch
stage: test needed - patch review
Added file: http://bugs.python.org/file31736/textwrap_max_lines.patch

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



[issue18468] re.group() should never return a bytearray

2013-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Oh, seems I again did not attach a patch. Now I understand why there were no 
any feedback so long time.

--
keywords: +needs review, patch
Added file: http://bugs.python.org/file31737/re_group_type.patch

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



[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-09-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Are there tests for all the builtin scalars?

--

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



[issue18818] Empty PYTHONIOENCODING is not the same as nonexistent

2013-09-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c7fdb0637d0b by Serhiy Storchaka in branch 'default':
Issue #18818: The encodingname part of PYTHONIOENCODING is now optional.
http://hg.python.org/cpython/rev/c7fdb0637d0b

--
nosy: +python-dev

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



[issue18818] Empty PYTHONIOENCODING is not the same as nonexistent

2013-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Ezio and Vajrasky for the review.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed
type: behavior - enhancement
versions:  -Python 2.7, Python 3.3

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



[issue18999] Robustness issues in multiprocessing.{get, set}_start_method

2013-09-13 Thread Lars Buitinck

Lars Buitinck added the comment:

Ok. Do you (or jnoller?) have time to review my proposed patch, at least before 
3.4 is released? I didn't see it in the release schedule, so it's probably not 
planned soon, but I wouldn't want the API to change *again* in 3.5.

--

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



[issue9951] introduce bytes.hex method

2013-09-13 Thread Serhiy Storchaka

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


--
status: open - pending

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



[issue19008] tkinter: UnboundLocalError: local variable 'sys' referenced before assignment

2013-09-13 Thread Laurence McGlashan

New submission from Laurence McGlashan:

Traceback (most recent call last):
  File string, line 1, in module
  File /usr/lib64/python2.7/site-packages/sk1/__init__.py, line 21, in 
module
app.main.main()
  File /usr/lib64/python2.7/site-packages/sk1/app/main.py, line 150, in main
application = SketchApplication(filename, options.display, 
options.geometry, run_script = options.run_script)
  File /usr/lib64/python2.7/site-packages/sk1/app/skapp.py, line 155, in 
__init__
TkApplication.__init__(self, screen_name = screen_name, geometry = geometry)
  File /usr/lib64/python2.7/site-packages/sk1/app/skapp.py, line 60, in 
__init__
self.init_tk(screen_name, geometry)
  File /usr/lib64/python2.7/site-packages/sk1/app/skapp.py, line 185, in 
init_tk
TkApplication.init_tk(self, screen_name = screen_name, geometry = geometry)
  File /usr/lib64/python2.7/site-packages/sk1/app/skapp.py, line 63, in 
init_tk
self.root = Tk(screenName = screen_name, baseName = self.tk_basename, 
className = self.tk_class_name)
  File /usr/lib64/python2.7/lib-tk/Tkinter.py, line 1748, in __init__
if not sys.flags.ignore_environment:
UnboundLocalError: local variable 'sys' referenced before assignment


Patch attached.

--
components: Tkinter
files: Tkinter.patch
keywords: patch
messages: 197563
nosy: Laurence.McGlashan
priority: normal
severity: normal
status: open
title: tkinter: UnboundLocalError: local variable 'sys' referenced before 
assignment
versions: Python 2.7
Added file: http://bugs.python.org/file31738/Tkinter.patch

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



[issue18993] There is an overshadowed and invalid test in testmock.py

2013-09-13 Thread Michael Foord

Michael Foord added the comment:

Well, they actually test slightly different scenarios - they're *not* just 
duplicates of each other.

--

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



[issue19008] tkinter: UnboundLocalError: local variable 'sys' referenced before assignment

2013-09-13 Thread Laurence McGlashan

Changes by Laurence McGlashan laurence.mcglas...@gmail.com:


--
type:  - crash

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



[issue18945] Name collision handling in tempfile is not covered by tests

2013-09-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 63f25483c8f6 by Eli Bendersky in branch '3.3':
Issue #18945: Add tests for tempfile name collision handling.
http://hg.python.org/cpython/rev/63f25483c8f6

New changeset c902ceaf7825 by Eli Bendersky in branch 'default':
Issue #18945: Add tests for tempfile name collision handling.
http://hg.python.org/cpython/rev/c902ceaf7825

--
nosy: +python-dev

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



[issue19008] tkinter: UnboundLocalError: local variable 'sys' referenced before assignment

2013-09-13 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
resolution:  - duplicate
status: open - closed
superseder:  - Security bug in tkinter allows for untrusted, arbitrary code 
execution.

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



[issue18945] Name collision handling in tempfile is not covered by tests

2013-09-13 Thread Eli Bendersky

Eli Bendersky added the comment:

Thanks Vlad, committed to 3.3/3.4; would you like to provide the 2.7 patch?

--

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



[issue18911] minidom does not encode correctly when calling Document.writexml

2013-09-13 Thread Eli Bendersky

Changes by Eli Bendersky eli...@gmail.com:


--
nosy:  -eli.bendersky

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



[issue18998] iter() not working in ElementTree

2013-09-13 Thread Eli Bendersky

Eli Bendersky added the comment:

I can't reproduce it with the most recent default branch (Python 3.4.0a2+ 
(default:c7fdb0637d0b, Sep 13 2013, 05:29:00)) either.

Unless I'm missing something, there's no issue here. Let me know if something 
else can be done. Otherwise I'll close the issue in a couple of days.

--

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



[issue18945] Name collision handling in tempfile is not covered by tests

2013-09-13 Thread Vlad Shcherbina

Changes by Vlad Shcherbina vlad.shcherb...@gmail.com:


Added file: http://bugs.python.org/file31739/tempfile_collision_tests_27

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



[issue18997] Crash when using pickle and ElementTree

2013-09-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 39823ebfc731 by Eli Bendersky in branch '3.3':
Issue #18997: fix ElementTree crash with using pickle and __getstate__.
http://hg.python.org/cpython/rev/39823ebfc731

New changeset bda5a87df1c8 by Eli Bendersky in branch 'default':
Merge for Issue #18997: Issue #18997: fix ElementTree crash with using pickle 
and __getstate__.
http://hg.python.org/cpython/rev/bda5a87df1c8

--
nosy: +python-dev

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



[issue18997] Crash when using pickle and ElementTree

2013-09-13 Thread Eli Bendersky

Eli Bendersky added the comment:

Fixed the patch and committed. Thanks.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue18945] Name collision handling in tempfile is not covered by tests

2013-09-13 Thread R. David Murray

R. David Murray added the comment:

We don't generally backport tests unless they are part of a bug fix.  It's not 
a blanket prohibition, but normally the risk of false positives in a 
maintenance release on platforms not covered by our buildbots outweighs the 
benefits of adding the tests.

--
nosy: +r.david.murray

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



[issue9951] introduce bytes.hex method

2013-09-13 Thread Arnon Yaari

Arnon Yaari added the comment:

You can follow the discussion I linked in the ticket description for an answer:
http://psf.upfronthosting.co.za/roundup/tracker/issue3532
Mainly the answer is: to conform to PEP 358 and to provide the opposite of 
bytes.fromhex.
I agree that you can use binascii, but apparently it was decided that this 
functionality is good to have in the builtins (what used to be 
encode/decode('hex') in Python 2.x, and what is now bytes.fromhex, with the 
missing bytes.hex). In addition, binascii works a little differently - already 
discussed in the given link...

--
status: pending - open

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



[issue5815] locale.getdefaultlocale() missing corner case

2013-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Patch updated. Added tests. The locale_alias mapping updated to be 
self-consistency (i.e. for every name in locale_alias.values() normalize(name) 
== name).

--
assignee: docs@python - serhiy.storchaka
keywords:  -easy
nosy: +lemburg
stage: needs patch - patch review
versions:  -Python 3.2
Added file: http://bugs.python.org/file31740/locale_parse_2.patch

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



[issue18945] Name collision handling in tempfile is not covered by tests

2013-09-13 Thread Eli Bendersky

Eli Bendersky added the comment:

On Fri, Sep 13, 2013 at 6:28 AM, R. David Murray rep...@bugs.python.orgwrote:


 R. David Murray added the comment:

 We don't generally backport tests unless they are part of a bug fix.  It's
 not a blanket prohibition, but normally the risk of false positives in a
 maintenance release on platforms not covered by our buildbots outweighs the
 benefits of adding the tests.


These tests are very related to an actual bug-fix (
http://bugs.python.org/issue18849). Moreover, they cover a previously
uncovered feature which resulted in very intermittent heisen-bugs where
temp file creation was occasionally failing on some platforms. IMHO having
this covered is worth the small maintenance burden of the tests - who
knows, it may uncover real problems. What do you think?

--

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



[issue18844] allow weights in random.choice

2013-09-13 Thread Eli Bendersky

Changes by Eli Bendersky eli...@gmail.com:


--
nosy:  -eli.bendersky

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



[issue19009] Enhance HTTPResponse.readline() performance

2013-09-13 Thread Kristján Valur Jónsson

New submission from Kristján Valur Jónsson:

Some applications require reading http response data in long polls as it 
becomes available.  This is used, e.g. to receive notifications over a HTTP 
stream.
Using response.read(large_buffer) is not possible because this will attempt to 
fullfill the entire request (using multiple underlying recv() calls), negating 
the attempt to get data as it becomes available.
Using readline, and using \n boundaries in the data, this problem can be 
overcome.
Currently, readline is slow because it will attempt to read one byte at a time. 
 Even if it is doing so from a buffered stream, it is still doing it one 
character at a time.
This patch adds a peek method to HttpResponse, which works both for chunked 
and non-chunked transfer encoding, thus improving the performance of readline.  
IOBase.readline will use peek() to determine the readahead it can use, instead 
of one byte which it must use by default.

--
components: Library (Lib)
files: peek.patch
keywords: patch
messages: 197574
nosy: kristjan.jonsson
priority: normal
severity: normal
status: open
title: Enhance HTTPResponse.readline() performance
type: performance
versions: Python 3.5
Added file: http://bugs.python.org/file31741/peek.patch

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



[issue5815] locale.getdefaultlocale() missing corner case

2013-09-13 Thread R. David Murray

R. David Murray added the comment:

It would be great if this could get a review by MAL, since it looks like a 
non-trivial change.

Also, you have some (commented out) debug prints in there.

--

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



[issue18989] reuse of enum names in class creation inconsistent

2013-09-13 Thread Eli Bendersky

Eli Bendersky added the comment:

I agree with David. This is yet another case where we try to go against Python 
and make enum special, and I'm against this. Nothing prevents users from 
accidentally overriding their own members and methods in normal classes as 
well. This is trivially discoverable with tests. Let's please stop making enum 
more and more complex with all these needless type checks. We'll never get out 
of it.

--

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



[issue5815] locale.getdefaultlocale() missing corner case

2013-09-13 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 13.09.2013 15:30, Serhiy Storchaka wrote:
 
 Serhiy Storchaka added the comment:
 
 Patch updated. Added tests. The locale_alias mapping updated to be 
 self-consistency (i.e. for every name in locale_alias.values() 
 normalize(name) == name).

Could you elaborate on the alias changes ?

Were those coming from an updated X11 local.alias file ?

If so, I'd suggest to create two patches: one with the alias
updates (which can then also be backported) and one with the
new normalization code (which is a new feature and probably
cannot be backported).

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

--

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



[issue17394] Add slicing support to collections.deque

2013-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What type should be a result of slicing? List, tuple, deque, other?

--

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



[issue17087] Improve the repr for regular expression match objects

2013-09-13 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Serhiy, at the first glance, that repr doesn't make sense to me, thus it seems 
a little difficult to comprehend.

--

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



[issue5815] locale.getdefaultlocale() missing corner case

2013-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Also, you have some (commented out) debug prints in there.

These debug prints were in old code.

--

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



[issue5815] locale.getdefaultlocale() missing corner case

2013-09-13 Thread R. David Murray

R. David Murray added the comment:

Ah, I see.  I only scanned the patch quickly, obviously.

--

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



[issue18945] Name collision handling in tempfile is not covered by tests

2013-09-13 Thread R. David Murray

R. David Murray added the comment:

If they are part of a bug fix, then sure.  That wasn't clear from this issue, 
though.  On the other hand, if the tests in that other issue cover the actual 
bug, and these have any chance of *introducing* test failures (especially if 
they are heisenburgs, although I'm assuming the point is that they are not), 
then I'd say no.  The issue with backporting tests isn't about maintenance 
burden (backporting tests actually makes the maintenance burden smaller, not 
larger).  The issue is potential effectively spurious test failures in the 
field in a maintenance release.

To put it another way: the right place to find test bugs is in a feature 
release, which we then fix in the next maintenance release.  We do *not* want 
to find test bugs in maintenance releases.

--

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



[issue5815] locale.getdefaultlocale() missing corner case

2013-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Could you elaborate on the alias changes ?
 Were those coming from an updated X11 local.alias file ?

No, they are not from X11 local.alias file. They are a result of the 
test_locale_alias self-test, I have fixed all failures.

This test can't be backported without rest of changes, because they fix other 
error, for example processing encodings with hyphen. Without them 
test_locale_alias will fail even with updated locale_alias. I.e. we can 
backport either changes to locale_alias without tests, or changes to 
locale_alias with all changes to parser and tests, or changes to parser and all 
tests except test_locale_alias.

Current code doesn't work with locales with modifiers and locales with 
hyphenated encodings.

--

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



[issue18987] distutils.utils.get_platform() for 32-bit Python on a 64-bit machine

2013-09-13 Thread Sam Ferencik

Sam Ferencik added the comment:

Are you asking *what* distutils does?

It tackles the problem completely differently on Windows, Unix, and OS X.

--

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



[issue5815] locale.getdefaultlocale() missing corner case

2013-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch without changes to locale_alias.

--

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



[issue5815] locale.getdefaultlocale() missing corner case

2013-09-13 Thread Serhiy Storchaka

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


Added file: http://bugs.python.org/file31742/locale_parse_2a.patch

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



[issue18987] distutils.utils.get_platform() for 32-bit Python on a 64-bit machine

2013-09-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Are you asking *what* distutils does?

Yup :-) I'm not a distutils maintainer, so I hardly know how it does
things internally.

 It tackles the problem completely differently on Windows, Unix, and
 OS X.

Ah... but does it compute the result by itself or simply queries some
kind of external information?
If the former, then it should be simple to give it the right bitness
value (32 vs. 64). If the latter, things will get a bit more...
interesting :-)

--
title: distutils.utils.get_platform() for 32-bit Python on a64-bit machine 
- distutils.utils.get_platform() for 32-bit Python on   a   64-bit machine

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



[issue19009] Enhance HTTPResponse.readline() performance

2013-09-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This sounds ok on the principle. I suppose one can't simply wrap the fp 
inside a BufferedReader?
I think it would be good to add tests for the peek() implementation, though.

--
nosy: +orsenthil, pitrou, serhiy.storchaka
stage:  - patch review
versions: +Python 3.4 -Python 3.5

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



[issue18902] Make ElementTree event handling more modular to allow custom targets for the non-blocking parser

2013-09-13 Thread Stefan Behnel

Stefan Behnel added the comment:

 Also, +1 for allowing start-ns and end-ns event callbacks on parser targets, 
 although that's a different feature entirely.

Actually, I take that back. I can't see a use case for this feature, and it 
doesn't really fit with the notion of fully qualified tag names in ElementTree 
(which itself is a great feature). I'm -0.7 on adding this.

--

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



[issue18987] distutils.utils.get_platform() for 32-bit Python on a 64-bit machine

2013-09-13 Thread Éric Araujo

Éric Araujo added the comment:

FTR the Mac OS code does some normalization: 
http://hg.python.org/cpython/file/bda5a87df1c8/Lib/_osx_support.py#l473

Code for linux just returns the value from uname, as Same said: 
http://hg.python.org/cpython/file/bda5a87df1c8/Lib/distutils/util.py#l75

--

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



[issue18989] reuse of enum names in class creation inconsistent

2013-09-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

What if I redefine an existing key inside a subclass?

--

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



[issue18989] reuse of enum names in class creation inconsistent

2013-09-13 Thread Ethan Furman

Ethan Furman added the comment:

One cannot subclass an Enum that has already defined keys.

--

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



[issue19009] Enhance HTTPResponse.readline() performance

2013-09-13 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

The problem is that self.fp is already a Buffered stream, and such streams are 
documented to have their read() and readinto() calls make multiple system calls 
to fullfill the request.

My original goal was actually to make response.read(amt) not try to make 
multiple read() calls, so that one could have other delimiters than newline.  
It is simple for the chunked case, but I don't know how to bypass it for 
response.fp, since it is already a buffered file that has no guaranteed such 
behaviour wait, one can simply call peek() on it and know how much one can 
get :)

But anyway, the use case I have actually uses newlines as record separators in 
the http stream, so this enhancement seems less intrusive.

I'll add unit tests.  There ought to be ready-made HTTPResponse tests already 
that I can use as templates.

--

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



[issue18987] distutils.utils.get_platform() for 32-bit Python on a 64-bit machine

2013-09-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 On Unix, specifically, the return value is heavily based on os.uname().

Ouch. Then I'm afraid this is a probably a won't fix :-/

--

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



[issue18989] reuse of enum names in class creation inconsistent

2013-09-13 Thread Ethan Furman

Ethan Furman added the comment:

Perhaps you meant, what if you define a key in a subclass that shadows a 
method/property in a parent class?

I'm inclined to say that would be acceptable, since one reason for subclassing 
is to add or make changes to the parent class' behavior.

--

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



  1   2   3   >