Re: The "loop and a half"

2017-10-08 Thread Steve D'Aprano
On Sun, 8 Oct 2017 02:06 am, bartc wrote:

>> On 2017-10-07, bartc  wrote:
>> 
>>> Interactive Python requires quit() or exit(), complete with parentheses.
...^


>> Nonsense.  On Unix you can just press ctrl-D (or whatever you have
>> configured as eof) at the command prompt. On windows, it's Ctrl-Z
>> .
> 
> Steve spoke about the 'usual quit/exit/bye' commands.

As well as Ctrl-D, EOF, which is a standard way to exit most Unix programs.

(Or as close as anything in Unix comes to a standard UI.)


> If you type 'quit' in interactive Python, then it says:
> 
>Use quit() or Ctrl-Z plus Return to exit
> 
> Same for exit. So in Python, IF you want to use quit or exit to
> terminate, you have to use quit() or exit() instead.
> 
> So please explain how what I wrote was nonsense.

Do you still believe that quit/exit is REQUIRED?

To be pedantic, we have at least seven ways:

- EOF (Ctrl-D on Unix, Ctrl-Z ENTER on Windows);

- calling quit() or exit();

- raise SystemExit;

- call sys.exit()

- call os._exit();

- call os.abort();

- write your own custom quitter object that exits on simply being 
  printed, e.g.:

class Bye:
def __repr__(self):
sys.exit(0)

bye = Bye()

Four of these are intended for programmatic use, but they work interactively
as well. At least two of them shouldn't be used unless you know what you are
doing (os._exit and os.abort).


>>> Unless you've redefined quit and exit as something else, then you have
>>> to crash out by other means.)
>> 
>> Admit it, you're just trolling.
> 
> FFS, NOW what's wrong?

"Crash out".


> IF you DO redefine those names, then you DO have to use other means to
> terminate. I happen to call those means 'crashing out', because it's
> like yanking the plug rather than using the on/off switch.

os._exit and os.abort (especially the second) could legitimately be described
as "crashing out". The others, not within a million miles of it.


> Especially on 
> Windows where the usual Ctrl C doesn't work, so you resort to Ctrl-Break
> will which actually abort it. Ctrl Z is uncommon.

Thousands of Python programmers on Windows successfully learned to use Ctrl-Z
ENTER back in the days of Python 1.5, before quit/exit were added as a
convenience for beginners, and many of them probably still use it.

Yet again you assume that because YOU don't do something, nobody else in the
world could possibly do it.


> I'm getting fed up with this thread now.

This thread would be a lot less frustrating if you would enter into it with a
spirit of open-minded enquiry rather than an overbearing sense of superiority
that anything others do that you don't must be worthless.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


Re: django project avoid reload page where work algorithm

2017-10-08 Thread Xristos Xristoou

> You mentioned email, so why not just ask for an email address to which 
> you will send the result?

i have user email from register i need to do all automate,how to use celery for 
this ?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The "loop and a half"

2017-10-08 Thread bartc

On 08/10/2017 10:12, Steve D'Aprano wrote:

On Sun, 8 Oct 2017 02:06 am, bartc wrote:



Thousands of Python programmers on Windows successfully learned to use Ctrl-Z
ENTER back in the days of Python 1.5, before quit/exit were added as a
convenience for beginners, and many of them probably still use it.


Actually I NEVER normally use Python in interactive mode. Only to test 
how it works interactively. When I use Python, it's from my IDE.



I'm getting fed up with this thread now.


This thread would be a lot less frustrating if you would enter into it with a
spirit of open-minded enquiry rather than an overbearing sense of superiority
that anything others do that you don't must be worthless.


Frustrating for whom?

It seems to me that it's pretty much everyone here who has an 
overbearing sense of superiority in that everything that Unix or Linux 
does is a million times better than anything else.


Even with things like building applications (eg. trying to build CPython 
from sources), they are designed from the ground up to be inextricably 
linked to Linux scripts, utilities, makefiles, installation schemes, or 
designed to work with the Linux-centric gcc C compiler. Then when they 
don't work as well anywhere else, it's because Linux is so much better! 
No, it's because they were non-portably designed around Linux and 
therefore designed NOT to work well anywhere else.


It is also slightly frustrating for me when I see how Python is 
developing, with layer after layer and library after library piled on to 
achieve some fantastically complicated solution (one of 48 different 
ones to choose from) to replicate some basic functionality that could 
have been done in 5 minutes if GvR had decided to add it right at the start.


But this is a Python group and I have to restrain myself from such 
comments to avoid getting lynched. There is nothing wrong with Python!


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


Re: The "loop and a half"

2017-10-08 Thread Marko Rauhamaa
bartc :

> It seems to me that it's pretty much everyone here who has an
> overbearing sense of superiority in that everything that Unix or Linux
> does is a million times better than anything else.

People's opinions don't matter here. Point is, if you are writing
software for Linux, you need to do it according to (or at least
understanding) the general Linux system requirements.

I don't do Windows programming, but if I did, I'd try to write the
programs in the way Windows programs are intended to be written.

Similarly with other operating systems. If you wrote your own OS, you'd
get to dictate the proper philosophy for application programming.

> Even with things like building applications (eg. trying to build
> CPython from sources), they are designed from the ground up to be
> inextricably linked to Linux scripts, utilities, makefiles,
> installation schemes, or designed to work with the Linux-centric gcc C
> compiler. Then when they don't work as well anywhere else, it's
> because Linux is so much better! No, it's because they were
> non-portably designed around Linux and therefore designed NOT to work
> well anywhere else.

Ok. Clearly Python has its roots in Linux.

> It is also slightly frustrating for me when I see how Python is
> developing, with layer after layer and library after library piled on
> to achieve some fantastically complicated solution (one of 48
> different ones to choose from) to replicate some basic functionality
> that could have been done in 5 minutes if GvR had decided to add it
> right at the start.

Maybe. I don't know if that would count as constructive criticism,
though, because you can't change your past.

> But this is a Python group and I have to restrain myself from such
> comments to avoid getting lynched. There is nothing wrong with Python!

Once you have expressed your opinion and frustration, you don't have to
repeat it at every turn.

Do you have a concrete enhancement proposal? Or is Python a lost cause
for you?


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


Re: The "loop and a half"

2017-10-08 Thread Paul Moore
On 8 October 2017 at 11:36, bartc  wrote:
> Frustrating for whom?

Well, me as well as Steve, if we're counting votes for who finds your
attitude frustrating...

> It seems to me that it's pretty much everyone here who has an overbearing
> sense of superiority in that everything that Unix or Linux does is a million
> times better than anything else.

As a Windows user, I would like to make it clear that your views don't
in any way represent me.

> Even with things like building applications (eg. trying to build CPython
> from sources), they are designed from the ground up to be inextricably
> linked to Linux scripts, utilities, makefiles, installation schemes, or
> designed to work with the Linux-centric gcc C compiler. Then when they don't
> work as well anywhere else, it's because Linux is so much better! No, it's
> because they were non-portably designed around Linux and therefore designed
> NOT to work well anywhere else.

When developing scripts, applications, or any form of code, I use good
ideas from anywhere, as I doubt that I have the monopoly on knowing
the perfect way to write code. Some of those good ideas come from
Unix-based systems. That's not "because Linux is so much better", it's
because someone other than me had a good idea, and I acknowledge the
fact.

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


Re: "comprehend" into a single value

2017-10-08 Thread Ned Batchelder

On 10/8/17 1:00 AM, Andrew Z wrote:

and how about adding "IF" into the mix ?

as in :

a=0

dict= {10: ['a',1,'c'], 20: ['d',2,'f']}

for i in dict:

  p+= 10 if dict[i][1] in [1,2,3,4,5] else 0


can i "squish" "for" and "if" together ? or will it be too perl-ish ?


    sum(10 for v in dict.values() if v[1] in [1,2,3,4,5])

