Re: request for guidance

2013-12-14 Thread rusi
On Saturday, December 14, 2013 10:41:09 AM UTC+5:30, David Hutto wrote:

> Don't get me wrong, I didn't mean reinventing the wheel is a bad
> thing, just that once you get the hang of things, you need to
> display some creativity in your work to set yourself apart from the
> rest.

> Nowadays, everyone's a programmer.

> If it weren't for reinventing the wheel, then we wouldn't have
> abs(antilock breaking systems), or new materials, or different
> treading for water displacement or hydroplaning.

> The point was just to try something in python, and to 'boldly go
> where no 'man' has gone before'.  Just to remind her that it's not
> just about python, but what you can accomplish with it, and
> distinguish yourself from others.

To complement what David is saying, programmers need to know
programming but a lot else besides in order to become even minimally
productive. eg

Primary Development tools/aids

   1. Help
   2. Interpreter-CLI
   3. Interpreter-Introspection
   4. Editor
   5. Completion ('intellisense')
   6. Tags (navigation)
   7. Refactoring
   8. Integration with 'non-programming' below


Other Development Tools
   1. Debugger
   2. Profiler
   3. Heap Profiler
   4. Coverage

Non-Programming

 Area | Tool(s)  
--+--
 packaging| distutils, setuptools
  | pip
  | Native tools (eg apt)
 versioning   | hg, git, bzr 
 multiple pythons | virtualenv   
 automation   | tox  
 testing  | unittest, nose, pytest
 build| scons, make...   
 deployment   | fabric   

Yeah I know this can sound a bit intimidating :-)

In actual practice most active developers need to know about 30% of the above

But you need to know which is your 30% ;-)

PS. Yeah you can say Im just a teacher trying to justify my job!!  On
the other side, for years I argued with the authorities that a 3 year
CS degree could be reduced to 6 months.

But I dont think it could be reduced to 6 days... or even 6 weeks
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Eliminate "extra" variable

2013-12-14 Thread Igor Korot
Tim,

