On Fri, Apr 29, 2016 at 4:12 PM, Gregory Ewing
wrote:
> Chris Angelico wrote:
>>
>> I thought the twentieth zen would never be found?
>
>
> Yes. This will have to be numbered the 21st zen
> to maintain that invariant.
>
Python for the 21st Century.
In a hundred years, another zen!
ChrisA
--
ht
Chris Angelico wrote:
I thought the twentieth zen would never be found?
Yes. This will have to be numbered the 21st zen
to maintain that invariant.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
Irmen de Jong :
if sys.stdout.isatty():
#use a pager to display help text
else:
#print all help text normally
I think nowadays it's an anti-pattern for programs to
do their own pagination. Very often the "terminal" is
a GUI application with its own facilities for scrolling
and se
Rustom Mody writes:
> On Friday, April 29, 2016 at 7:45:35 AM UTC+5:30, Paul Rubin wrote:
>> Steven D'Aprano writes:
>> > (1) print the help text to stdout;
>> > (2) run the help text through a pager;
>>
>> Stdout unless the PAGER env var is set. Otherwise, I'd say still stdout
>> since the per
On Friday, April 29, 2016 at 7:45:35 AM UTC+5:30, Paul Rubin wrote:
> Steven D'Aprano writes:
> > (1) print the help text to stdout;
> > (2) run the help text through a pager;
>
> Stdout unless the PAGER env var is set. Otherwise, I'd say still stdout
> since the person can pipe it through a pag
Steven D'Aprano writes:
> (1) print the help text to stdout;
> (2) run the help text through a pager;
Stdout unless the PAGER env var is set. Otherwise, I'd say still stdout
since the person can pipe it through a pager if they want, but you could
use the pager or be fancy and try to detect if st
On Friday, 29 April 2016 09:56:13 UTC+10, David Shi wrote:
> Hello, Matt,
> Please see the web link.Pandas Pivot Table Explained
>
> | |
> | | | | | |
> | Pandas Pivot Table ExplainedExplanation of pandas pivot_table function. |
> | |
> | View on pbpython.com | Preview by Yahoo |
> |
On Friday, 29 April 2016 01:19:28 UTC+10, Dan Strohl wrote:
> If I am reading this correctly... you have something like (you will have to
> excuse my lack of knowledge about what kinds of information these actually
> are):
>
>
> 1234
> first
>
>
> 5678
> second
>
>
>
> And
On Fri, 29 Apr 2016 07:08 am, Grant Edwards wrote:
> On 2016-04-28, Random832 wrote:
>> On Thu, Apr 28, 2016, at 15:39, Grant Edwards wrote:
>>> That's fine. If you want two or three forms of documentation then you
>>> prepare two or three forms of documentation.
>>>
>>> Adding an option to run
On Fri, Apr 29, 2016 at 10:48 AM, Gregory Ewing
wrote:
> MRAB wrote:
>
>> Is it worthy of being in the Zen of Python?
>
>
> +1. Maybe something along the lines of:
>
>Dunder methods are for defining, not calling.
>Unless you're a dunderhead[1].
>
> [1] Meant in the sense of an enthusiast,
MRAB wrote:
Is it worthy of being in the Zen of Python?
+1. Maybe something along the lines of:
Dunder methods are for defining, not calling.
Unless you're a dunderhead[1].
[1] Meant in the sense of an enthusiast, cf. gearhead.
--
Greg
--
https://mail.python.org/mailman/listinfo/pytho
Hello, Matt,
Please see the web link.Pandas Pivot Table Explained
| |
| | | | | |
| Pandas Pivot Table ExplainedExplanation of pandas pivot_table function. |
| |
| View on pbpython.com | Preview by Yahoo |
| |
| |
Debra and Fred have their own groups.
How to split the pivot
On 2016-04-28, Random832 wrote:
> On Thu, Apr 28, 2016, at 15:39, Grant Edwards wrote:
>> That's fine. If you want two or three forms of documentation then you
>> prepare two or three forms of documentation.
>>
>> Adding an option to run the default 'help' output through a pager or
>> display it
On 29Apr2016 03:06, Chris Angelico wrote:
On Fri, Apr 29, 2016 at 2:33 AM, Steven D'Aprano wrote:
I have an application written in Python which accepts -h or --help to show
help. I can:
(1) print the help text to stdout;
(2) run the help text through a pager;
(3) do something else?
Many c
On Thu, 28 Apr 2016 20:11:27 +, alister wrote:
> I don't see my posts appearing, posting to news group using Pan on
> Linux.
> posts to other news groups are fine
No just going blind
Someone top-posted to my last reply & then everything got snipped to
restore readability.
--
Be careful
I don't see my posts appearing, posting to news group using Pan on Linux.
posts to other news groups are fine
--
Just about every computer on the market today runs Unix, except the Mac
(and nobody cares about it).
-- Bill Joy 6/21/85
--
https://mail.python.org/mailman/listinfo/
alister :
> I don't see my posts appearing, posting to news group using Pan on
> Linux. posts to other news groups are fine
Take yourself out of your killfile.
Marko
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Apr 28, 2016, at 15:39, Grant Edwards wrote:
> That's fine. If you want two or three forms of documentation then you
> prepare two or three forms of documentation.
>
> Adding an option to run the default 'help' output through a pager or
> display it in a web browser doesn't somehow force
On 2016-04-28, Marko Rauhamaa wrote:
> Grant Edwards :
>
>> On 2016-04-28, Random832 wrote:
>>> One disadvantage is that you have to compose two forms of
>>> documentation.
>>
>> Only if you want two forms of documentation.
>>
>> If you add an option to run the help info through a pager, I don't
On 2016-04-28 18:37, David Shi via Python-list wrote:
> What is the simplest way to locate a string in a column and get
> the value on the same row in another column ? 1 a2 b3 c
> Locate b and obtain 2 in a table.
> Looking forward to hearing from you.
I've had success with using regexp matche
In David Shi
writes:
> What is the simplest way to locate a string in a column and get the value
> on the same row in another column ?
You haven't given enough context for us to be able to answer.
Are you talking about a spreadsheet, a database table, an HTML table,
or something else?
--
Jo
What is the simplest way to locate a string in a column and get the value on
the same row in another column ?
1 a2 b3 c
Locate b and obtain 2 in a table.
Looking forward to hearing from you.
Regards.
David
--
https://mail.python.org/mailman/listinfo/python-list
I'd like to write some small command-line utilities to do some tasks
in subversion:
* Do a commit that includes all modified externals.
* Do a status that includes status of all externals.
* Do a log that combines logs of . and all externals.
There appear to be three options:
1) pysvn
Grant Edwards :
> On 2016-04-28, Random832 wrote:
>> One disadvantage is that you have to compose two forms of
>> documentation.
>
> Only if you want two forms of documentation.
>
> If you add an option to run the help info through a pager, I don't see
> how that requires you to compose two forms
On 2016-04-28, Random832 wrote:
>
>
> On Thu, Apr 28, 2016, at 13:33, Grant Edwards wrote:
>> As long as -? -h --help just write stuff to stdout you can add
>> whatever other options you like that run pagers, start up web
>> browsers, or show mp4 movies on the wall without annoying grouchy old
>>
Yup.. another reason to use something like argparse... you define the argument
descriptions, help, and when you raise an error, it automatically handles the
output, sending it to the right place (stderr/stdout)... as well as allowing
you to define different levels of verbosity easily... (or not
Irmen de Jong :
> An idea: Use just one help option, then
>
> if sys.stdout.isatty():
> #use a pager to display help text
> else:
> #print all help text normally
I've seen that used, but I find it annoying:
On Thu, Apr 28, 2016, at 13:33, Grant Edwards wrote:
> As long as -? -h --help just write stuff to stdout you can add
> whatever other options you like that run pagers, start up web
> browsers, or show mp4 movies on the wall without annoying grouchy old
> Unix users like me. ;)
One disadvantage
Steven D'Aprano writes:
> I have an application written in Python which accepts -h or --help to
> show help. I can:
>
> (1) print the help text to stdout;
>
> (2) run the help text through a pager;
>
> (3) do something else?
>
>
> Many command line tools simply output help to stdout (or stderr, if
I would hesitate to take this approach unless the tool was one that only I was
going to be using, and I knew exactly what environments it was going to be in.
I know that many of the system items in python work differently in different
operating systems, and different os's report things different
On 2016-04-28, Steven D'Aprano wrote:
> I have an application written in Python which accepts -h or --help to show
> help. I can:
>
> (1) print the help text to stdout;
Yep: just write it to stdout.
> (2) run the help text through a pager;
If you do (1), and I can do that myself if that's what
On Thu, Apr 28, 2016, at 13:06, Chris Angelico wrote:
> On Fri, Apr 29, 2016 at 2:33 AM, Steven D'Aprano
> wrote:
> > Many command line tools simply output help to stdout (or stderr, if they're
> > evil),
>
> I'm not sure stderr is particularly more evil than stdout, but whatever
> :)
When a too
On 04/28/2016 10:02 AM, Dan Strohl via Python-list wrote:
I would suggest using argparse https://docs.python.org/3/library/argparse.html
as it handles all of that natively...
On the other hand, if you feel that argparse is akin to using a canon to
kill a mosquito, you can try scription*:
-
Yeah, if I am handling arguments from the command line, I use argparse, if I am
doing a cli based app (so, going back and forth in interacting with the command
line), I would look at clint (https://github.com/kennethreitz/clint)
As many people have said here, don’t reinvent the wheel.
Dan
Fro
On Thu, Apr 28, 2016 at 1:02 PM, Dan Strohl via Python-list <
python-list@python.org> wrote:
> I would suggest using argparse
> https://docs.python.org/3/library/argparse.html as it handles all of that
> natively... including validating arguments, showing errors, help, etc...
> however, assuming y
On Fri, Apr 29, 2016 at 2:33 AM, Steven D'Aprano wrote:
> I have an application written in Python which accepts -h or --help to show
> help. I can:
>
> (1) print the help text to stdout;
>
> (2) run the help text through a pager;
>
> (3) do something else?
>
>
> Many command line tools simply outp
On 28-4-2016 18:33, Steven D'Aprano wrote:
> but I was thinking of doing both: give my application a subcommand or an
> option to display help directly in a pager, while -h and --help print to
> stdout as normal.
>
> What do you think? Too clever?
An idea: Use just one help option, then
if sys
I would suggest using argparse https://docs.python.org/3/library/argparse.html
as it handles all of that natively... including validating arguments, showing
errors, help, etc... however, assuming you don't want to;
Send it to stdout, that allows the user to redirect it if they want to (and
play
Jin Li wrote:
> Hi all,
>
> I want to get the closure environment in Python. As in the following example:
>
> def func1():
> x = 10
> def func2():
> return 0
>
> return func2
>
> f=func1()
> print f()
>
>
> How could I get the variable `x` in the environment
On Fri, 29 Apr 2016 02:23 am, Jin Li wrote:
> I want to get the closure environment in Python. As in the following
> example:
>
> def func1():
> x = 10
> def func2():
> return 0
> return func2
>
> f=func1()
> print f()
>
>
> How could I get the variable
On 04/28/2016 09:33 AM, Steven D'Aprano wrote:
I have an application written in Python which accepts -h or --help to show
help. I can:
(1) print the help text to stdout;
(2) run the help text through a pager;
(3) do something else?
I think if the user is proficient enough to:
a) run the pr
On Fri, 29 Apr 2016 02:33:56 +1000, Steven D'Aprano wrote:
> I have an application written in Python which accepts -h or --help to
> show help. I can:
>
> (1) print the help text to stdout;
>
> (2) run the help text through a pager;
>
> (3) do something else?
>
>
> Many command line tools sim
On Thu, Apr 28, 2016 at 12:23 PM, Jin Li wrote:
> Hi all,
>
> I want to get the closure environment in Python. As in the following
> example:
>
> def func1():
> x = 10
> def func2():
> return 0
>
> return func2
>
> f=func1()
> print f()
>
>
> How could I ge
I have an application written in Python which accepts -h or --help to show
help. I can:
(1) print the help text to stdout;
(2) run the help text through a pager;
(3) do something else?
Many command line tools simply output help to stdout (or stderr, if they're
evil), which makes it easy to red
Hi all,
I want to get the closure environment in Python. As in the following example:
def func1():
x = 10
def func2():
return 0
return func2
f=func1()
print f()
How could I get the variable `x` in the environment of `func2()`? i.e. `f()`.
Best regards,
If I am reading this correctly... you have something like (you will have to
excuse my lack of knowledge about what kinds of information these actually are):
1234
first
5678
second
And you want something like:
nominations = [(1,1234), (2,5678)]
meetings = [(1,'first')
On Thursday, April 28, 2016 at 7:45:22 PM UTC+5:30, ldomp...@casema.nl wrote:
> I am follows on this moment two online pythoncourses from code.tutsplus.com
> But I am interested in following more online pythoncourses.
> Maby someone have some links to websites for me what handles python online
> c
On Thu, Apr 28, 2016 at 7:57 AM, Joel Goldstick
wrote:
> On Thu, Apr 28, 2016 at 10:15 AM, wrote:
> > I am follows on this moment two online pythoncourses from
> code.tutsplus.com
> > But I am interested in following more online pythoncourses.
> > Maby someone have some links to websites for me
I've heard good things about codeacademy.com and learnpython.org. Also, I've
heard that pycharm educational edition is helpful.
(https://www.jetbrains.com/pycharm-edu/ )
I haven't personally tried any of these though, so your mileage may vary.
Good Luck!
Dan Strohl
> -Original Message
On Thu, Apr 28, 2016 at 10:15 AM, wrote:
> I am follows on this moment two online pythoncourses from code.tutsplus.com
> But I am interested in following more online pythoncourses.
> Maby someone have some links to websites for me what handles python online
> courses.
>
> thanks
> --
> https://m
On Thursday, April 28, 2016 at 8:11:26 PM UTC+5:30, Dan Strohl wrote:
> In addition to Peter's points,
> - I would suggest breaking out the list comprehensions into standard for
> loops and/or functions. That makes it easier to read and troubleshoot. (you
> can always re-optimize It if needed.
In addition to Peter's points,
- I would suggest breaking out the list comprehensions into standard for loops
and/or functions. That makes it easier to read and troubleshoot. (you can
always re-optimize It if needed.)
- Peter's point about making things into functions will also help
troublesh
I am follows on this moment two online pythoncourses from code.tutsplus.com
But I am interested in following more online pythoncourses.
Maby someone have some links to websites for me what handles python online
courses.
thanks
--
https://mail.python.org/mailman/listinfo/python-list
>
> Your actual problem is drowned in too much source code. Can you restate it
> in English, optionally with a few small snippets of Python?
>
> It is not even clear what the code you provide should accomplish once it's
> running as desired.
>
> To give at least one code-related advice: You
Sayth Renshaw wrote:
> In my file here I needed to traverse and modify the XML file I don't want
> to restore it or put it in a new variable or other format I just want to
> alter it and let it flow onto the list comprehensions as they were.
That looks like an arbitrary limitation to me. It's a b
On 2016-04-28, Adam Funk wrote:
> On 2016-04-26, Random832 wrote:
>
>> On Tue, Apr 26, 2016, at 09:30, Adam Funk wrote:
>>> I recently discovered pathlib in the Python 3 standard library, & find
>>> it very useful, but I'm a bit surprised that it doesn't offer things
>>> like is_readable() and is_
On Thu, Apr 28, 2016, at 01:16, Rustom Mody wrote:
> On Thursday, April 28, 2016 at 9:26:21 AM UTC+5:30, Chris Angelico wrote:
> > My rule of thumb is: Dunders are for defining, not for calling. It's
> > not a hard-and-fast rule, but it'll get you through 99%+ of
> > situations.
>
> Neat and cleve
Adam Funk writes:
> On 2016-04-26, Random832 wrote:
>
>> On Tue, Apr 26, 2016, at 09:30, Adam Funk wrote:
>>> I recently discovered pathlib in the Python 3 standard library, & find
>>> it very useful, but I'm a bit surprised that it doesn't offer things
>>> like is_readable() and is_writable. Is
On 2016-04-28 13:25, Marko Rauhamaa wrote:
MRAB :
'pythonic-ness'? Surely it's 'pythonicity'! :-)
Doubt it:
Full Definition of generic
[...]
—generically \-i-k(ə-)lē\ adverb
—genericness noun
http://www.merriam-webster.com/dictionary/generic>
I can point you to 3 alternatives,
On 2016-04-26, Random832 wrote:
> On Tue, Apr 26, 2016, at 09:30, Adam Funk wrote:
>> I recently discovered pathlib in the Python 3 standard library, & find
>> it very useful, but I'm a bit surprised that it doesn't offer things
>> like is_readable() and is_writable. Is there a good reason for th
On 2016-04-26, Steven D'Aprano wrote:
> On Tue, 26 Apr 2016 11:30 pm, Adam Funk wrote:
>> I've been improvising with things like this:
>>
>> import pathlib, os
>>
>> path = pathlib.Path('some/directory')
>> writable = os.access(str(path), os.W_OK | os.X_OK)
>>
>> Is that the best way to do it?
MRAB :
> 'pythonic-ness'? Surely it's 'pythonicity'! :-)
Doubt it:
Full Definition of generic
[...]
—generically \-i-k(ə-)lē\ adverb
—genericness noun
http://www.merriam-webster.com/dictionary/generic>
Marko
--
https://mail.python.org/mailman/listinfo/python-list
Hi
This file contains my biggest roadblock with programming and that's the
abstract nature of needing to pass data from one thing to the next.
In my file here I needed to traverse and modify the XML file I don't want to
restore it or put it in a new variable or other format I just want to alter
On 2016-04-28 12:45, Rustom Mody wrote:
On Thursday, April 28, 2016 at 4:46:43 PM UTC+5:30, MRAB wrote:
On 2016-04-28 06:16, Rustom Mody wrote:
> On Thursday, April 28, 2016 at 9:26:21 AM UTC+5:30, Chris Angelico wrote:
>> My rule of thumb is: Dunders are for defining, not for calling. It's
>> n
On Thursday, April 28, 2016 at 4:46:43 PM UTC+5:30, MRAB wrote:
> On 2016-04-28 06:16, Rustom Mody wrote:
> > On Thursday, April 28, 2016 at 9:26:21 AM UTC+5:30, Chris Angelico wrote:
> >> My rule of thumb is: Dunders are for defining, not for calling. It's
> >> not a hard-and-fast rule, but it'll
On 2016-04-28 06:16, Rustom Mody wrote:
On Thursday, April 28, 2016 at 9:26:21 AM UTC+5:30, Chris Angelico wrote:
My rule of thumb is: Dunders are for defining, not for calling. It's
not a hard-and-fast rule, but it'll get you through 99%+ of
situations.
Neat and clever.
Should get in the docs
I was overwhelmed that three gurus inspire me in three different ways in their
own flavour:-) That's really appreciated! Now I understand why it's so, thanks
to all of you.
To Peter:
> With that information, can you predict what
> for k, v in {(1, 2): "three"}: print(k, v)
> will print?
It's
On 28/04/2016 10:34, g.v.aar...@skct.edu.in wrote:
start_list = [5, 3, 1, 2, 4]
square_list = []
# Your code here!
for square_list in start_list:
x = pow(start_list, 2)
square_list.append(x)
square_list.sort()
print square_list
TypeError: unsupported operand type(s) for ** or pow(): 'l
On Thu, 28 Apr 2016 06:27 pm, jf...@ms4.hinet.net wrote:
> I have a dictionary like this:
>
dct ={1: 'D', 5: 'A', 2: 'B', 3: 'B', 4: 'E'}
>
> The following code works:
>
for k in dct: print(k, dct[k])
> ...
> 1 D
> 2 B
> 3 B
> 4 E
> 5 A
When you iterate over the dictionary, you get a
g.v.aar...@skct.edu.in wrote:
> start_list = [5, 3, 1, 2, 4]
> square_list = []
>
> # Your code here!
> for square_list in start_list:
You are iterating over start_list, that's OK. But you are assigning the
current value to square_list, a variable name that you already use for the
list where y
On Thu, 28 Apr 2016 07:34 pm, g.v.aar...@skct.edu.in wrote:
> start_list = [5, 3, 1, 2, 4]
> square_list = []
Here you set square_list to a list.
> # Your code here!
> for square_list in start_list:
.^
Here you set square_list to each item of the start_list. So the first time
ar
start_list = [5, 3, 1, 2, 4]
square_list = []
# Your code here!
for square_list in start_list:
x = pow(start_list, 2)
square_list.append(x)
square_list.sort()
print square_list
TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int'
Please provide me the solution for the
jf...@ms4.hinet.net wrote:
> I have a dictionary like this:
>
dct ={1: 'D', 5: 'A', 2: 'B', 3: 'B', 4: 'E'}
>
> The following code works:
> But...this one?
>
for k,v in dct: print(k,v)
> ...
> Traceback (most recent call last):
> File "", line 1, in
> TypeError: 'int' object is no
On Thursday, April 28, 2016 at 1:57:40 PM UTC+5:30, jf...@ms4.hinet.net wrote:
> I have a dictionary like this:
>
> >>> dct ={1: 'D', 5: 'A', 2: 'B', 3: 'B', 4: 'E'}
>
> The following code works:
>
> >>> for k in dct: print(k, dct[k])
> ...
> 1 D
> 2 B
> 3 B
> 4 E
> 5 A
>
> and this one too:
>
0
down vote
favorite
I'm trying to create a simple http server with basic GET and POST
functionality. The program is supposed to GET requests by printing out a simple
webpage that greets a user and askes how he would rather be greeted. When the
user enters a greeting of his choice, th
I have a dictionary like this:
>>> dct ={1: 'D', 5: 'A', 2: 'B', 3: 'B', 4: 'E'}
The following code works:
>>> for k in dct: print(k, dct[k])
...
1 D
2 B
3 B
4 E
5 A
and this one too:
>>> for k,v in dct.items(): print(k,v)
...
1 D
2 B
3 B
4 E
5 A
But...this one?
>>> for k,v in dct: print(k,v
On Thursday 28 April 2016 17:08, Stephen Hansen wrote:
> On Wed, Apr 27, 2016, at 11:55 PM, Ben Finney wrote:
>> Stephen Hansen writes:
>>
>> > On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote:
>> > > Better: when you have many semantically-different values, use named
>> > > (not positional)
Stephen Hansen writes:
> On Wed, Apr 27, 2016, at 11:55 PM, Ben Finney wrote:
> > Everything I described above works fine in Python 2.
>
> This response is completely unhelpful.
I'll let the OP be the judge of that.
> The OP is using Python 2, and using %-formatting, and so you give a
> series
On Wed, Apr 27, 2016, at 11:55 PM, Ben Finney wrote:
> Stephen Hansen writes:
>
> > On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote:
> > > Better: when you have many semantically-different values, use named
> > > (not positional) parameters in the format string. […]
> > >
> > > https://d
79 matches
Mail list logo