or:

    sum((10 if v[1] in [1,2,3,4,5] else 0) for v in dict.values())

(in case you actually need something other than 0.)

Also, note that if your list of five values is actually much longer than 
five, then you want a set:


    sum((10 if v[1] in {1,2,3,4,5} else 0) for v in dict.values())

--Ned.






On Sun, Oct 8, 2017 at 12:37 AM, Andrew Z  wrote:


Nathan, Bob - on the money. Thank you !

On Sat, Oct 7, 2017 at 11:30 PM, bob gailer  wrote:


On 10/7/2017 11:17 PM, Nathan Hilterbrand wrote:


dict= {10: ['a',1,'c'], 20: ['d',2,'f']}
p = sum([dict[i][1] for i in dict])

Something like that?


Ah, but that's 2 lines.

sum(val[1] for val in  {10: ['a',1,'c'], 20: ['d',2,'f']}.values())

On Sat, Oct 7, 2017 at 11:07 PM, Andrew Z  wrote:

Hello,

   i wonder how  can i accomplish the following as a one liner:

dict= {10: ['a',1,'c'], 20: ['d',2,'f']}
p = 0
for i in dict:
  p += dict[i][1]


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



--
Image and video hosting by TinyPic





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


Re: The "loop and a half"

2017-10-08 Thread Chris Angelico
On Sun, Oct 8, 2017 at 10:22 PM, Paul Moore  wrote:
> On 8 October 2017 at 11:36, bartc  wrote:
>> Even with things like building applications (eg. trying to build CPython
>> from sources), they are designed from the ground up to be inextricably
>> linked to Linux scripts, utilities, makefiles, installation schemes, or
>> designed to work with the Linux-centric gcc C compiler. Then when they don't
>> work as well anywhere else, it's because Linux is so much better! No, it's
>> because they were non-portably designed around Linux and therefore designed
>> NOT to work well anywhere else.
>
> When developing scripts, applications, or any form of code, I use good
> ideas from anywhere, as I doubt that I have the monopoly on knowing
> the perfect way to write code. Some of those good ideas come from
> Unix-based systems. That's not "because Linux is so much better", it's
> because someone other than me had a good idea, and I acknowledge the
> fact.

It's also worth noting that "Linux" and "Unix" are not synonymous, and
that a lot of these ideas have come from BSD, or some other OS. In
fact, a good few of the ideas being pooh-poohed in this thread have
been around longer than Linux has. The idea that most tools should
work with stdin and stdout (while sending errors to stderr) dates back
*at least* to the earliest Unix, and quite possibly earlier. So
they're not "because Linux is so much better" - they're "because Unix
has worked this way for longer than Windows or Linux or Mac OS has
been around". And by "worked", I don't just mean that this is how it
is - I also mean that it *works*, it is useful, it is a viable
solution to real-world problems.

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


Re: The "loop and a half"

2017-10-08 Thread bartc

On 07/10/2017 15:40, Steve D'Aprano wrote:

On Sat, 7 Oct 2017 11:54 pm, bartc wrote:


So my programs that use Escape on Windows needed
to use Escape Escape on Linux to get around that.



Or you could just follow the expected Unix interface instead of inventing your
own.


Your job is to port an editor that people have been using for 30 years 
to Linux. The first thing you do is to change all the commands and 
shortcuts to match what is typical on Linux? So that no-one who was 
familiar with it as it was can actually use it?





Back in the days when I used a Mac (long before OS X), I used to hate it when
Windows developers would port their software to Mac. With the exception of a
few big software companies like Microsoft, who had actual Mac teams, they
would do what you do: completely ignore the Apple UI guidelines and port
their unfamiliar and arbitrary user interfaces to the Mac software, making it
essentially unusable.


What is it with those who write OSes in that they have to tell everyone 
how to run the show? An OS's job is to run programs and do whatever the 
program requests.


BTW, how did the Apple UI guidelines come about; where they copying 
existing practice, or did /they/ decide to come up with something new 
and incompatible with anything else? And if the former, then you ask the 
same question of Xerox or whoever.


Just look at any interactive page on the web, they all work differently. 
People are used to it. And it allows innovation.


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


Re: The "loop and a half"

2017-10-08 Thread Chris Angelico
On Sun, Oct 8, 2017 at 10:46 PM, bartc  wrote:
> On 07/10/2017 15:40, Steve D'Aprano wrote:
>>
>> On Sat, 7 Oct 2017 11:54 pm, bartc wrote:
>>
>>> So my programs that use Escape on Windows needed
>>> to use Escape Escape on Linux to get around that.
>>
>>
>>
>> Or you could just follow the expected Unix interface instead of inventing
>> your
>> own.
>
>
> Your job is to port an editor that people have been using for 30 years to
> Linux. The first thing you do is to change all the commands and shortcuts to
> match what is typical on Linux? So that no-one who was familiar with it as
> it was can actually use it?

Is it graphical? Does it use any well-known toolkit? If so, then yeah,
the first thing - and the automatic thing - is that it will respond to
the host platform's keys and so on.

Which is more important: for someone familiar with Program X on
Windows to be able to use Program X on Linux, or for every GUI program
on my computer to respond to Ctrl-Insert by copying something to the
clipboard? Adobe picked the former for earlier versions of Acrobat
Reader, and they suck because of it. (I don't know if they've fixed
that since, as I threw them over years ago.)

>> Back in the days when I used a Mac (long before OS X), I used to hate it
>> when
>> Windows developers would port their software to Mac. With the exception of
>> a
>> few big software companies like Microsoft, who had actual Mac teams, they
>> would do what you do: completely ignore the Apple UI guidelines and port
>> their unfamiliar and arbitrary user interfaces to the Mac software, making
>> it
>> essentially unusable.
>
>
> What is it with those who write OSes in that they have to tell everyone how
> to run the show? An OS's job is to run programs and do whatever the program
> requests.

An OS's job is to let the human interface with the computer. Same
human, same interface.

> BTW, how did the Apple UI guidelines come about; where they copying existing
> practice, or did /they/ decide to come up with something new and
> incompatible with anything else? And if the former, then you ask the same
> question of Xerox or whoever.

I don't know about those specifically, but a lot of what I see today
in Linux is derived from the CUA guidelines [1]. They unified a bunch
of disparate UI controls into what we now expect to see everywhere.
Does Alt-F4 close a program on your system? Does it close pretty much
any program? You can thank CUA for that. Or would you prefer that
every program have its own unique way of being closed?

Oh, and if you say "click on the X in the corner", well, common UI
guidelines is what gave us those, too. Or would you prefer every
program to put a close button in a different place?

> Just look at any interactive page on the web, they all work differently.
> People are used to it. And it allows innovation.

No, they don't all work differently. They actually all work largely
the same way, because their fundamental controls are provided by the
host platform (in this case, the web browser). And where they *don't*
all work the same way (date pickers, ugh ugh ugh), they're a pain in
the behind.

Maybe it's just that you're not old enough to have worked with text
editors that predate CUA? That might explain your confusion about what
should be standardized.

ChrisA
remembers WordStar but none of its bindings, and PC-Type and most of
its command keys

[1] https://en.wikipedia.org/wiki/IBM_Common_User_Access
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The "loop and a half"

2017-10-08 Thread Gregory Ewing

bartc wrote:
Then you might have 'sort' for the non-interactive version, and 'isort' 
or whatever for the interactive.


It's pretty rare that you'd want to use 'sort' interactively,
which is why your hypothetical 'isort' doesn't exist.

However, it *is* common to use it as part of a pipeline, which
is why it defaults to reading from stdin.

A consequence of that is that if you run it on its own,
without any arguments, it stops and waits for input from
the terminal. But it's not specifically designed to be
used that way, so it doesn't bother providing any prompts
in that situation.