On Sun, Dec 8, 2013 at 2:18 PM, Tim Chase  wrote:
> On 2013-12-08 12:58, Igor Korot wrote:
>> Also, the data comes from either SQLite or mySQL and so to eliminate
>> the difference between those engines dates are processed as strings
>> and converted to dates for the calculation purposes only.
>> Maybe I will need to refactor SQLite processing to get the dates as
>> dates and not a string, but that's probably for the future. so that
>> dates will be kept as the datetime type until the end of the
>> function. As I wrote the dates will be used as the text for the
>> plotting window axis labels and as the labels they should come out
>> as strings, hence the conversion.
>
> Sqlite can do this automatically if you tell it to upon connecting:
>
 import sqlite3
 conn = sqlite3.connect('x.sqlite',
> ...detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
 cur.execute("create table foo (s date);")
> 
 import datetime
 today = datetime.date.today()
 cur.execute("insert into foo(s) values (?)", (today,))
> 
 cur.execute("select * from foo")
> 
 r = cur.fetchone()
 print r
> (datetime.date(2013, 12, 8),)

Interesting.
I'm using datetime rather than the date type for CREATE TABLE() command.
And when running SELECT I still see the b'1998-08-05 23:12:12' string
representation when running my program under debugger.

And it is confirmed by running this:

>>> cur.execute("CREATE TABLE foo(bar datetime);")

>>> import datetime
>>> today = datetime.date.today()
>>> cur.execute("insert into foo(bar) values (?)", (today,))

>>> cur.execute("select * from foo")

>>> res = cur.fetchall()
>>> print res
[(u'2013-12-14',)]
>>>

So, I guess this is a bug in the sqlite3 python module as datetime is
legal data type on the DB engine.

Thank you.

>
>
> Note that it returns a datetime.date, the same as it was defined.
>
> -tkc
>
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: CP65001 fails (was re: ...)

2013-12-14 Thread rusi
On Sunday, December 15, 2013 10:30:12 AM UTC+5:30, Steven D'Aprano wrote:
> I'm sorry, I was under the impression that Mark had done most of the 
> work. I hadn't realised that others had contributed most of the practical 
> advice.

To be fair, I added the stuff to the wiki on Mark's prompting.
Earlier was under the impression that not anyone could edit the wiki.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New to Python, Help to get script working?

2013-12-14 Thread Chris Angelico
On Sun, Dec 15, 2013 at 3:51 PM, Mark  wrote:
> I have successfully installed python 3.3 for windows, pip and livestreamer 
> that is needed for it to work.

What I'm seeing in that script suggests that it actually needs Python
2.7, not 3.3. The best approach would be to make it work with Python
3, but if you can't do that, try installing Python 2.

But more generally, when you get errors, it helps *hugely* to copy and
paste the error - don't just say "on line 19", and leave us to guess
what error you're getting :)

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


Re: CP65001 fails (was re: ...)

2013-12-14 Thread Chris Angelico
On Sun, Dec 15, 2013 at 3:42 PM, rusi  wrote:
> To me all this GG complaining sounds like some elderly mom-pop-uncle
> who weeps/coaxes/moans/pleads/grumbles/ about a fused light bulb,
> rather than climbing on a stool and changing the bloody thing.

No, it's like moaning about Foo Brand light bulbs that die after two
weeks, when there are perfectly good light bulbs that last for years
if you'll just use a different brand. And there are people who say
"But Foo Brand light bulbs are easy, you just go up on a ladder every
time you want to turn it on and make sure there's a good bulb in it!".

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


Re: CP65001 fails (was re: ...)

2013-12-14 Thread Terry Reedy

On 12/14/2013 9:39 PM, Steven D'Aprano wrote:

On Sat, 14 Dec 2013 13:43:41 -0500, Terry Reedy wrote:


This was reported by Victor Stinner as part of
http://bugs.python.org/issue19914
to explain how cp65001 causes behavior like this with Python's
interactive help() function (which more for paging on Windows).

  >>> help(str)
Not enough memory.



Terry, I see you have closed the bug report. I think you were a little
hasty.


I might have been premature, but I was not hasty. I read the SO reports 
and though about it for an hour or so while looking at other issues. I 
did not see any use to leaving it open as I did not see any realistic 
propect of a useful and acceptible patch to Python. The OP himself said 
that i/o did not work with 65001 and that not using it fixed his issue.



The ultimate cause of the bug may be the failure of Window's
"more" command when the code-page is set to CP-65001, but that doesn't
necessarily imply that Python shouldn't, or can't, do something about it.


I believe running Python on Windows with cp=65001 falls in the category 
of "Don't do that". This is based on my experiences and the reported 
experience of other developers who have tried and failed to make it 
work, reinforced by the SO thread and a couple of other web pages.



The interactive help system already supports different pagers, depending
on the environment. I think that it could fall back on a more primitive
pager if the preferred one fails.


Do you know if 'more' actually signals failure?
Do you know if there are any other situations in which a pager fails?


The relevant code is the pager() and
getpager() functions in the pydoc module. The patch won't be trivial, but
I think it can be done, and I think it should be done. Although possibly
for Python 3.5 rather than a bug-fix version. Your thoughts?


My thought is that if the only situation in which a pager fails is one 
that one should not use, because other things will also fail, then a 
patch would not be worth the bother.


--
Terry Jan Reedy

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


Re: New to Python, Help to get script working?

2013-12-14 Thread Steven D'Aprano
On Sat, 14 Dec 2013 20:51:59 -0800, Mark wrote:

> Hey guys, I found this website that has a script in order to increase
> numbers to a live viewing stream. Being new to python, I keep running
> into problems trying to get it to work.
> 
> The original site is here, as he talks about how it works. It is the top
> article.
> 
> http://www.ericzhang.me/
> 
> I have successfully installed python 3.3 for windows, 

Great! But what version of Python is that script written for?

[...]
> I get errors on line 19 and cant get it to work at all.

Errors plural? Multiple errors on one line? That's unusual.

Please copy and paste (don't summarise or re-type from memory) the entire 
traceback showing the full error you get. That is, copy and paste 
*everything* from the first line

Traceback (most recent call last)


all the way to the end of the error message.



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


Re: CP65001 fails (was re: ...)

2013-12-14 Thread Steven D'Aprano
On Sat, 14 Dec 2013 20:42:40 -0800, rusi wrote:

> On Sunday, December 15, 2013 4:21:08 AM UTC+5:30, Steven D'Aprano wrote:
>> Apart from annoying the bystanders, your repeated angry and abusive
>> screeds aimed at JMF in particular but others as well over minor
>> formatting issues is more disruptive than the issues you are
>> complaining about. I am grateful to you for taking the time and effort
>> to write up a wiki page on fixing this issues, but gratitude for that
>> will only go so far in forgiving disruptive behaviour.
> 
> I guess you are talking about
> https://wiki.python.org/moin/GoogleGroupsPython
> 
> As you will see
> https://wiki.python.org/moin/GoogleGroupsPython?action=info
> 
> most of the edits there are by rurpy and the recent ones (sorry I missed
> putting comments) which are for a more automatic solution are by me.

I'm sorry, I was under the impression that Mark had done most of the 
work. I hadn't realised that others had contributed most of the practical 
advice.


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


New to Python, Help to get script working?

2013-12-14 Thread Mark
Hey guys, I found this website that has a script in order to increase numbers 
to a live viewing stream. Being new to python, I keep running into problems 
trying to get it to work.

The original site is here, as he talks about how it works. It is the top 
article.

http://www.ericzhang.me/

I have successfully installed python 3.3 for windows, pip and livestreamer that 
is needed for it to work. They are in my scripts folder. I either do not 
understand the script or it no longer works. It is more than likely my error. I 
get errors on line 19 and cant get it to work at all.

The included code is located here

https://gist.github.com/Xeroday/6468146/raw/1b7fb468551a4ba5b73ea3c0b7bc47591c3a8c51/Twitch.py


If anybody could provide some incite on how to get it to work, how the 
variables work, and such, I would be so grateful!

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


Re: CP65001 fails (was re: ...)

2013-12-14 Thread rusi
On Sunday, December 15, 2013 4:21:08 AM UTC+5:30, Steven D'Aprano wrote:
> Apart from annoying the bystanders, your repeated angry and abusive 
> screeds aimed at JMF in particular but others as well over minor 
> formatting issues is more disruptive than the issues you are complaining 
> about. I am grateful to you for taking the time and effort to write up a 
> wiki page on fixing this issues, but gratitude for that will only go so 
> far in forgiving disruptive behaviour.

I guess you are talking about
https://wiki.python.org/moin/GoogleGroupsPython

As you will see
https://wiki.python.org/moin/GoogleGroupsPython?action=info

most of the edits there are by rurpy and the recent ones
(sorry I missed putting comments) which are for a more automatic solution
are by me.

[No I am not asking for 'gratitude'... just sayin' and giving some context]

There was this ridiculous guy Jonas
https://mail.python.org/pipermail/python-list/2013-October/658671.html

who responded to calls to correct the typical GG mess with more and more
exceptional rudeness
https://mail.python.org/pipermail/python-list/2013-October/658816.html

So I thought to myself: Well this is too much!
And yet while the rudeness is indefensible the technical grumble:
"I'm not going to go deleting newlines" is not.

Hell! Rather than making a socio-eco-politco-anthropo-marxist-feminist
mess, why dont we fix a technical problem technically??

To me all this GG complaining sounds like some elderly mom-pop-uncle
who weeps/coaxes/moans/pleads/grumbles/ about a fused light bulb,
rather than climbing on a stool and changing the bloody thing.

So, given that I am a programmer I came up (with some tips from Kushal
Kumaran?) with a technical solution.  If I were an ace programmer (can
learn JS in a day and make useful contributions) it would have been a
0-click solution.  [And if I were a super-ace, it would have been a
beneficient virus, that would comb the net, discover all GG users and
self-install without anyone's knowing] Since I am not ace or super-ace
but only a humble programmer (like Dijkstra!) its a 2-click solution
that needs installation :-;

Still, GIVEN THE CONTEXT -- addressing not anyone but an already-GG
user who is clueless about the nuisance he's causing -- I think this
solution is easiest to all.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: min max from tuples in list

2013-12-14 Thread Tim Roberts
Dennis Lee Bieber  wrote:
>
>>
>>Well "performant" is performant enough for the purposes of communicating
>>on the python list I think :D
>
>   Most probably could figure it out as being stylistically similar to
>"conformant", which I believe IS used in English 
>
>conformant => something that conforms
>performant => something that performs

Yes, I suspect it comes from people expecting too much consistency.  If
something that has "conformance" is "conformant", then something that has
good "performance" must be "performant".
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: a Python Static Analyzer

2013-12-14 Thread Mark Lawrence

On 15/12/2013 02:36, Chris Rebert wrote:

On Sat, Dec 14, 2013 at 5:31 PM, Dan Stromberg  wrote:

Where does PySonar2 sit in the spectrum from pylint
(thorough/pedantic) to pyflakes (relaxed/few-false-positives)?

I use pylint and pyflakes a lot, and I've heard that PyChecker sits in
between them on this axis.


My impression is that PyChecker has been abandoned.
The last commit in its SourceForge CVS repo is from 2008, and `pip
install PyChecker` fails.

Cheers,
Chris



I've no idea as to the real status of Pyflakes so hopefully this 
https://mail.python.org/pipermail/code-quality/2013-December/000189.html 
is just a temporary hickup.


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


Mark Lawrence

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


Re: a Python Static Analyzer

2013-12-14 Thread Chris Rebert
On Sat, Dec 14, 2013 at 5:31 PM, Dan Stromberg  wrote:
> Where does PySonar2 sit in the spectrum from pylint
> (thorough/pedantic) to pyflakes (relaxed/few-false-positives)?
>
> I use pylint and pyflakes a lot, and I've heard that PyChecker sits in
> between them on this axis.

My impression is that PyChecker has been abandoned.
The last commit in its SourceForge CVS repo is from 2008, and `pip
install PyChecker` fails.

Cheers,
Chris
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: CP65001 fails (was re: ...)

2013-12-14 Thread Steven D'Aprano
On Sat, 14 Dec 2013 13:43:41 -0500, Terry Reedy wrote:

> This was reported by Victor Stinner as part of
> http://bugs.python.org/issue19914
> to explain how cp65001 causes behavior like this with Python's
> interactive help() function (which more for paging on Windows).
> 
>  >>> help(str)
> Not enough memory.


Terry, I see you have closed the bug report. I think you were a little 
hasty. The ultimate cause of the bug may be the failure of Window's 
"more" command when the code-page is set to CP-65001, but that doesn't 
necessarily imply that Python shouldn't, or can't, do something about it.

The interactive help system already supports different pagers, depending 
on the environment. I think that it could fall back on a more primitive 
pager if the preferred one fails. The relevant code is the pager() and 
getpager() functions in the pydoc module. The patch won't be trivial, but 
I think it can be done, and I think it should be done. Although possibly 
for Python 3.5 rather than a bug-fix version. Your thoughts?



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


Re: a Python Static Analyzer

2013-12-14 Thread Dan Stromberg
On Sat, Dec 14, 2013 at 4:35 PM,   wrote:
> Hi,
>
> I thought it would be worth contributing some awareness of Yin Wang's 
> PySonar2 Python static analyzer being open sourced, it's here 
> https://github.com/yinwang0/pysonar2.  I recently converted it from being 
> implemented in Java to being implemented in Python - here 
> https://github.com/ariejdl/pysonarsq.  All the critical tests pass, it may 
> interest pythonistas to be able to hack on something like this actually in 
> Python.

This is interesting.

Where does PySonar2 sit in the spectrum from pylint
(thorough/pedantic) to pyflakes (relaxed/few-false-positives)?

I use pylint and pyflakes a lot, and I've heard that PyChecker sits in
between them on this axis.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] trying socket as a replacement for nc

2013-12-14 Thread Dan Stromberg
On Fri, Dec 13, 2013 at 8:06 AM, Grant Edwards  wrote:
> On 2013-12-12, Dan Stromberg  wrote:
>> On Thu, Dec 12, 2013 at 6:16 AM, Grant Edwards  
>> wrote:
>>
 Sockets reserve the right to split one socket.send() into multiple
 socket.recv()'s on the other end of the communication, or to aggregate
 multiple socket.send()'s into a single socket.recv() - pretty much any way
 the relevant IP stacks and communications equipment feel like for the sake
 of performance or reliability.
>>>
>>> Just to be pedantic: _TCP_ sockets reserver that right.  UDP sockets
>>> do not, and do in fact guarantee that each message is discrete.  [It
>>> appears that the OP is undoubtedly using TCP sockets.]
>>
>> I haven't done a lot of UDP, but are you pretty sure UDP can't at
>> least fragment large packets?  What's a router or switch to do if the
>> Path MTU isn't large enough for an original packet?
>>
>> http://www.gamedev.net/topic/343577-fragmented-udp-packets/
>
> You're conflating IP datagrams and Ethernet packets.  The IP stack can
> fragment an IP datagram into multiple Ethernet packets which are then
> reassembled by the receiving IP stack into a single datagram before
> being passed up to the next layer (in this case, UDP).

As long as you're saying this of UDP, I have no problem with it.

I've seen TCP fragment and not be reassembled though, which suggests
to me that the reassembly's happening in UDP rather than IP.  If it's
done by IP the same way for UDP and TCP, I'd not trust it in UDP
either.

> Did you read the thread you pointed to?  Your question was answerd by
> posting #4 in the thread you cited:
>
>1) Yes, packets will be fragmented at the network layer (IP), but this
>   is something you do not have to worry about since the network
>   layer will reassemble the fragments before passing them back up
>   to the transport layer (UDP). UDP garentees preserved message
>   boundaries, so you never have to worry about only receiving a
>   packet fragment :~).

Actually, I believe the link I sent (which I skimmed) had people
coming down on both sides of the matter.  Some said that UDP would be
fine for small datagrams, while others said it would be fine,
irrespective of size.

>
> A few other references:
>
> http://tools.ietf.org/html/rfc791
>
>  1.1. Motivation
>
>   [...] The internet protocol provides for transmitting blocks of data
>   called datagrams from sources to destinations, [...] The internet
>   protocol also provides for fragmentation and reassembly of long
>   datagrams, if necessary, for transmission through "small packet"
>   networks.

I've personally seen this fail to occur in TCP - EG, it can cause a
stream of bytes to be written to tape with inconsistent block sizes if
transferred over rsh or ssh.  Usually the block sizes are consistent,
but not always.  Both SunOS 4.1.x and Ultrix had this issue; Ultrix
did it less often than SunOS, but Ultrix did do it.  I don't know for
certain if later *ix have the same issue, because I've been diligently
working around it ever since, but I suspect they do.

I've seen old time socket programmers explain that it cannot be relied
upon in TCP; send() and recv() and (read() and write()) are system
calls that return a length so that you can loop on them until all
relevant data has been transferred.  They don't return that length
just so you can ignore it.

>From the Socket HOWTO
(http://docs.python.org/2/howto/sockets.html#socket-howto) :
Now we come to the major stumbling block of sockets - send and recv
operate on the network buffers. They do not necessarily handle all the
bytes you hand them (or expect from them), because their major focus
is handling the network buffers. In general, they return when the
associated network buffers have been filled (send) or emptied (recv).
They then tell you how many bytes they handled. It is your
responsibility to call them again until your message has been
completely dealt with.

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


Re: [newbie] trying socket as a replacement for nc

2013-12-14 Thread Dan Stromberg
On Sat, Dec 14, 2013 at 5:33 AM, Jean Dubois  wrote:
> Op vrijdag 13 december 2013 16:35:31 UTC+1 schreef Jean-Michel Pichavant:
>> - Original Message -
>> > I have an ethernet-rs232 adapter which allows me to connect to a
>> > measurement instrument by means of netcat on a linux system.
>> > e.g. entering nc 10.128.59.63 7000
>> > allows me to enter e.g.
>> > *IDN?
>> > after which I get an identification string of the measurement
>> > instrument back.
>> > I thought I could accomplish the same using the python module
>> > "socket"
>> > and tried out the sample program below which doesn't work however:
>> > #!/usr/bin/env python
>> >
>> > """
>> > A simple echo client
>> > """
>> > import socket
>> > host = '10.128.59.63'
>> > port = 7000
>> > size = 10
>> > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>> > s.connect((host,port))
>> > s.send('*IDN?')
>> > data = s.recv(size)
>> > s.close()
>> > print 'Received:', data
>> >
>> > Can anyone here tell me how to do it properly?
>> > thanks in advance
>> > jean
>> Such equipment often implements a telnet protocol. Have use try using the 
>> telnetlib module ?
>> http://docs.python.org/2/library/telnetlib.html
>> t = Telnet(host, port)
>> t.write('*IDN?')
>> print t.read_until('Whateverprompt')
>> # you can use read_very_eager also
>> JM
> Thanks for the suggestion, I'll first wait for a response from Dan Stromberg 
> concerning how to install his module, if he doesn't answer or if I'm still 
> unsuccessfull then I'll try out your suggestion
>
> kind regards,
> jean
> --
> https://mail.python.org/mailman/listinfo/python-list

You can "svn checkout ".  You might try Sliksvn if you're on
Windows, or if you're on Linux it's in synaptic or yum or whatever.

You can "wget ".

You can bring up the URL in a web browser and cut and paste.
-- 
https://mail.python.org/mailman/listinfo/python-list


a Python Static Analyzer

2013-12-14 Thread arie . lakeman
Hi,

I thought it would be worth contributing some awareness of Yin Wang's PySonar2 
Python static analyzer being open sourced, it's here 
https://github.com/yinwang0/pysonar2.  I recently converted it from being 
implemented in Java to being implemented in Python - here 
https://github.com/ariejdl/pysonarsq.  All the critical tests pass, it may 
interest pythonistas to be able to hack on something like this actually in 
Python.

Thanks,

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


Re: CP65001 fails (was re: ...)

2013-12-14 Thread Mark Lawrence

On 14/12/2013 22:51, Steven D'Aprano wrote:

On Sat, 14 Dec 2013 21:05:05 +, Mark Lawrence wrote:


On 14/12/2013 20:48, wxjmfa...@gmail.com wrote:



print((os.linesep).join([unicodedata.name(c) for c in u]))

ETHIOPIC SYLLABLE SEE
LATIN SMALL LETTER E WITH ACUTE
EURO SIGN
CJK UNIFIED IDEOGRAPH-3456
CYRILLIC CAPITAL LETTER GJE
COUNTERBORE
ASTERISK

-

cp65001, font: Consolas

D:\jm\jmgo>echo "ሴé€㑖Ѓ⌴*"
"ሴé€㑖Ѓ⌴*"

As I explained some chars are rendered with the .notdef glyph: the
chars 1, 4 and 7.

I build an exe with the golang. Same result.

Just for curiosity:
XeTeX -> pdf: same result.
LucidaConsole CID TrueType,
Consolas CID TrueType
understand: "OpenType"

jmf



Where is the Python related issue here?


Read the whole thread before charging in like a bull at a gate accusing
people of being off-topic. This is on-topic, and if you don't see the
connection, you need to read the whole thread.


I have.  Going back over this thread the words from Terry Reedy make 
things perfectly clear that this is a *WINDOWS* problem, not a *PYTHON* 
one.  Chris Angelico also weighed in, but again he was simply ignored. 
Instead some completely irrelevant cobblers turned up from "Joseph 
McCarthy".






Why do you keep posting double spaced crap, despite repeated requests
not to do so?  Or do you blame this on the allegedly failed PEP 393
FSR implementation?


I see no double-spacing in the text you quoted.


There is no double spacing because for the umpteenth time I've snipped 
the whole damn lot.




Do you have nothing better to do than continually hassle people over
minor formatting issues?


This is *NOT* a minor formatting issue, it's a big PITA that should be 
stopped at source.  It would be easier for this to happen if and only if 
people would stop defending the bug ridden crap tools that are being 
used to send the double spaced crap.


Oh Lord, won't you buy me Mozilla Thunderbird ?
My friends all use GG, I think that's absurd.
Worked hard all my lifetime, no help from the nerds,
So Lord, won't you buy me Mozilla Thunderbird ?



Formatting issues are harmful to the degree they get in the way of
efficient communication. Since by your own admission you have never
treated JMF as being credible, there's nothing he can write or say that
you will believe, so why do you care what he writes? You are not the
target of his communication unless you choose to be.


While he continues to talk crap here I will respond, as I will also 
complain about double spaced google crap until it stops.  I will further 
state again that I find his disgusting, unwarrented attacks on the PEP 
393 FSR indefensible, and are also an attack on the core developers 
who've taken the time to deliver a faster, (relatively) bug free and 
lower memory useage implementation of unicode for Python 3.3+.




Apart from annoying the bystanders, your repeated angry and abusive
screeds aimed at JMF in particular but others as well over minor
formatting issues is more disruptive than the issues you are complaining
about. I am grateful to you for taking the time and effort to write up a
wiki page on fixing this issues, but gratitude for that will only go so
far in forgiving disruptive behaviour.



Your opinion, obviously I disagree, these IMO are *NOT* minor issues, 
and they're also completely avoidable.  Stop the problems at source and 
there are no issues to complain about.  I've written no such thing, I 
simply point it out half a dozen times a day as the latest pile of crap 
turns up here.  Stop the problems at source and there are no issues to 
complain about.  Yes, that's there twice so nobody can miss it.


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


Mark Lawrence

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


Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-14 Thread Steven D'Aprano
On Sat, 14 Dec 2013 13:01:58 -0700, Michael Torrie wrote:

> On 12/14/2013 10:05 AM, Wolfgang Keller wrote:
>> Tkinter is a bit "special" to use since it's not just a library, but
>> uses some kind of RPC. It seems that "look and feel" have been greatly
>> improved lately.
> 
> I know Tkinter originated with the Tcl/Tk language.  With Tkinter in
> Python is it still using Tcl/Tk under the hood?  IE embeds the Tcl
> language interpreter into Python's interpreter?  If so I've always found
> it a bit strange that the de facto GUI library that's shipped with
> Python ships an entirely different language with it under the hood.

That's just the "Interpreter" design pattern, except the Domain Specific 
Language is already written for you :-)

(I'm half-serious here.)

But more seriously, 100% seriously in fact, I think that you'll find that 
*every* GUI framework for Python ships with an entirely different 
language under the hood, usually C. Even if the top level of the 
framework is written in Python, the underlying graphics routines used for 
drawing controls and windows will surely not be. Given that the actual 
maintenance of the GUI itself is unlikely to be a bottleneck in any real 
application, I don't think it is a significant problem efficiency-wise 
that Python tkinter relies on an intermediate framework written in Tcl.



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


Re: CP65001 fails (was re: ...)

2013-12-14 Thread Steven D'Aprano
On Sat, 14 Dec 2013 21:05:05 +, Mark Lawrence wrote:

> On 14/12/2013 20:48, wxjmfa...@gmail.com wrote:
>>
> print((os.linesep).join([unicodedata.name(c) for c in u]))
>> ETHIOPIC SYLLABLE SEE
>> LATIN SMALL LETTER E WITH ACUTE
>> EURO SIGN
>> CJK UNIFIED IDEOGRAPH-3456
>> CYRILLIC CAPITAL LETTER GJE
>> COUNTERBORE
>> ASTERISK
>>
>> -
>>
>> cp65001, font: Consolas
>>
>> D:\jm\jmgo>echo "ሴé€㑖Ѓ⌴*"
>> "ሴé€㑖Ѓ⌴*"
>>
>> As I explained some chars are rendered with the .notdef glyph: the
>> chars 1, 4 and 7.
>>
>> I build an exe with the golang. Same result.
>>
>> Just for curiosity:
>> XeTeX -> pdf: same result.
>> LucidaConsole CID TrueType,
>> Consolas CID TrueType
>> understand: "OpenType"
>>
>> jmf
>>
>>
> Where is the Python related issue here?

Read the whole thread before charging in like a bull at a gate accusing 
people of being off-topic. This is on-topic, and if you don't see the 
connection, you need to read the whole thread.


> Why do you keep posting double spaced crap, despite repeated requests
> not to do so?  Or do you blame this on the allegedly failed PEP 393 
> FSR implementation?

I see no double-spacing in the text you quoted.

Do you have nothing better to do than continually hassle people over 
minor formatting issues?

Formatting issues are harmful to the degree they get in the way of 
efficient communication. Since by your own admission you have never 
treated JMF as being credible, there's nothing he can write or say that 
you will believe, so why do you care what he writes? You are not the 
target of his communication unless you choose to be.

Apart from annoying the bystanders, your repeated angry and abusive 
screeds aimed at JMF in particular but others as well over minor 
formatting issues is more disruptive than the issues you are complaining 
about. I am grateful to you for taking the time and effort to write up a 
wiki page on fixing this issues, but gratitude for that will only go so 
far in forgiving disruptive behaviour.


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


Re: CP65001 fails (was re: ...)

2013-12-14 Thread Mark Lawrence

On 14/12/2013 20:48, wxjmfa...@gmail.com wrote:



print((os.linesep).join([unicodedata.name(c) for c in u]))

ETHIOPIC SYLLABLE SEE
LATIN SMALL LETTER E WITH ACUTE
EURO SIGN
CJK UNIFIED IDEOGRAPH-3456
CYRILLIC CAPITAL LETTER GJE
COUNTERBORE
ASTERISK

-

cp65001, font: Consolas

D:\jm\jmgo>echo "ሴé€㑖Ѓ⌴*"
"ሴé€㑖Ѓ⌴*"

As I explained some chars are rendered with the .notdef glyph:
the chars 1, 4 and 7.

I build an exe with the golang. Same result.

Just for curiosity:
XeTeX -> pdf: same result.
LucidaConsole CID TrueType,
Consolas CID TrueType
understand: "OpenType"

jmf



Where is the Python related issue here?  Why do you keep posting double 
spaced crap, despite repeated requests not to do so?  Or do you blame 
this on the allegedly failed PEP 393 FSR implementation?


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


Mark Lawrence

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


Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-14 Thread Terry Reedy

On 12/14/2013 3:01 PM, Michael Torrie wrote:

On 12/14/2013 10:05 AM, Wolfgang Keller wrote:

Tkinter is a bit "special" to use since it's not just a library, but
uses some kind of RPC. It seems that "look and feel" have been greatly
improved lately.


I know Tkinter originated with the Tcl/Tk language.


Tcl is the language. Its standard interpreter is written in C, as with 
Python. (I do not know if there are other Tcl implementations.) Tk is 
the gui framework written, I believe, in a mixture of Tcl and C.


Tkinter (Tk interface) is entirely a Python to Tcl/Tk and back interface.


With Tkinter in Python is it still using Tcl/Tk under the hood?


Yes.  _tkinter.c defines Python-callable functions that call Tcl/Tk C 
api functions. tkinter.py defines Python classes and methods. The 
methods call _tkinter functions. Most of the classes correspond to Tk 
widgets such as Button and Text.



IE embeds the Tcl language interpreter into Python's interpreter?


Both interpreters run in one process.

> If so I've always found

it a bit strange that the de facto GUI library that's shipped with
Python ships an entirely different language with it under the hood.


Tcl/Tk is only shipped with the Windows Python installer. On other 
systems, it is a separate install if not already present.


There once (over 10 years ago) was a project to re-write Tk entirely in 
C. What I read it that people decided that Tk made too much use of Tcl 
functions to make that worthwhile.


There have been starts on projects to write a gui framework based on 
Python and wrapped C libraries. PyGui is one, last updated July 2011.

http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/

--
Terry Jan Reedy

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


Re: CP65001 fails (was re: ...)

2013-12-14 Thread wxjmfauth
Le samedi 14 décembre 2013 19:43:41 UTC+1, Terry Reedy a écrit :
> On 12/14/2013 9:03 AM, wxjmfa...@gmail.com wrote:
> 
> 
> 
> > D:\>chcp 65001
> 
> > Page de codes active : 65001
> 
> > D:\>echo "*"
> 
> > "*"
> 
> 
> 
> Try pasting *your* original echo command: echo "ሴé€㑖Ѓ⌴*"
> 
> 
> 
> To repeat, here is what I see:
> 
> '''
> 
> C:\Users\Terry>echo "?‚*"
> 
> "?‚*"
> 
> 
> 
> C:\Users\Terry>chcp 65001
> 
> Active code page: 65001
> 
> 
> 
> C:\Users\Terry>echo "*"
> 
> The system cannot write to the specified device.
> 
> '''
> 
> To repeat, the second time I paste: echo "ሴé€㑖Ѓ⌴*"
> 
> but Command Prompt only displays: echo "*". Typing in the latter, 
> 
> ascii-only, command is meaningless.
> 
> 
> 
> A similar test:
> 
> '''
> 
> C:\Users\Terry>more
> 
> ^Z
> 
> 
> 
> C:\Users\Terry>chcp 65001
> 
> Active code page: 65001
> 
> 
> 
> C:\Users\Terry>more
> 
> Not enough memory.
> 
> '''
> 
> This was reported by Victor Stinner as part of
> 
> http://bugs.python.org/issue19914
> 
> to explain how cp65001 causes behavior like this with Python's 
> 
> interactive help() function (which more for paging on Windows).
> 
> 
> 
>  >>> help(str)
> 
> Not enough memory.
> 
> 
> 
> See
> 
> http://stackoverflow.com/questions/3401802/codepage-850-works-65001-fails-there-is-no-response-to-call-foo-cmd-interna
> 
> for other reports that cp65001 fails. It is not just me.
> 
> 
> 



>>> print((os.linesep).join([unicodedata.name(c) for c in u]))
ETHIOPIC SYLLABLE SEE
LATIN SMALL LETTER E WITH ACUTE
EURO SIGN
CJK UNIFIED IDEOGRAPH-3456
CYRILLIC CAPITAL LETTER GJE
COUNTERBORE
ASTERISK

-

cp65001, font: Consolas

D:\jm\jmgo>echo "ሴé€㑖Ѓ⌴*"
"ሴé€㑖Ѓ⌴*"

As I explained some chars are rendered with the .notdef glyph:
the chars 1, 4 and 7.

I build an exe with the golang. Same result.

Just for curiosity:
XeTeX -> pdf: same result.
LucidaConsole CID TrueType, 
Consolas CID TrueType
understand: "OpenType"

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


Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-14 Thread Ned Deily
In article <52acb936.3020...@gmail.com>, Michael Torrie  
wrote:
> On 12/14/2013 10:05 AM, Wolfgang Keller wrote:
> > Tkinter is a bit "special" to use since it's not just a library, but
> > uses some kind of RPC. It seems that "look and feel" have been greatly
> > improved lately.
> I know Tkinter originated with the Tcl/Tk language.  With Tkinter in
> Python is it still using Tcl/Tk under the hood?  IE embeds the Tcl
> language interpreter into Python's interpreter?

Yes, it does.

> If so I've always found
> it a bit strange that the de facto GUI library that's shipped with
> Python ships an entirely different language with it under the hood.

It is a bit strange but, back in the day, there wasn't a better multi-platform 
GUI option and, even today, Tk (and Tcl) remain attractive because it is 
supported on the many important platforms and does not have the license issues 
that some other GUI toolkits have had.  And because of inertia.  Also, Python 
is not alone in this: Perl and Ruby also have Tk bindings that work the same 
way, AFAIK.

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

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


Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-14 Thread Michael Torrie
On 12/14/2013 10:42 AM, ru...@yahoo.com wrote:
> The other big, widely-used GUI toolkit is PyQt.  It runs on 
> both Python2 and Python3.  There is another version of it
> called PySide which is API compatible with PyQt but has 
> different licensing terms.  PyQt comes with a very good 
> drag-and-drop form designer.

Just to be clear, PyQt does not provide the drag and drop form designer.
That comes from QtDesigner or QtCreator, which is part of Qt itself and
you can use it to design GUIs for use in any language that Qt has
bindings for, not just Python.  PyQt probably does come with a code
generator to convert the xml GUI definitions into Python, but these days
such use is discouraged in favor of using Qt itself to load the XML file
at runtime and build the objects on the fly for you.  It's way more
flexible and there's no code generation needed.  (Apple has done this
for years with Cocoa with their nib files in the bundle.)

> I have played a little with both wxPython an PyQt and found 
> learning to use them from the web difficult because of their 
> size and complexity.  But both of them have pretty good books 
> about them available:

Yes there are concepts you'll have to wrap your brain around such as how
to do proper widget layout.  Things aren't placed in a fixed way
usually.  They are allowed to grow and shrink with the window size.  And
you will have to grasp how events work.

Of all the APIs I've used, I think GTK in Python is the cleanest (PyGTK
or PyObject).  But if I was targeting Windows or Mac I'd stick with
PySides/PyQt.

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


Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-14 Thread Michael Torrie
On 12/14/2013 10:05 AM, Wolfgang Keller wrote:
> PyQt looks native everywhere, but it might be a bit overweight,
> depending on what you want to do and where your applications need to
> run.
> 
> And then there's the licensing issue, since PyQt, unlike Qt itself, is
> not available under LGPL afaik. For closed-source commercial
> applications, there seems to be a way to use a commercially licensed
> PyQt (much less expensive than Qt itself) together with LGPL-Qt
> however. Pyside would be a LGPL alternative to PyQt, but it doesn't
> seem to be as up-to-date as PyQt.

