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  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
 wrote:
> For example, take intersection of two sets s and t. It is a basic
> principle of set intersection that s&t == t&s.

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

>>> set1 = {0,1,2}
>>> set2 = {0.0,1.0,3.0}
>>> set1&set2
{0.0, 1.0}
>>> set2&set1
{0, 1}
>>> (set1&set2) == (set2&set1)
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 
>> 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  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  . Qarte 
 . 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
 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 
>>> 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 
>>> 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
 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 
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 
> 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  Anthony Papillion 
 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  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 
>> 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 D&D 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  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
 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  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 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  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 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  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 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,   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  wrote:
> On 13 September 2013 15:39, John Gordon  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  wrote:
> 
> > On 13 September 2013 15:39, John Gordon  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,   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  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 
 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  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()



--
https://mail.python.org/mailman/li

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


Need help to sort out the below code...

2013-09-13 Thread mnishpsyched
Hello guys,
i am new to programming and trying to solve this small coding: my purpose is to 
take in values from the user based on a menu provided for selection

the output looks like this...

please select from the following menu:
1. pizza
2. steak
3. pasta
4. burger
type in any number from above for selection..

you have selected: 1. Pizza
The bill amounted for Pizza is $20 along with tax of $0.15 will make upto 
$20.15 

the code i have written for this is as follows:

print """
Please select from the following menu:
1. pizza
2. steak
3. pasta
4. burger
type in any number from above for selection..
"""

pz = raw_input()
pz = int(pz)

st = raw_input()
st = int(st)

ps = raw_input()
ps = int(ps)

bg = raw_input()
bg = int(bg)

if pz == 1 :
print "You have selected", pz, ".pizza"
pr_pz = 20
tx_pz = 0.15
tot = pr_pz + tx_pz
print "The bill amounted for Pizza is $", pr_pz, "along with tax of $", 
tx_pz, "will make upto $", tot
elif st == 2 :
print "You have selected", st, ".Steak"
pr_st = 40
tx_st = 0.20
print "The bill amounted for Steak is $", pr_st, "along with tax of $", 
tx_st, "will make upto $", tot.
...
but my program doesn't output the selection once i type in any number from the 
list..Please help me to sort it out...
-- 
https://mail.python.org/mailman/listinfo/python-list