Except you simply wouldn't use an interactive version of any program 
that reads an arbitrary long list of uninterrupted data, no matter how 
the ending is indicated. You'd use a text editor, enter the lines at 
your leisure, go back and forth to check and edit as needed, THEN you 
would submit that file to 'sort'. As an actual input file.


In which case it won't 'hang', and you will be happy. :-)

A program like 'python' might fit the bill too. Here, you can give it 
the name of a file, OR say nothing, and it will take input from stdin.


Funnily enough, you now get a message, and a prompt. And when entering 
multiple lines of code, you get a prompt before each line. You can also 
terminate the sequence by entering a blank line.


Python goes to all that trouble because it's designed to be
used interactively, i.e. you can have a true conversation with
it. You can't really have a conversation with 'sort', since
it needs all the input before it can do anything.

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


OT again sorry [Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]]

2017-10-08 Thread Gregory Ewing

Steve D'Aprano wrote:

You don't think multiple columns in interactive mode is useful?


The issue is not whether single vs. multi column mode is better, but
whether it should automatically switch based on what kind of thing
is connected to stdin.

Personally I find that behavour surprising and would be happy for it
to use multi-column always unless explicitly told otherwise, but
it's not a big issue.

The thing that *really* annoys me is Linux insisting on colourising
the output to a tty, since it invariably seems to pick an undreadable
colour scheme. And the case-insensitive sorting... there's a reason
Makefile starts with a capital M, dammit!

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


Re: The "loop and a half"

2017-10-08 Thread Gregory Ewing

bartc wrote:
This preprocesses the code and shows the result. Typical programs will 
have many thousands of lines of output, but it just dumps it to the 
console. You /have/ to use '>' to use it practically (Windows doesn't 
really have a working '|' system.)


This may be why you're having trouble grokking unix. The
primary purpose of the unix convention of reading from stdin
and writing to stdout by default is to make it easy to use
programs in pipelines. If you haven't experienced that way
of working, you may not appreciate how useful it can be.


BTW if I try:

 > gcc 

I agree that the C compiler is unusual in that respect. The
reason may be that it relies on filename suffixes to figure out
what to do with its inputs: if it's .c, compile it; if it's
.s, assemble it; if it's .o, link it; etc. It wouldn't know
what to do with something fed into stdin.

There may be ways to tell it, though. Stack Overflow suggests:

   flex -t lexer.l | gcc -x c -c -o lexer.o -

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


Re: The "loop and a half"

2017-10-08 Thread bartc

On 08/10/2017 12:22, Paul Moore wrote:


When developing scripts, applications, or any form of code, I use good
ideas from anywhere, as I doubt that I have the monopoly on knowing
the perfect way to write code. Some of those good ideas come from
Unix-based systems. That's not "because Linux is so much better", it's
because someone other than me had a good idea, and I acknowledge the
fact.


When developing code I use whatever tools and techniques I like.

But if I want to someone else to build one of my applications, I make it 
as easy as possible for them, even to to the extent of translating it to 
a language that they will be able to build.


Here, for example, is a C compiler (which, actually, is not written in 
C, but is presented as a C program):


   www.bcas.freeuk.com/mcc64.c

One file only. But it is only for 64 bits. Build on Windows or Linux 
(for Linux it is 'gcc -m64 mcc64.c -omcc -lm'). Runs on either (but 
generates code for win64 ABI).


Another: www.bcas.freeuk.com/pcc64.c, a byte-code interpreter, builds 
and runs on either OS, one file. That needs a separate byte-code 
compiler, www.bcas.freeuk.com/qcc64.c. Again, one file. Again, runs on 
either OS. And I believe each file works with any C compiler.


(Actually, I just found it had a dependency on a Windows time function; 
I've removed that temporarily for this upload.)


See the pattern here? Simplicity not complexity. Consideration for 
others by making life easier.)



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


Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]

2017-10-08 Thread Gregory Ewing

Chris Angelico wrote:

Hmm, but usually I would expect them still to HAVE those streams,
they're just connected to /dev/null or something. I don't think they
would actually fail to exist, would they?


On unix there's nothing to stop you launching a process
with fds 0, 1 and 2 all closed. It would be a very
unusual thing to do, but not impossible. I expect it's
possible on Windows as well.

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


Re: The "loop and a half"

2017-10-08 Thread Gregory Ewing

Peter J. Holzer wrote:

In any case, that -E writes to stdout and -S to file is an inconsistency
which looks more like a historical accident than a planned feature to
me.


A possible reason is that with -S there is an obvious choice
for the output file name, i.e. .s, but there is
no conventional way of naming a preprocessed C source file,
so it's best to make the user specify it.

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


Re: The "loop and a half"

2017-10-08 Thread Gregory Ewing

bartc wrote:

Interactive Python requires quit() or exit(), complete with parentheses.


Er, what? Ctrl-D works fine for me to exit Python when not
in the midst of entering a block.

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


Re: The "loop and a half"

2017-10-08 Thread Gregory Ewing

Chris Angelico wrote:

But personally, I'd have looked for a "print to
PS" of some sort, using a gigantic 'page' size, and then convert the
PS to PNG. I don't know for certain that I can do the latter
conversion,


It would be easy on MacOSX. Anything you can print can be sent
to a PDF file, and Preview lets you save any page from a PDF
file as an image in your format of choice.

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


Re: OT again sorry [Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]]

2017-10-08 Thread Lele Gaifax
Gregory Ewing  writes:

> The thing that *really* annoys me is Linux insisting on colourising
> the output to a tty, since it invariably seems to pick an undreadable
> colour scheme. And the case-insensitive sorting... there's a reason
> Makefile starts with a capital M, dammit!

As most things, that's configurable, for example I have the following in one
of my teenager .bashxxx scripts:

  # Old-school ordering, upcase letters before lowercase
  export LC_COLLATE=C

  # Format dates accordingly to the language
  export TIME_STYLE=locale

As others said already, it's difficult-to-impossible to get a
one-size-fits-all configuration that satisfies everybody (where the
cardinality of "everybody" exceeds 1, of course).

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
[email protected]  | -- Fortunato Depero, 1929.

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


Re: django project avoid reload page where work algorithm

2017-10-08 Thread MRAB

On 2017-10-08 11:27, Xristos Xristoou wrote:


You mentioned email, so why not just ask for an email address to which 
you will send the result?


i have user email from register i need to do all automate,how to use celery for 
this ?


You can use the smtplib module to send an email.
--
https://mail.python.org/mailman/listinfo/python-list


Re: The "loop and a half"

2017-10-08 Thread eryk sun
On Sun, Oct 8, 2017 at 10:12 AM, Steve D'Aprano
 wrote:
> On Sun, 8 Oct 2017 02:06 am, bartc wrote:
>
>> Especially on
>> Windows where the usual Ctrl C doesn't work, so you resort to Ctrl-Break
>> will which actually abort it. Ctrl Z is uncommon.
>
> Thousands of Python programmers on Windows successfully learned to use Ctrl-Z
> ENTER back in the days of Python 1.5, before quit/exit were added as a
> convenience for beginners, and many of them probably still use it.

Using Ctrl+Z (0x1A) isn't specific to Python. The Windows CRT's
text-mode I/O inherits this from MS-DOS, which took it from CP/M. It's
obvious in Python 2:

>>> open('test.txt', 'w').write('123\x1a456')
>>> open('test.txt', 'r').read()
'123'
>>> open('test.txt', 'rb').read()
'123\x1a456'

This has been misreported as a bug more than once.

Python 3 opens CRT file descriptors in binary mode. Its text mode
(TextIOWraper) doesn't implement the legacy Ctrl+Z behavior. However,
Ctrl+Z at the start of a line is manually supported in the REPL and
raw _WindowsConsoleIO.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: django project avoid reload page where work algorithm

2017-10-08 Thread Xristos Xristoou

> You can use the smtplib module to send an email.
 