I think PyQt is slowly being pushed aside in favor of PySide, which is
more license-friendly for use in closed or open projects.  I would
recommend using PySide unless PyQt is a requirement for your project.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-14 Thread Michael Torrie
On 12/14/2013 10:05 AM, Wolfgang Keller wrote:
> Tkinter is a bit "special" to use since it's not just a library, but
> uses some kind of RPC. It seems that "look and feel" have been greatly
> improved lately.

I know Tkinter originated with the Tcl/Tk language.  With Tkinter in
Python is it still using Tcl/Tk under the hood?  IE embeds the Tcl
language interpreter into Python's interpreter?  If so I've always found
it a bit strange that the de facto GUI library that's shipped with
Python ships an entirely different language with it under the hood.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: collections Counter most_common method

2013-12-14 Thread Peter Otten
Mark Lawrence wrote:

> This method returns a list, the example from The Fine Docs being:-
> 
>  >>> Counter('abracadabra').most_common(3)
> [('a', 5), ('r', 2), ('b', 2)]
> 
> With the trend in Python being more and more towards methods returning
> iterators, is there ever likely to be an imost_common method, or has
> this been suggested and rejected, or what?  I'm really just curious, but
> if enough people were to express an interest and it hasn't already been
> done, I'd happily raise an enhancement request on the bug tracker.

As Counter is currently a dict you have to look at all items to find the 
most common. With that underlying data structure I don't see how it could 
make sense to yield the most common items incrementally. So

(1) When would you prefer it over the the eager variant?
(2) How would you implement it?

By the way, if you can come up with a plausible answer for the second 
question you should aim higher, for lazy heapq.nlargest() and sorted() 
functions...

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


Re: collections Counter most_common method

2013-12-14 Thread Roy Smith
In article ,
 Mark Lawrence  wrote:

> This method returns a list, the example from The Fine Docs being:-
> 
>  >>> Counter('abracadabra').most_common(3)
> [('a', 5), ('r', 2), ('b', 2)]
> 
> With the trend in Python being more and more towards methods returning 
> iterators, is there ever likely to be an imost_common method, or has 
> this been suggested and rejected, or what?  I'm really just curious, but 
> if enough people were to express an interest and it hasn't already been 
> done, I'd happily raise an enhancement request on the bug tracker.

The reason to return iterators instead of lists is that it's more 
efficient if the list is very long.  I would imagine the most common use 
cases for most_common() are to pass it a number like 3.  You typically 
want to find the most common, or the three most common, or maybe the 10 
most common.  It's rare that people want the 5000 most common.

So, while I suppose returning an iterator might be more efficient in 
some cases, those cases seem pretty rare.
-- 
https://mail.python.org/mailman/listinfo/python-list