ok but how to avoid pong reload on page ?can you help me ?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The "loop and a half"

2017-10-08 Thread bartc

On 08/10/2017 13:05, Chris Angelico wrote:

On Sun, Oct 8, 2017 at 10:46 PM, bartc  wrote:



Just look at any interactive page on the web, they all work differently.
People are used to it. And it allows innovation.



Maybe it's just that you're not old enough to have worked with text
editors that predate CUA? That might explain your confusion about what
should be standardized.


I first used line editors in the 1970s.

When I started writing graphics apps, graphics was very new, at least in 
the low-end business computer world (the one that was soon dominated by 
the IBM PC).


So there was little existing practice to copy from. (And actually, I had 
my hands full either designing the graphics boards, or writing the 
drivers, graphics libraries, providing the fonts and so on (plus the 
languages), all the underlying stuff needed to make it all work.)


However as graphics became more mainstream then yes I did adopt some 
commonly expected styles (menubars for example). As for Alt-F4, if that 
generates a WM_CLOSE message for example, then I would be obliged to 
deal with it.


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


Re: django project avoid reload page where work algorithm

2017-10-08 Thread MRAB

On 2017-10-08 15:27, Xristos Xristoou wrote:



You can use the smtplib module to send an email.
  


ok but how to avoid pong reload on page ?can you help me ?


Do you mean "long reload"?

If you have the user's email address from when they registered, you 
could have the user log in to get the results. If the user has closed 
the window, or the session has expired, well they'd have to log in 
again.

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


Re: The "loop and a half"

2017-10-08 Thread Peter J. Holzer
On 2017-10-07 13:19, Steve D'Aprano  wrote:
> On Sat, 7 Oct 2017 11:06 pm, bartc wrote:
>> However it does seem to expose a flaw in the ability of command line
>> tools to work with non-command line tools.
>> 
>> So I have to copy 33,000 lines from a document, 
>
> Don't be daft. Nobody says that stdin is a sufficient interface for a
> heavy-weight task like that. With 33000 lines of text, I absolutely would
> save them to a permanent file on disk,

I think you got sucked into bartc's way of thinking here.

Of course stdin is perfectly fine for reading 33000 lines of text. You
probably do that all the time. Think of pipes like "... | grep ... |
sort | uniq | ...": No reason to save the output of one stage to a
temporary file before invoking the next just because it might be large.

It's the terminal which is not a good interface for entering 33000 lines
of text, even though pasting 33000 lines from the clipboard into
xterm works (I vaguely recall that there is or was a size limit, but
33000 shortish lines doesn't seem to be enough to reach it).

hp


-- 
   _  | Peter J. Holzer| Fluch der elektronischen Textverarbeitung:
|_|_) || Man feilt solange an seinen Text um, bis
| |   | [email protected] | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The "loop and a half"

2017-10-08 Thread Peter J. Holzer
On 2017-10-07 08:35, Steve D'Aprano  wrote:
> Unfortunately ESCAPE is already used. VT100 (the terminal emulation which is
> used in just about all terminals) all control sequences begin with ESC. So
> every time you do something like press an arrow key, the terminal sends ESC
> followed by other stuff. It would be painful if every time you hit an arrow
> key, the interpreter took it as "Exit".

The usual solution to this problem is to use a timeout: If ESC is not
followed by another character which could continue the sequence within
e.g. 0.1 seconds it is interpreted as a standalone key press instead of
the start of an escape sequence. This is not 100% reliable: If you are
on a jittery network connection, the O in the cursor-up sequence might
arrive more than 0.1 seconds after the ESC - or the the three distinct
keystrokes ESC O A might be delivered in the same packet.

hp


-- 
   _  | Peter J. Holzer| Fluch der elektronischen Textverarbeitung:
|_|_) || Man feilt solange an seinen Text um, bis
| |   | [email protected] | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
-- 
https://mail.python.org/mailman/listinfo/python-list


Python platforms without long long

2017-10-08 Thread Peter J. Holzer
I just stumbled about this note in
https://docs.python.org/3/library/array.html:

| 2. The 'q' and 'Q' type codes are available only if the platform C
| compiler used to build Python supports C long long, or, on Windows,
| __int64.
|
| New in version 3.3.

The long long type was standardized in C99 (and was a popular extension
before that). Python 3.3 was released in 2012 - 13 years later. Were any
of the supported platforms of Python3 really still missing this type at
that time?

hp

-- 
   _  | Peter J. Holzer| Fluch der elektronischen Textverarbeitung:
|_|_) || Man feilt solange an seinen Text um, bis
| |   | [email protected] | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The "loop and a half"

2017-10-08 Thread Peter J. Holzer
On 2017-10-08 12:53, Gregory Ewing  wrote:
> Peter J. Holzer wrote:
>> In any case, that -E writes to stdout and -S to file is an inconsistency
>> which looks more like a historical accident than a planned feature to
>> me.
>
> A possible reason is that with -S there is an obvious choice
> for the output file name, i.e. .s, but there is
> no conventional way of naming a preprocessed C source file,
> so it's best to make the user specify it.

Actually, .i seems to be pretty common, and at least gcc recognizes .i
files as C source files which should not be preprocessed. Same for DEC's
c89 compiler (ca. 1992). The manual page for the PC/IX cc (ca. 1984)
doesn't mention .i, so I guess it didn't recognize that extension (but
it already had the -E option).

hp


-- 
   _  | Peter J. Holzer| Fluch der elektronischen Textverarbeitung:
|_|_) || Man feilt solange an seinen Text um, bis
| |   | [email protected] | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The "loop and a half"

2017-10-08 Thread Grant Edwards
On 2017-10-08, eryk sun  wrote:
> On Sun, Oct 8, 2017 at 10:12 AM, Steve D'Aprano
> wrote:
>> On Sun, 8 Oct 2017 02:06 am, bartc wrote:
>>
>>> Especially on
>>> Windows where the usual Ctrl C doesn't work, so you resort to Ctrl-Break
>>> will which actually abort it. Ctrl Z is uncommon.
>>
>> Thousands of Python programmers on Windows successfully learned to use Ctrl-Z
>> ENTER back in the days of Python 1.5, before quit/exit were added as a
>> convenience for beginners, and many of them probably still use it.
>
> Using Ctrl+Z (0x1A) isn't specific to Python. The Windows CRT's
> text-mode I/O inherits this from MS-DOS, which took it from CP/M.

Which took it from RSX-11.  Or probably more specifically from
FILES-11.  I woldn't be surprised if the enineers at DEC got it from
somewhere else before that.

-- 
Grant


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


Re: Python platforms without long long

2017-10-08 Thread Chris Angelico
On Mon, Oct 9, 2017 at 1:31 AM, Peter J. Holzer  wrote:
> I just stumbled about this note in
> https://docs.python.org/3/library/array.html:
>
> | 2. The 'q' and 'Q' type codes are available only if the platform C
> | compiler used to build Python supports C long long, or, on Windows,
> | __int64.
> |
> | New in version 3.3.
>
> The long long type was standardized in C99 (and was a popular extension
> before that). Python 3.3 was released in 2012 - 13 years later. Were any
> of the supported platforms of Python3 really still missing this type at
> that time?

At what point did MSVC support long long? That's usually the guiding
factor with C standard usage.

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


Re: django project avoid reload page where work algorithm

2017-10-08 Thread Xristos Xristoou
Τη Κυριακή, 8 Οκτωβρίου 2017 - 6:35:28 μ.μ. UTC+3, ο χρήστης MRAB έγραψε:
> On 2017-10-08 15:27, Xristos Xristoou wrote:

> Do you mean "long reload"?

user can put some numbers in my html template and i take that numbers and i sue 
it in specific mathematical algorithm that algorithm to create result need time 
 between 5-10 minutes in that time browser stay on reload...that i mean
-- 
https://mail.python.org/mailman/listinfo/python-list