collections Counter most_common method

2013-12-14 Thread Mark Lawrence

This method returns a list, the example from The Fine Docs being:-

>>> Counter('abracadabra').most_common(3)
[('a', 5), ('r', 2), ('b', 2)]

With the trend in Python being more and more towards methods returning 
iterators, is there ever likely to be an imost_common method, or has 
this been suggested and rejected, or what?  I'm really just curious, but 
if enough people were to express an interest and it hasn't already been 
done, I'd happily raise an enhancement request on the bug tracker.


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


CP65001 fails (was re: ...)

2013-12-14 Thread Terry Reedy

On 12/14/2013 9:03 AM, wxjmfa...@gmail.com wrote:


D:\>chcp 65001
Page de codes active : 65001
D:\>echo "*"
"*"


Try pasting *your* original echo command: echo "ሴé€㑖Ѓ⌴*"

To repeat, here is what I see:
'''
C:\Users\Terry>echo "?‚*"
"?‚*"

C:\Users\Terry>chcp 65001
Active code page: 65001

C:\Users\Terry>echo "*"
The system cannot write to the specified device.
'''
To repeat, the second time I paste: echo "ሴé€㑖Ѓ⌴*"
but Command Prompt only displays: echo "*". Typing in the latter, 
ascii-only, command is meaningless.


A similar test:
'''
C:\Users\Terry>more
^Z

C:\Users\Terry>chcp 65001
Active code page: 65001

C:\Users\Terry>more
Not enough memory.
'''
This was reported by Victor Stinner as part of
http://bugs.python.org/issue19914
to explain how cp65001 causes behavior like this with Python's 
interactive help() function (which more for paging on Windows).


>>> help(str)
Not enough memory.

See
http://stackoverflow.com/questions/3401802/codepage-850-works-65001-fails-there-is-no-response-to-call-foo-cmd-interna
for other reports that cp65001 fails. It is not just me.

--
Terry Jan Reedy


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


Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-14 Thread Mark Lawrence

On 14/12/2013 17:42, ru...@yahoo.com wrote:

On 12/14/2013 05:25 AM, Chris Angelico wrote:

wxPython currently runs only with Python2, not Python3.  There
is a drag-and-drop form designer available for it but it is a
commercial product that costs money.  It also comes with a
useable (once you get used to it) form builder tool that works
by graphically manipulating a text tree of widgets.


Development versions which support Python 3 are available here 
http://wxpython.org/Phoenix/snapshot-builds/  Unfortunately they've not 
been updated since 3rd December.  I've asked why and been told that 
Robin Dunn is simply too busy.  There's Open Source for you :)





As a side point, though: You're using Google Groups to post, which
means your posts look messy, because GG doesn't follow internet
standards. Short of getting into Google and fixing Groups, the best
solution is to avoid using it; you can either use some other
newsreader (several here swear by Mozilla Thunderbird), or subscribe
to the email list, which carries all the same content:

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

Either way will spare you and us the hassles of malformed posts.


Chris and some other people here dislike Google Groups and
try to imply that everyone here feels the same way.  Not true.

I and many other people here use Google Groups and have been
doing so for years so if Google Groups works for you, please
feel free to continue using it.

If you want to reduce the noise level from people like Chris
you might want to take a look at:

   https://wiki.python.org/moin/GoogleGroupsPython



Of course I dislike Google Groups, users keep sending double spaced crap 
which I don't want to see.  There is no "noise level" from people like 
Chris, which obviously includes me.  There is a constant stream of 
polite requests not to send double spaced crap which we do not wish to 
see.  There are at least two solutions to this, follow the instructions 
in the link repeated above for the umpteenth time or use a different tool.


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


Mark Lawrence

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


Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-14 Thread Mark Lawrence

On 14/12/2013 17:05, Wolfgang Keller wrote:


wxWidgets (wxPython) recently (since 2.9/3.0) got support for Cocoa,
it's native on the Mac. It's quite slim, but seems to be a "moving
target" API-wise, since the developers are not shy from breaking
compatibility. Is it compatible with Python 3 yet?



This is one of the goals of the so called Phoenix project 
http://wiki.wxpython.org/ProjectPhoenix


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


Mark Lawrence

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


Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-14 Thread rurpy
On 12/14/2013 05:25 AM, Chris Angelico wrote:
> On Sat, Dec 14, 2013 at 11:12 PM, Jai  wrote:
>> GUI:-want to learn GUI programming in python  , how should i proceed.
>>
>> There are lots of book here so I am  confuse which book  i should refer so 
>> that i don't waste time . please answer
> 
> There are many ways to build a GUI with Python. Some of the more
> popular toolkits are Tk (tkinter), wxWidgets (wxpython), and GTK.
> Explore those and see which one you like; I personally quite like GTK,
> and the others have their fans too. There are GUI builders for each of
> the above (I think; definitely wx and GTK do), or you can build
> everything directly in code (my preferred style). Play around with it
> and see what you like!

For learning, tkinter is probably the easiest because it comes 
with Python and you don't need to install anything else.  The
best way to get started with it is to search for tutorials and
examples on web.  Searching for "python tkinter" on Amazon shows
a few books but I don't know anything about them.

wxPython currently runs only with Python2, not Python3.  There
is a drag-and-drop form designer available for it but it is a 
commercial product that costs money.  It also comes with a 
useable (once you get used to it) form builder tool that works
by graphically manipulating a text tree of widgets.

The other big, widely-used GUI toolkit is PyQt.  It runs on 
both Python2 and Python3.  There is another version of it
called PySide which is API compatible with PyQt but has 
different licensing terms.  PyQt comes with a very good 
drag-and-drop form designer.

I have played a little with both wxPython an PyQt and found 
learning to use them from the web difficult because of their 
size and complexity.  But both of them have pretty good books 
about them available:

  Rapid GUI Programming with Python and Qt (Summerfield)

http://www.amazon.com/Programming-Python-Prentice-Software-Development/dp/0132354187

  WxPython in Action (Dunn and Rapin)
http://www.amazon.com/Wxpython-Action-Noel-Rappin/dp/1932394621/

> As a side point, though: You're using Google Groups to post, which
> means your posts look messy, because GG doesn't follow internet
> standards. Short of getting into Google and fixing Groups, the best
> solution is to avoid using it; you can either use some other
> newsreader (several here swear by Mozilla Thunderbird), or subscribe
> to the email list, which carries all the same content:
> 
> https://mail.python.org/mailman/listinfo/python-list
> 
> Either way will spare you and us the hassles of malformed posts.

Chris and some other people here dislike Google Groups and 
try to imply that everyone here feels the same way.  Not true.

I and many other people here use Google Groups and have been 
doing so for years so if Google Groups works for you, please
feel free to continue using it.  

If you want to reduce the noise level from people like Chris
you might want to take a look at:

  https://wiki.python.org/moin/GoogleGroupsPython


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


Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-14 Thread Wolfgang Keller
> GUI:-want to learn GUI programming in python  , how should i proceed.
> 
> There are lots of book here so I am  confuse which book  i should
> refer so that i don't waste time .

It depends on what you want to do with the GUI, since there are many
different GUI frameworks for Python.

E.g. If you absolutely need to run your applications on MacOS X, then
PyGTK is probably not the best choice. WingIDE, a popular IDE, has been
recently ported to PyQt, apparently for this reason. Besides, PyGTK
itself seems to be "shelved", PyGObject now (since GTK 3) seems to be
the "canonical" way to implement GTK GUIs in Python.

Tkinter is a bit "special" to use since it's not just a library, but
uses some kind of RPC. It seems that "look and feel" have been greatly
improved lately.

wxWidgets (wxPython) recently (since 2.9/3.0) got support for Cocoa,
it's native on the Mac. It's quite slim, but seems to be a "moving
target" API-wise, since the developers are not shy from breaking
compatibility. Is it compatible with Python 3 yet?

PyQt looks native everywhere, but it might be a bit overweight,
depending on what you want to do and where your applications need to
run.

And then there's the licensing issue, since PyQt, unlike Qt itself, is
not available under LGPL afaik. For closed-source commercial
applications, there seems to be a way to use a commercially licensed
PyQt (much less expensive than Qt itself) together with LGPL-Qt
however. Pyside would be a LGPL alternative to PyQt, but it doesn't
seem to be as up-to-date as PyQt.

And then, there are even more frameworks, such as Pygame, PyGUI, etc

And each of these frameworks has dedicated mailinglists.