Pandas/dataexplore, how do you get data into them?

2017-10-08 Thread Chris Green
I am looking at dataexplore and Pandas, they look as if they may
provide useful tools but at the moment I can't quite understand how
you get data into them.

How do you load a large table into dataexplore?

Ultimetely I want to get data from a database table but any help would
be useful.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The "loop and a half"

2017-10-08 Thread Chris Angelico
On Mon, Oct 9, 2017 at 2:01 AM, bartc  wrote:
> However as graphics became more mainstream then yes I did adopt some
> commonly expected styles (menubars for example). As for Alt-F4, if that
> generates a WM_CLOSE message for example, then I would be obliged to deal
> with it.

Yes, it usually does generate that. Why? Because your desktop manager
translates concrete user actions into abstract events like "close
window" - and does so according to a number of standards. In case you
haven't noticed, those standards are not 100% consistent across
platforms. So that means that...

On Sun, Oct 8, 2017 at 10:46 PM, bartc  wrote:
> On 07/10/2017 15:40, Steve D'Aprano wrote:
>> Or you could just follow the expected Unix interface instead of inventing
>> your own.
>
> Your job is to port an editor that people have been using for 30 years to
> Linux. The first thing you do is to change all the commands and shortcuts to
> match what is typical on Linux? So that no-one who was familiar with it as
> it was can actually use it?

... yeah, you absolutely *should* follow your OS's conventions, and
you automatically *will* if you're using a properly-designed GUI
toolkit. Why should it be different with the console? For instance,
anyone on Linux will understand what this prompt notation means:

Use config file: [~/.flurblerc]

Yep, definitely follow your host platform's conventions.

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


Re: Finding Old Posts on Python

2017-10-08 Thread breamoreboy
On Sunday, October 8, 2017 at 12:42:19 AM UTC+1, Cai Gengyang wrote:
> Hello,
> 
> Does anyone know of a way to find all my old posts about Python ? Thanks a 
> lot!
> 
> GengYang

Make a site specific search for your name here 
https://mail.python.org/pipermail/python-list/

--
Kindest regards.

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


IDLE help.

2017-10-08 Thread Joe Wilde
Hello,


I am having trouble getting IDLE (Python 3.6 - 64-bit) to open for Windows 10. 
When I try and run IDLE, nothing happens. It works fine for Python 2.7, but 
won't open for Python 3.6.

I have tried repairing the install but to no avail.

I'm fairly new at this kind of thing, so I don't have a lot of technical 
knowledge.


Thanks in advance,

Joe.

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


Re: OT again sorry [Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]]

2017-10-08 Thread leam hall
On Sun, Oct 8, 2017 at 8:15 AM, Gregory Ewing 
wrote:

>
> The thing that *really* annoys me is Linux insisting on colourising
> the output to a tty, since it invariably seems to pick an undreadable
> colour scheme. And the case-insensitive sorting... there's a reason
> Makefile starts with a capital M, dammit!
>

Actually, it doesn't. The color output may come from
/etc/profile.d/colorls.sh configs. Either dump that or "unalias ls" in your
~/.bash_profile.

Colorized ls is something the distrobution people like and they put it in.
Others of us don't care for it. But it's not "Linux", is the profile. Easy
to customize.

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


Re: OT again sorry [Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]]

2017-10-08 Thread Marko Rauhamaa
leam hall :

> Colorized ls is something the distrobution people like and they put it
> in. Others of us don't care for it. But it's not "Linux", is the
> profile. Easy to customize.

Easy and easy...

"Linux" means so many things to people. For example, the recent "Linux
Subsystem on Windows 10" is funny in that Linux is the one thing it most
definitely doesn't have.

Closer to home, systemd has taken a central role in the main Linux
distributions. I think it would be more accurate to call them "systemd
distros" than "Linux distros".

It is not at all easy for the Linux user to figure out what
configuration options there are, and which ones are intended for
end-user configuration. More and more, such tuning needs to be
done via systemd unit files (or applicable GUI facilities) and the
classical configuration files are deprecated. For example, how can a
programmer get a core file of a crashing program? Why, you need to use
the systemd-coredump service, of course:

   https://www.freedesktop.org/software/systemd/man/systemd-coredum
   p.html>


BTW, I'm not ranting against systemd here, just stating the tectonic
shift that is undergoing in the Linux world.


As far as "ls" goes, its man page states:

   The LS_COLORS environment variable can change the settings. Use the
   dircolors command to set it.

Yes, my distro does contain "/etc/profile.d/colorls.sh" but nothing
indicates whether the system administrator should or should not touch
the file. I can't seem to locate a mention of it here:

   https://docs.fedoraproject.org/f26/system-administrators-guide/B
   ook_Info.html#>

Also, you need some detective work to derive the luser configuration
interface from "/etc/profile.d/colorls.sh".


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


Re: The "loop and a half"

2017-10-08 Thread bartc

On 08/10/2017 17:13, Chris Angelico wrote:

On Mon, Oct 9, 2017 at 2:01 AM, bartc  wrote:

However as graphics became more mainstream then yes I did adopt some
commonly expected styles (menubars for example). As for Alt-F4, if that
generates a WM_CLOSE message for example, then I would be obliged to deal
with it.


Yes, it usually does generate that. Why? Because your desktop manager
translates concrete user actions into abstract events like "close
window" - and does so according to a number of standards. In case you
haven't noticed, those standards are not 100% consistent across
platforms. So that means that...

On Sun, Oct 8, 2017 at 10:46 PM, bartc  wrote:

On 07/10/2017 15:40, Steve D'Aprano wrote:

Or you could just follow the expected Unix interface instead of inventing
your own.


Your job is to port an editor that people have been using for 30 years to
Linux. The first thing you do is to change all the commands and shortcuts to
match what is typical on Linux? So that no-one who was familiar with it as
it was can actually use it?


... yeah, you absolutely *should* follow your OS's conventions, and
you automatically *will* if you're using a properly-designed GUI
toolkit. Why should it be different with the console? For instance,
anyone on Linux will understand what this prompt notation means:

Use config file: [~/.flurblerc]

Yep, definitely follow your host platform's conventions.


Yeah, well, some people like to be sheep, others like to be individuals**.

I start in computing at a time when an application was the only thing 
running on a computer, at least, when people had personal computers of 
their own. Then it really didn't matter what went on outside, as nothing 
did.


(That approach seems to have become popular again with tablets and 
things usually having one application occupying the screen at a time.)


And within an application, it can do what it likes. With regards to 
editing, there are some common conventions that I absolutely hate:


* Left and right keys, and backspace and delete keys, that don't regard 
the left and right ends of a line as hard stops; they just keep going. 
OK-ish for word processing, but not for line-oriented code.


* Clicking on a box containing text and the whole thing being 
highlighted. Now you're on tenterhooks as the slightest move and 
everything disappears. You might be able able to press Ctrl Z to get it 
back (yes, the same Ctrl Z that's supposed to terminate applications!) 
but it's still highlighted.


* Clicking backspace on a web page doing the same as the Back button. 
Now, backspace is used for editing text within forms. It's very annoying 
if, after half an hour filling in a form, somehow the current box loses 
the focus (the cursor), but you proceed to press backspace space several 
time before noticing. Like my first complaint, but in spades.


* Under Windows, if you press Shift while Caps Lock is on, you get lower 
case letters. I've never, ever wanted to do this (probably no one else 
has). My own editor doesn't obey that convention: shift-A will always 
come out as 'A' whatever the caps lock setting.


There are dozens more, yet you are surprised why sometimes I prefer 
doing things my own way? There are good reasons!


(**I was in the audience of a Michael Palin interview a couple of weeks 
back. (You know, an actual Python!) Before he came on the audience was 
programmed to respond to the word 'individuals' by all saying 'Yes, we 
are all individuals!'. Apart from me, obviously.)


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


Re: OT again sorry [Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]]

2017-10-08 Thread Leam Hall

On 10/08/2017 12:43 PM, Marko Rauhamaa wrote:

leam hall :
"Linux" means so many things to people. 


Yes, but just because someone can spell it doesn't mean they can 
redefine it.  :)



Closer to home, systemd has taken a central role in the main Linux
distributions. I think it would be more accurate to call them "systemd
distros" than "Linux distros".


I have other words for them; mostly ones I try not to say.


It is not at all easy for the Linux user to figure out what
configuration options there are, and which ones are intended for
end-user configuration.


Agree! I had to look this up and I've been doing Linux for a few years.


Marko


I knew your e-mail address was familiar; saluton!

Leam
  -- Who hasn't practiced that language in years. Sadly...

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


Re: IDLE help.

2017-10-08 Thread Terry Reedy

On 10/8/2017 5:24 AM, Joe Wilde wrote:


I am having trouble getting IDLE (Python 3.6 - 64-bit) to open for Windows 10. 
When I try and run IDLE, nothing happens. It works fine for Python 2.7, but 
won't open for Python 3.6.


Give more information.  How did you install Python? Did you select the 
option to install tkinter and IDLE?  How are you trying to run IDLE?  Do 
you know what Command Prompt and a console are?



--
Terry Jan Reedy

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


Re: The "loop and a half"

2017-10-08 Thread Chris Angelico
On Mon, Oct 9, 2017 at 3:37 AM, Stefan Ram  wrote:
> Gregory Ewing  writes:
>>bartc wrote:
>>>Interactive Python requires quit() or exit(), complete with parentheses.
>>Er, what? Ctrl-D works fine for me to exit Python when not
>>in the midst of entering a block.
>
>   Under Microsoft Windows, one can press
>
> Alt-Space
>
>   to open the window menu and then
>
> C
>
>   to close the window. Since this already works with nearly
>   every other window, it seems natural to use this also with
>   the Python console.

Also works in any other standards-compliant OS.

>   (Disclaimer: I don't whether Microsoft is retiring the
>   Windows menu in Windows 10.)

See above comment :|

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


Re: Pandas/dataexplore, how do you get data into them?

2017-10-08 Thread Chris Green
Stefan Ram  wrote:
> Chris Green  writes:
> >How do you load a large table into dataexplore?
> 
>   I have not tested the following lines, I have no experience
>   with "dataexplore", this is just from what I heard:
> 
> from pandastable.app import DataExplore
> app = DataExplore()
> table = app.getCurrentTable() 
> 
>   You can now supposedly use »table.importCSV« to import CSV.
>   Read the docs for more details. It might not even work as I
>   wrote, but maybe just the names of those callables can get
>   you started.
> 
>   Also check out »app.load_dataframe« which supposedly can
>   load a "dataframe" (interactively?).
> 
Thanks, those might get me going.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The "loop and a half"

2017-10-08 Thread Chris Angelico
On Mon, Oct 9, 2017 at 3:50 AM, bartc  wrote:
> Yeah, well, some people like to be sheep, others like to be individuals**.

Yeah, well, some people like to be standards-compliant, others like to
be irrelevant morons.

> I start in computing at a time when an application was the only thing
> running on a computer, at least, when people had personal computers of their
> own. Then it really didn't matter what went on outside, as nothing did.
>
> (That approach seems to have become popular again with tablets and things
> usually having one application occupying the screen at a time.)
>
> And within an application, it can do what it likes.

It's 2017. Even on a phone/tablet, where there isn't enough room to
usefully display more than one app *at a time*, you still have
multiple apps.

> With regards to editing,
> there are some common conventions that I absolutely hate:
>
> * Under Windows, if you press Shift while Caps Lock is on, you get lower
> case letters. I've never, ever wanted to do this (probably no one else has).
> My own editor doesn't obey that convention: shift-A will always come out as
> 'A' whatever the caps lock setting.
>
> There are dozens more, yet you are surprised why sometimes I prefer doing
> things my own way? There are good reasons!

Yep. Good reasons like that you're a moron. You assume that since
*you* have never needed to produce one lower-case letter in a block of
upper-case, that "probably no one else has", and then you make it
impossible to do that in your editor. I have wanted to produce a
lower-case letter by holding Shift. I have also used this behaviour to
detect and recognize faults of various sorts. Do you understand the
concept of debugging a system by getting more information, not less?