Personally I found it difficult to use any of the "wrapped" C++
frameworks without being able to understand the documentation made
for C++. :-(

Sincerely,

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


Re: Is it more CPU-efficient to read/write config file or read/write sqlite database?

2013-12-14 Thread Tim Chase
On 2013-12-14 07:29, JL wrote:
> I have a number of python processes which communicate with each
> other through writing/reading config text files. The python
> ConfigParser is used. I am wondering if it is more CPU-efficient to
> switch to using sqlite database instead of using configuration
> files. If the software does plenty of reading/writing, is it more
> efficient to use config text files or sqlite database?

I'm pretty sure that the CPU aspect doesn't really play into things.
A few thoughts:

+ You'll be I/O bound most of the time.  Even if you used a ramdisk
  to reduce disk access delays, accessing multiple .txt files requires
  the OS to do permission-checking each time, while a single sqlite
  file gets checked once upon opening the DB initially.
+ text-files are fragile unless you take extra pains to keep things
  atomic
+ sqlite guarantee* atomicity, so you either see all-or-nothing
+ sqlite is also very efficient for querying
+ sticking with plain-text config files is just asking for some sort
  of race-condition or partial-file issue to come up
+ sqlite may give you less CPU load is just an added benefit


-tkc


* well, except on NFS shares and other places where file-locking is
  unreliable
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using pythons smtp server

2013-12-14 Thread Irmen de Jong
On 14-12-2013 1:46, Dennis Lee Bieber wrote:

>   About then, I discovered the first two significant books on Python at
> Computer Literacy, and that an Amiga binary was available (Python 1.4, I
> think -- thanks, Irmin).

You're welcome, but my name is spelled Irmen, with an 'e' ;-)

Cheers
Irmen


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


Re: Is it more CPU-efficient to read/write config file or read/write sqlite database?

2013-12-14 Thread Irmen de Jong
On 14-12-2013 16:29, JL wrote:
> I have a number of python processes which communicate with each other through
> writing/reading config text files. The python ConfigParser is used. I am 
> wondering if
> it is more CPU-efficient to switch to using sqlite database instead of using
> configuration files. If the software does plenty of reading/writing, is it 
> more
> efficient to use config text files or sqlite database?
> 
> Thank you.
> 

I think you're asking the wrong question...
Both options will very likely be constrained by I/O instead of CPU (in other 
words: do
you know for certain that you have a CPU-bottleneck right now?)
But both of them aren't well suited for inter process communication. Especially 
the
"reading/writing config files" sounds particularly sketchy.

Take a look at the myriad of options for *proper* inter-process communication 
(if that
is what you're after). It also helps to describe your situation in more detail 
so we can
give better answers.

Cheers,
Irmen


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


Is it more CPU-efficient to read/write config file or read/write sqlite database?

2013-12-14 Thread JL
I have a number of python processes which communicate with each other through 
writing/reading config text files. The python ConfigParser is used. I am 
wondering if it is more CPU-efficient to switch to using sqlite database 
instead of using configuration files. If the software does plenty of 
reading/writing, is it more efficient to use config text files or sqlite 
database?

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-14 Thread Mark Lawrence

On 14/12/2013 14:15, Chris Angelico wrote:

On Sun, Dec 15, 2013 at 1:03 AM,   wrote:

D:\>chcp 65001
Page de codes active : 65001
D:\>echo "*"
"*"
D:\>



locale.getdefaultlocale()

('fr_CH', 'cp1252')

--

In my understanding and experience, in the MS world
(desktop, intel), today:
Unicode == utf-16-le


You still haven't explained how Win7 is different from every other
Windows going back as far as NT. Back in the NT days, Windows had
"Unicode" (really UCS-2 - it predated Unicode 2.0, so that was correct
for a few years) while OS/2 had DBCS. Hindsight shows that OS/2 did
kinda get left behind there :) Though maybe it would be easier to
force migration from DBCS to true Unicode than from UTF-16 or UCS-2
where it looks fine till you hit an astral character. Now how is Win7
different from NT? And where does the current "oldstable" Windows (if
I may borrow a term from Debian), XP, fit into that?


If you think, utf-16, because of surrogate pairs, is
not a proper solution, the single choice is utf-32.

You may not be aware, you are already using utf-32
probably much more than you think, (in a correct way).


Yeah. I use UTF-32 a lot, often stored in ways that elide unnecessary
00 bytes. It's a pretty good system, actually, giving high
performance, compact memory usage, and correct behaviour. Still don't
know what this has to do with Win7.

ChrisA



Reread "The Emperor's New Clothes" and you'll get it :)

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


Mark Lawrence

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-14 Thread Chris Angelico
On Sun, Dec 15, 2013 at 1:03 AM,   wrote:
> D:\>chcp 65001
> Page de codes active : 65001
> D:\>echo "*"
> "*"
> D:\>
>
>
 locale.getdefaultlocale()
> ('fr_CH', 'cp1252')
>
> --
>
> In my understanding and experience, in the MS world
> (desktop, intel), today:
> Unicode == utf-16-le

You still haven't explained how Win7 is different from every other
Windows going back as far as NT. Back in the NT days, Windows had
"Unicode" (really UCS-2 - it predated Unicode 2.0, so that was correct
for a few years) while OS/2 had DBCS. Hindsight shows that OS/2 did
kinda get left behind there :) Though maybe it would be easier to
force migration from DBCS to true Unicode than from UTF-16 or UCS-2
where it looks fine till you hit an astral character. Now how is Win7
different from NT? And where does the current "oldstable" Windows (if
I may borrow a term from Debian), XP, fit into that?

> If you think, utf-16, because of surrogate pairs, is
> not a proper solution, the single choice is utf-32.
>
> You may not be aware, you are already using utf-32
> probably much more than you think, (in a correct way).

Yeah. I use UTF-32 a lot, often stored in ways that elide unnecessary
00 bytes. It's a pretty good system, actually, giving high
performance, compact memory usage, and correct behaviour. Still don't
know what this has to do with Win7.

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-14 Thread wxjmfauth
Le samedi 14 décembre 2013 00:30:38 UTC+1, Terry Reedy a écrit :
> 
> 
> 
> 
> 
> What is not clear to me is whether Windows internally uses UCS-2, which 
> 
> only codes BMP chars, and which would *not* be excellent, or UTF-16, 
> 
> which covers all chars by using surrogates. I will guess the latter. 
> 
> More to the point, even if MS uses a complete coding scheme internally 
> 
> (UFT-16), it does not, as far as I know, make it fully available and 
> 
> usable to *me*, as I showed in my response about code page 65001.
> 
> 


-

D:\>chcp 65001
Page de codes active : 65001
D:\>echo "*"
"*"
D:\>


>>> locale.getdefaultlocale()
('fr_CH', 'cp1252')

--

In my understanding and experience, in the MS world
(desktop, intel), today:
Unicode == utf-16-le

--

If you think, utf-16, because of surrogate pairs, is
not a proper solution, the single choice is utf-32.

You may not be aware, you are already using utf-32
probably much more than you think, (in a correct way).


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


Re: [newbie] trying socket as a replacement for nc

2013-12-14 Thread Jean Dubois
Op vrijdag 13 december 2013 16:35:31 UTC+1 schreef Jean-Michel Pichavant:
> - Original Message -
> > I have an ethernet-rs232 adapter which allows me to connect to a
> > measurement instrument by means of netcat on a linux system.
> > e.g. entering nc 10.128.59.63 7000
> > allows me to enter e.g.
> > *IDN?
> > after which I get an identification string of the measurement
> > instrument back.
> > I thought I could accomplish the same using the python module
> > "socket"
> > and tried out the sample program below which doesn't work however:
> > #!/usr/bin/env python
> > 
> > """
> > A simple echo client
> > """
> > import socket
> > host = '10.128.59.63'
> > port = 7000
> > size = 10
> > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> > s.connect((host,port))
> > s.send('*IDN?')
> > data = s.recv(size)
> > s.close()
> > print 'Received:', data
> > 
> > Can anyone here tell me how to do it properly?
> > thanks in advance
> > jean
> Such equipment often implements a telnet protocol. Have use try using the 
> telnetlib module ?
> http://docs.python.org/2/library/telnetlib.html
> t = Telnet(host, port)
> t.write('*IDN?')
> print t.read_until('Whateverprompt')
> # you can use read_very_eager also
> JM
Thanks for the suggestion, I'll first wait for a response from Dan Stromberg 
concerning how to install his module, if he doesn't answer or if I'm still 
unsuccessfull then I'll try out your suggestion

kind regards,
jean
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] trying socket as a replacement for nc

2013-12-14 Thread Mark Lawrence

On 14/12/2013 13:14, Jean Dubois wrote:

Op vrijdag 13 december 2013 09:35:18 UTC+1 schreef Mark Lawrence:

On 13/12/2013 03:23, Jean Dubois wrote:


kind regards,
jean
p.s. I'm using Linux/Kubuntu 11.04


Would you please read and action this
https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the
double line spacing that accompanied the above, thanks.

I think I got it right this time. Thanks for helping me through it.

kind regards,
jean



Yep, I've seen a couple of your posts that are just fine.  Thanks for 
taking these steps, I greatly appreciate your efforts.


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


Mark Lawrence

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-14 Thread Mark Lawrence

On 14/12/2013 10:00, Steven D'Aprano wrote:

On Fri, 13 Dec 2013 23:58:14 +, Mark Lawrence wrote:


On 13/12/2013 23:17, Ethan Furman wrote:

On 12/13/2013 03:10 PM, Mark Lawrence wrote:


Seems like we're now in the later stages of the 15, three minute
rounds.  The trainer won't throw in the towel, the referee won't stop
the fight and the boxer himself won't quit.  Is jmf actually trying to
get himself killed?


His credibility with me has been long dead.  :(

--
~Ethan~


With me it never lived, we've simply had to put up with his FUD for 16
months.


Mark, do you really mean to say that you were prejudiced against JMF
before he even write a word here?

Strange thing to say, since he did actually identify a real performance
regression, even if he has since become obsessed with demonstrating that
a micro-performance slowdown means that Python is mathematically and
logically broken.



IIRC he first started spreading his rubbish sometime in August 2012, I 
make that around 16 months, what does your maths skills make it?  He 
also identified a problem in an edge case that stood out like a sore 
thumb when compared to real world cases.  Big deal.


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


Mark Lawrence

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


Re: [newbie] trying socket as a replacement for nc

2013-12-14 Thread Jean Dubois
Op vrijdag 13 december 2013 09:35:18 UTC+1 schreef Mark Lawrence:
> On 13/12/2013 03:23, Jean Dubois wrote:
> >
> > kind regards,
> > jean
> > p.s. I'm using Linux/Kubuntu 11.04
> >
> Would you please read and action this 
> https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the 
> double line spacing that accompanied the above, thanks.
I think I got it right this time. Thanks for helping me through it.

kind regards,
jean
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] trying socket as a replacement for nc

2013-12-14 Thread Jean Dubois
Op vrijdag 13 december 2013 18:09:50 UTC+1 schreef rusi:
> On Friday, December 13, 2013 5:50:03 PM UTC+5:30, Jean Dubois wrote:
> > to make the script check itself whether pyhon2 or python3 should be used?
> As far as I know both (2 and 3) worked
> Do you have some reason to suspect one works and other not?

The reason I suggested this is that the script has #!/usr/bin/env python3
as the first line. When you have python2 installed and not python3 a
newbie will
probably not understand why it doesn't work.

kind regards,
jean

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


Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-14 Thread Jai

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


Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-14 Thread Chris Angelico
On Sat, Dec 14, 2013 at 11:12 PM, Jai  wrote:
> GUI:-want to learn GUI programming in python  , how should i proceed.
>
> There are lots of book here so I am  confuse which book  i should refer so 
> that i don't waste time . please answer

There are many ways to build a GUI with Python. Some of the more
popular toolkits are Tk (tkinter), wxWidgets (wxpython), and GTK.
Explore those and see which one you like; I personally quite like GTK,
and the others have their fans too. There are GUI builders for each of
the above (I think; definitely wx and GTK do), or you can build
everything directly in code (my preferred style). Play around with it
and see what you like!

As a side point, though: You're using Google Groups to post, which
means your posts look messy, because GG doesn't follow internet
standards. Short of getting into Google and fixing Groups, the best
solution is to avoid using it; you can either use some other
newsreader (several here swear by Mozilla Thunderbird), or subscribe
to the email list, which carries all the same content:

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

Either way will spare you and us the hassles of malformed posts.

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


GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-14 Thread Jai
GUI:-want to learn GUI programming in python  , how should i proceed.

There are lots of book here so I am  confuse which book  i should refer so that 
i don't waste time . please answer 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: accessing a page which request an openID authentication

2013-12-14 Thread Steven D'Aprano
On Fri, 13 Dec 2013 16:42:37 +, Denis McMahon wrote:

> On Fri, 13 Dec 2013 02:32:49 -0800, uni.mail.2014 wrote:
> 
>> I have a page that request an openID authentication 
> 
> And your Python question is?

I thought the question was fairly obvious. How would you access a page 
using OpenID in Python?

The "in Python" should be implied by the fact that it was posted to a 
Python forum rather than a Ruby/Forth/C/Go/Scheme/whatever forum. 
Presumably the poster is an expert Python coder who just needs a pointer 
to some library that handles OpenID, probably because Google is blocked 
in whatever part of the world he is posting from. As are Bing, 
DuckDuckGo, and Yahoo. (It must suck to be a programmer in North Korea.)

To uni.mail.2014, if that is your real name, you'll improve the quality 
of the answers to your questions if you improve the quality of your 
questions. What gave you tried? What result did you get? What result did 
you expect? What version of Python are you using? What level of hand-
holding do you require, e.g. are you a Python expert or beginner?


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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-14 Thread Steven D'Aprano
On Fri, 13 Dec 2013 23:58:14 +, Mark Lawrence wrote:

> On 13/12/2013 23:17, Ethan Furman wrote:
>> On 12/13/2013 03:10 PM, Mark Lawrence wrote:
>>>
>>> Seems like we're now in the later stages of the 15, three minute
>>> rounds.  The trainer won't throw in the towel, the referee won't stop
>>> the fight and the boxer himself won't quit.  Is jmf actually trying to
>>> get himself killed?
>>
>> His credibility with me has been long dead.  :(
>>
>> --
>> ~Ethan~
> 
> With me it never lived, we've simply had to put up with his FUD for 16
> months.

Mark, do you really mean to say that you were prejudiced against JMF 
before he even write a word here?

Strange thing to say, since he did actually identify a real performance 
regression, even if he has since become obsessed with demonstrating that 
a micro-performance slowdown means that Python is mathematically and 
logically broken.



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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-14 Thread Steven D'Aprano
On Fri, 13 Dec 2013 17:49:32 -0500, Terry Reedy wrote:

> On 12/13/2013 11:15 AM, wxjmfa...@gmail.com wrote:
>> Le jeudi 12 décembre 2013 18:55:15 UTC+1, Terry Reedy a écrit :
> 
>>> If you mean cp65xxx (I forget exact numbers), MS Command Prompt fails,
>>> not Python. One should not use any other code page, but only other
>>> code pages work.
> 
>> Please, do not exaggerate too much.
> 
> I try not to, so in case I mis-remembered, I tried your experiment.

Terry, thanks for actually doing some useful Unicode experiments instead 
of just jumping on the "Let's all make fun of JMF bandwagon."


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


Re: Knapsack Problem Without Value

2013-12-14 Thread Steven D'Aprano
On Fri, 13 Dec 2013 01:38:47 -0800, geezle86 wrote:

> On Friday, December 13, 2013 9:08:56 AM UTC+7, geez...@gmail.com wrote:
>> Hi,
>>
>> I wanna ask about Knapsack. I do understand what Knapsack is about. But
>> this one i faced is a different problem. There is no value. I mean,
>> it's like this, for example.
>> 
>> I have 4 beams [X0, X1, X2, X3]. Each 1, 2, 2, 3 cm long. I want to
>> make a new 6 cm long connected-beam from these 4 beams. I can make it
>> from some of these. The output will print:
>> 
>> 1, 2, 3 #(X0, X1, X3)
>> 
>> You understand what my problem is? Can you help me?
>
> No, this isnt homework. There is a website called Jollybee (Its
> available only in Bahasa) Here is the link if you dont believe me
> http://jollybee.binus.ac.id/oj/site/problemset/problem/code/HS10F/
> 
> Im just got bored and trying to have fun.
> 
> Not values like that, i mean, everywhere, I found the pseudocode only
> teach me with 2 variable. Mostly weight and its values ($). For short,
> this problem I faced is only the weight, no values($).

With only one value, I think it counts as a variation of the Change-
Making Problem:

http://en.wikipedia.org/wiki/Change-making_problem


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