> (**I was in the audience of a Michael Palin interview a couple of weeks
> back. (You know, an actual Python!) Before he came on the audience was
> programmed to respond to the word 'individuals' by all saying 'Yes, we are
> all individuals!'. Apart from me, obviously.)

Obviously. Which meant that the crowd created a joke, and you simply
didn't take part in it. You became irrelevant.

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


Re: The "loop and a half"

2017-10-08 Thread Marko Rauhamaa
Chris Angelico :

> On Mon, Oct 9, 2017 at 3:50 AM, bartc  wrote:
>> Yeah, well, some people like to be sheep, others like to be
>> individuals**.
>
> Yeah, well, some people like to be standards-compliant, others like to
> be irrelevant morons.

Even being called a sheep doesn't justify that kind of response, Chris.

>> There are dozens more, yet you are surprised why sometimes I prefer
>> doing things my own way? There are good reasons!
>
> Yep. Good reasons like that you're a moron.

You can think that but shouldn't post it. Simply plonk Bart if you have
to.


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


Re: The "loop and a half"

2017-10-08 Thread bartc

On 08/10/2017 19:10, Chris Angelico wrote:

On Mon, Oct 9, 2017 at 3:50 AM, bartc  wrote:



You assume that since
*you* have never needed to produce one lower-case letter in a block of
upper-case, that "probably no one else has", and then you make it
impossible to do that in your editor.


Only when caps-lock is stuck on (then the feature may have be of some 
use at last). However my editor also makes it very easy to reverse or 
change case of existing text.


The advantage of Shift working one-way is that it is guaranteed to give 
you a capital letter without you needing to check the caps-lock status 
or checking the screen to see that it was typed as capitals.


That is 100 times more useful than the rare time you have to add a lower 
case letter in a sea of capitals and can't be bothered to turn off caps 
lock.


 I have wanted to produce a

lower-case letter by holding Shift.
I've read that other people have had exactly the same trouble. I don't 
believe that my pattern of typing English text is that different from 
most other people's, and I've ALWAYS found that 'feature' annoying, so 
from that I might infer that plenty of others do too.


In fact, if I start off MS Word, with caps lock unknowingly on, and type 
Shifted-T, unshifted-H, unshifted-E, that will temporarily display 'tHE' 
before it gets auto-corrected to the intended 'The'.


I wonder why it does that? According to you, people WANT to type tHE.

BTW, all the typewriters I've used do exactly what I want. If caps lock 
is on (shift-lock there), then pressing Shift doesn't reverse it. So, 
what happened to existing practice there, typewriters hadn't been around 
long enough?


> I have also used this behaviour to
> detect and recognize faults of various sorts. Do you understand the
> concept of debugging a system by getting more information, not less?

I've no idea what you're talking about there.

> Yep. Good reasons like that you're a moron.

> Yeah, well, some people like to be standards-compliant, others like to
> be irrelevant morons.

I started to be angry when I saw these insults now I'm just rather 
depressed.


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


Re: django project avoid reload page where work algorithm

2017-10-08 Thread Richard Damon

On 10/8/17 11:58 AM, Xristos Xristoou wrote:

Τη Κυριακή, 8 Οκτωβρίου 2017 - 6:35:28 μ.μ. UTC+3, ο χρήστης MRAB έγραψε:

On 2017-10-08 15:27, Xristos Xristoou wrote:



Do you mean "long reload"?


user can put some numbers in my html template and i take that numbers and i sue 
it in specific mathematical algorithm that algorithm to create result need time 
 between 5-10 minutes in that time browser stay on reload...that i mean



It sounds like the fundamental problem is that you are doing the 
calculation in the web page handler. This means that the browser will be 
stuck in the page load until the calculation finishes, and that if the 
user aborts the access (or loses connection) then the web page handler 
is aborted.


What you need to do is rather than doing the calculation in the page 
handler, you need to kick off an independent process to do the 
calculation, and then immediately finish the page (maybe giving the use 
a link to a page they can check to see if a result is available).

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


Re: Pandas/dataexplore, how do you get data into them?

2017-10-08 Thread Thomas Jollans
On 08/10/17 18:02, Chris Green wrote:
> I am looking at dataexplore and Pandas, they look as if they may
> provide useful tools but at the moment I can't quite understand how
> you get data into them.
>
> How do you load a large table into dataexplore?
>
> Ultimetely I want to get data from a database table but any help would
> be useful.
>
I know nothing about dataexplore, but pandas has tonnes of handy I/O
functions:

http://pandas.pydata.org/pandas-docs/version/0.20/io.html

I mostly use pandas.read_csv to get data in, but there is also a
read_sql function that you might find useful


-- Thomas


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


Re: django project avoid reload page where work algorithm

2017-10-08 Thread Xristos Xristoou
Τη Κυριακή, 8 Οκτωβρίου 2017 - 10:48:38 μ.μ. UTC+3, ο χρήστης Richard Damon 
έγραψε:
> On 10/8/17 11:58 AM, Xristos Xristoou wrote:
> > Τη Κυριακή, 8 Οκτωβρίου 2017 - 6:35:28 μ.μ. UTC+3, ο χρήστης MRAB έγραψε:
> >> On 2017-10-08 15:27, Xristos Xristoou wrote:
> > 
> >> Do you mean "long reload"?
> > 
> > user can put some numbers in my html template and i take that numbers and i 
> > sue it in specific mathematical algorithm that algorithm to create result 
> > need time  between 5-10 minutes in that time browser stay on reload...that 
> > i mean
> > 
> 
> It sounds like the fundamental problem is that you are doing the 
> calculation in the web page handler. This means that the browser will be 
> stuck in the page load until the calculation finishes, and that if the 
> user aborts the access (or loses connection) then the web page handler 
> is aborted.
> 
> What you need to do is rather than doing the calculation in the page 
> handler, you need to kick off an independent process to do the 
> calculation, and then immediately finish the page (maybe giving the use 
> a link to a page they can check to see if a result is available).

yes this is nice can you help me to do that?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: django project avoid reload page where work algorithm

2017-10-08 Thread Michael Torrie
On 10/08/2017 02:46 PM, Xristos Xristoou wrote:
> Τη Κυριακή, 8 Οκτωβρίου 2017 - 10:48:38 μ.μ. UTC+3, ο χρήστης Richard Damon 
> έγραψε:
>> It sounds like the fundamental problem is that you are doing the 
>> calculation in the web page handler. This means that the browser will be 
>> stuck in the page load until the calculation finishes, and that if the 
>> user aborts the access (or loses connection) then the web page handler 
>> is aborted.
>>
>> What you need to do is rather than doing the calculation in the page 
>> handler, you need to kick off an independent process to do the 
>> calculation, and then immediately finish the page (maybe giving the use 
>> a link to a page they can check to see if a result is available).
> 
> yes this is nice can you help me to do that?

I'm sure google can give you some ideas on how to implement this.  Have
you done a google search? Maybe start with the terms "django
long-running process" and see what comes up. Good luck.  Learning is a
fun adventure!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: django project avoid reload page where work algorithm

2017-10-08 Thread Richard Damon

On 10/8/17 4:46 PM, Xristos Xristoou wrote:

Τη Κυριακή, 8 Οκτωβρίου 2017 - 10:48:38 μ.μ. UTC+3, ο χρήστης Richard Damon 
έγραψε:

On 10/8/17 11:58 AM, Xristos Xristoou wrote:

Τη Κυριακή, 8 Οκτωβρίου 2017 - 6:35:28 μ.μ. UTC+3, ο χρήστης MRAB έγραψε:

On 2017-10-08 15:27, Xristos Xristoou wrote:



Do you mean "long reload"?


user can put some numbers in my html template and i take that numbers and i sue 
it in specific mathematical algorithm that algorithm to create result need time 
 between 5-10 minutes in that time browser stay on reload...that i mean



It sounds like the fundamental problem is that you are doing the
calculation in the web page handler. This means that the browser will be
stuck in the page load until the calculation finishes, and that if the
user aborts the access (or loses connection) then the web page handler
is aborted.

What you need to do is rather than doing the calculation in the page
handler, you need to kick off an independent process to do the
calculation, and then immediately finish the page (maybe giving the use
a link to a page they can check to see if a result is available).


yes this is nice can you help me to do that?



I haven't done it myself, but you may want to look at the various 
os.spawn* methods.

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


Re: The "loop and a half"

2017-10-08 Thread Gregory Ewing

bartc wrote:
And within an application, it can do what it likes. With regards to 
editing, there are some common conventions that I absolutely hate:


In other words, you would like all authors of text editors to
adopt a certain set of conventions for these things. So much
for each program "doing what it likes".

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


Re: Pandas/dataexplore, how do you get data into them?

2017-10-08 Thread Chris Green
Thomas Jollans  wrote:
> On 08/10/17 18:02, Chris Green wrote:
> > I am looking at dataexplore and Pandas, they look as if they may
> > provide useful tools but at the moment I can't quite understand how
> > you get data into them.
> >
> > How do you load a large table into dataexplore?
> >
> > Ultimetely I want to get data from a database table but any help would
> > be useful.
> >
> I know nothing about dataexplore, but pandas has tonnes of handy I/O
> functions:
> 
> http://pandas.pydata.org/pandas-docs/version/0.20/io.html
> 
> I mostly use pandas.read_csv to get data in, but there is also a
> read_sql function that you might find useful
> 
Ah, thank you, this is getting more interesting!  :-)

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


How to track usage within a desktop python application

2017-10-08 Thread Ryan Holmes
I maintain a desktop python application that is used by a decent number of 
folks (I would assume 10k+, though it's hard to know since it's based on number 
of downloads rather than number of unique users). I would like to integrate 
some sort of usage tracking that would enable me to determine number of users 
along with startups, which features are used/not used, performance metrics, 
exceptions, etc. Since it's an open-source project, I am looking for a free 
service (or a service that provides free licenses to open source projects) that 
has a python client library. 

Can anyone recommend something?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python GUI application embedding a web browser - Options?

2017-10-08 Thread douglashf . mec
Did you find out the answer for that?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to track usage within a desktop python application

2017-10-08 Thread William Ray Wing

> On Oct 8, 2017, at 8:38 PM, Ryan Holmes  wrote:
> 
> I maintain a desktop python application that is used by a decent number of 
> folks (I would assume 10k+, though it's hard to know since it's based on 
> number of downloads rather than number of unique users). I would like to 
> integrate some sort of usage tracking that would enable me to determine 
> number of users along with startups, which features are used/not used, 
> performance metrics, exceptions, etc. Since it's an open-source project, I am 
> looking for a free service (or a service that provides free licenses to open 
> source projects) that has a python client library. 
> 

You do know, of course, that most folks frown on applications that “phone home” 
without asking first, and if you do ask your users for permission, many of them 
(perhaps most) will say no.  So, you still won’t really have good statistics.

Bill

> Can anyone recommend something?
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


The "loop and a half"

2017-10-08 Thread Mikhail V
bartc wrote:
>> But as it happens, I could make computers talk to each when I was working
>> with microprocessors, using home-made interfaces, rs232 or rs423. I
wouldn't
>> know how to do it now because it depends on other people's over-complex
>> tech.

Chris Angelico wrote:
> I don't know if you're an idiot or a troll. Using TCP/IP networking is
> pretty simple (at least if you're using a real language - your own toy
> languages might have made it unnecessarily hard, for all I know),
> hardly "over-complex" by comparison to RS-232 programming.

I suppose he is a programmer who is just not much interested in
networking and what you can do in beloved console.
And if you have remote editing you still need
to work in a line by line input?

Just for people like me who know nothing about networking,
can you popularly explain the :

> Have you ever worked on a slow remote session where a GUI is
> completely impracticable (or maybe even unavailable), and redrawing
> the screen is too expensive to do all the time?

So where does the redrawing happen? The machine youre sitting on (let's
call it 'A') and send remote commands or retrieving text files? Or the
redrawing must be synced on both A and
the remote machine? If so, then why so?
How does the bandwidth implies that you must edit stuff in the console on
A?
And not in a nice editor with normal fonts?
Am i missing something or your 'A' machine cannot use graphics? Even on 386
computers
there was graphics and keybord&mouse input. That is definitely what I would
want
for editing files. Yes I've tried line by line eding back in DOS times and
that really sucks.


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


Re: The "loop and a half"

2017-10-08 Thread Chris Angelico
On Mon, Oct 9, 2017 at 3:35 PM, Mikhail V  wrote:
>> Have you ever worked on a slow remote session where a GUI is
>> completely impracticable (or maybe even unavailable), and redrawing
>> the screen is too expensive to do all the time?
>
> So where does the redrawing happen? The machine youre sitting on (let's
> call it 'A') and send remote commands or retrieving text files? Or the
> redrawing must be synced on both A and
> the remote machine? If so, then why so?
> How does the bandwidth implies that you must edit stuff in the console on
> A?
> And not in a nice editor with normal fonts?
> Am i missing something or your 'A' machine cannot use graphics? Even on 386
> computers
> there was graphics and keybord&mouse input. That is definitely what I would
> want
> for editing files. Yes I've tried line by line eding back in DOS times and
> that really sucks.

Mostly, I use an SSH session without X11 forwarding, so everything
happens on that link. Redrawing happens on "A", and the program runs
on "B". It is technologically possible to have a GUI (that's what X11
forwarding is for), but it's a lot more fiddliness and bandwidth, and
it requires that "B" have the appropriate GUI libraries installed, so
I often don't or can't do that.

Generally, my preferred editor is nano, since it lives within those
requirements but still has a decent UI. It's not always available
though, and it's useful to know how to manage without it. But even
though you won't always be doing this sort of thing, it's definitely
something that a *programming language designer* should be aware of.
Basic networking is critical to any modern language.

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


Re: The "loop and a half"

2017-10-08 Thread Ian Kelly
On Sun, Oct 8, 2017 at 10:49 PM, Chris Angelico  wrote:
> On Mon, Oct 9, 2017 at 3:35 PM, Mikhail V  wrote:
>>> Have you ever worked on a slow remote session where a GUI is
>>> completely impracticable (or maybe even unavailable), and redrawing
>>> the screen is too expensive to do all the time?
>>
>> So where does the redrawing happen? The machine youre sitting on (let's
>> call it 'A') and send remote commands or retrieving text files? Or the
>> redrawing must be synced on both A and
>> the remote machine? If so, then why so?
>> How does the bandwidth implies that you must edit stuff in the console on
>> A?
>> And not in a nice editor with normal fonts?
>> Am i missing something or your 'A' machine cannot use graphics? Even on 386
>> computers
>> there was graphics and keybord&mouse input. That is definitely what I would
>> want
>> for editing files. Yes I've tried line by line eding back in DOS times and
>> that really sucks.
>
> Mostly, I use an SSH session without X11 forwarding, so everything
> happens on that link. Redrawing happens on "A", and the program runs
> on "B". It is technologically possible to have a GUI (that's what X11
> forwarding is for), but it's a lot more fiddliness and bandwidth, and
> it requires that "B" have the appropriate GUI libraries installed, so
> I often don't or can't do that.

Or you could use a GUI editor that runs locally and has the capability
to edit files remotely over ssh.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The "loop and a half"

2017-10-08 Thread Gregory Ewing

Grant Edwards wrote:

Which took it from RSX-11.  Or probably more specifically from
FILES-11.  I woldn't be surprised if the enineers at DEC got it from
somewhere else before that.


Quite possibly it goes back to the very earliest DEC OS
that had files, whatever that was.

The reason for it was that the file system only kept track
of file sizes in blocks, not bytes, so some way was needed
to mark the end of a text file part way through a block.

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


Re: The "loop and a half"

2017-10-08 Thread Chris Angelico
On Mon, Oct 9, 2017 at 4:17 PM, Ian Kelly  wrote:
> On Sun, Oct 8, 2017 at 10:49 PM, Chris Angelico  wrote:
>> On Mon, Oct 9, 2017 at 3:35 PM, Mikhail V  wrote:
 Have you ever worked on a slow remote session where a GUI is
 completely impracticable (or maybe even unavailable), and redrawing
 the screen is too expensive to do all the time?
>>>
>>> So where does the redrawing happen? The machine youre sitting on (let's
>>> call it 'A') and send remote commands or retrieving text files? Or the
>>> redrawing must be synced on both A and
>>> the remote machine? If so, then why so?
>>> How does the bandwidth implies that you must edit stuff in the console on
>>> A?
>>> And not in a nice editor with normal fonts?
>>> Am i missing something or your 'A' machine cannot use graphics? Even on 386
>>> computers
>>> there was graphics and keybord&mouse input. That is definitely what I would
>>> want
>>> for editing files. Yes I've tried line by line eding back in DOS times and
>>> that really sucks.
>>
>> Mostly, I use an SSH session without X11 forwarding, so everything
>> happens on that link. Redrawing happens on "A", and the program runs
>> on "B". It is technologically possible to have a GUI (that's what X11
>> forwarding is for), but it's a lot more fiddliness and bandwidth, and
>> it requires that "B" have the appropriate GUI libraries installed, so
>> I often don't or can't do that.
>
> Or you could use a GUI editor that runs locally and has the capability
> to edit files remotely over ssh.

That's also a possibility, but I have yet to find one that can SSH to
a server as a non-root user and then sudo to edit the files. If I
simply run everything over SSH, I can "sudo -e /etc/some-file" and
it'll manage that side of things for me.

Of course, there is another option, and one that I'm using
increasingly often these days: edit files locally, commit to git, and
then "git pull" on the remote system. :)

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


Re: The "loop and a half"

2017-10-08 Thread Lele Gaifax
Chris Angelico  writes:

>> Or you could use a GUI editor that runs locally and has the capability
>> to edit files remotely over ssh.
>
> That's also a possibility, but I have yet to find one that can SSH to
> a server as a non-root user and then sudo to edit the files.

If it's just a matter of "finding one", look no further and try out Emacs's
TRAMP :-)

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
[email protected]  | -- Fortunato Depero, 1929.

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


on = style

2017-10-08 Thread Abdur-Rahmaan Janhangeer
hi just a quick question, why is

my_pens = 4
my_pencils = 5

is preffered to

my_pens = 4
my_pencils = 5

*referring to = symbol alignment

tk !

Abdur-Rahmaan Janhangeer,
Mauritius
abdurrahmaanjanhangeer.wordpress.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: on = style

2017-10-08 Thread Chris Angelico
On Mon, Oct 9, 2017 at 5:40 PM, Abdur-Rahmaan Janhangeer
 wrote:
> hi just a quick question, why is
>
> my_pens = 4
> my_pencils = 5
>
> is preffered to
>
> my_pens = 4
> my_pencils = 5
>
> *referring to = symbol alignment

Because when you add a new variable:

my_mousepads = 6

you then have to add extra spaces to each of the other lines. That's
spurious changes in a diff, unnecessary edits that you have to make,
and lots of pointless work.

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