Static typing [was Re: Python and the need for speed]

2017-04-15 Thread Steve D'Aprano
On Sat, 15 Apr 2017 11:55 am, Rick Johnson wrote: > apparently, the py-devs believe we > only deserve type declarations that do nothing to speed up > code execution (aka: type-hints), instead of type > declarations that could actually speed up the code. Go > figure! > > I'm not a fan of forced st

Re: super() is super [was Re: Calling dunder methods manually]

2017-04-15 Thread Gregory Ewing
Steve D'Aprano wrote: But for the simple cases, using super() in Python 3 couldn't be easier. The only "simple" use of super() is in the single inheritance case. But that's also the case where it gains you the least over an explicit inherited method call. If you have multiple inheritance, and

Looping [was Re: Python and the need for speed]

2017-04-15 Thread Steve D'Aprano
On Sat, 15 Apr 2017 10:17 pm, bartc wrote: > On 15/04/2017 03:35, Rick Johnson wrote: >> On Wednesday, April 12, 2017 at 8:44:30 AM UTC-5, bart...@gmail.com >> wrote: > >> At a minimum, every language should offer >> the following four loop-forms (using Python semantics): >> >> while CONDITIO

Re: New implementation(patterns)

2017-04-15 Thread Steve D'Aprano
On Sun, 16 Apr 2017 05:34 am, Debiller 777 wrote: > >>> &mypattern='<'str'>' That's a syntax error. Are you sure that's the actual, real, working code you are using? > >>> def &mynewpattern: > ... return MyClass(list) That's also a syntax error. -- Steve “Cheer up,” they said, “things

Re: super() is super [was Re: Calling dunder methods manually]

2017-04-15 Thread Chris Angelico
On Sun, Apr 16, 2017 at 10:35 AM, Steve D'Aprano wrote: > >> eaisier to just write the path in long-form. > > Easier and wrong. > > If you have multiple inheritance, and don't use super(), then your code is > buggy, whether you have realised it or not. > > Manually calling your parent class is onl

Re: Python and the need for speed

2017-04-15 Thread Steve D'Aprano
On Sun, 16 Apr 2017 12:37 am, bartc wrote: > What proportion of Python implementations depend on executing byte-code? My guess is 100%. Pretty much all modern interpreters of any language execute some form of byte-code or another. The bad old days where interpreters repeatedly parsed and execute

super() is super [was Re: Calling dunder methods manually]

2017-04-15 Thread Steve D'Aprano
On Sat, 15 Apr 2017 10:50 pm, Rick Johnson wrote: > Even to this day, i avoid super because the > semantics are confusing, If super() is confusing, it is because *inheritance* is confusing, and that goes triple for multiple inheritance. If it is not *easy* to use super() to manage your class' in

Re: what type of application implemented with python?

2017-04-15 Thread Ivan "Rambius" Ivanov
Hello, Python's own website contains a non-exhaustive list of applications implemeted in Python: https://www.python.org/about/apps/ Regards Rambius On Sat, Apr 15, 2017 at 4:13 PM, kondaiah sinha wrote: > what type of application implemented with python?...like by using java we can > implement

how to get image url from django form

2017-04-15 Thread Xristos Xristoou
i have create a simple django form where the authentication user can select one of personal images where have upload before and i want do something with that request in my views.py. but i dont know how to take the image url from that request in my view because first i using request.user in the

New implementation(patterns)

2017-04-15 Thread Debiller 777
So.Basically recently I just faced with some problem. I wanted to create my own data type. I created new class put something in it. But I really wanted to set items in it like so: >>>datatype[0][0][1]=1 As you could see I used 3 keys But magic method __setitem__ alows me

Re: Python Command Line Arguments

2017-04-15 Thread Grant Edwards
On 2017-04-14, Bernd Nawothnig wrote: > He should switch to argparse in any case because getopt is no longer > supported and does only receive bugfixes. In my book, "receiving bug fixes" means it's still supported. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Python and the need for speed

2017-04-15 Thread Michael Torrie
On 04/15/2017 08:37 AM, bartc wrote: > What proportion of Python implementations depend on executing byte-code? Presumably Nuitka does not depend on any byte code at all. Jython uses JVM byte codes. Iron Python uses .net VM bytecodes. While CPython's byte codes do take their form in part becaus

Re: Python and the need for speed

2017-04-15 Thread Ben Bacarisse
bartc writes: > 'do', in the original Algol 68 syntax, was part of its 'for' > statement, where you could leave out the parts you don't need. The > full syntax is something like: > > for var := a to b by c while d do body od FOR name FROM e1 BY e2 TO e3 WHILE cond DO body OD The significan

Re: TIC TAE TOE's problem(i am beginner)

2017-04-15 Thread Jason Friedman
> > P=input("X/O:") > if P=="X": > my_func1() > else: > my_func2() > > > > why cant function to print X or O win... > As a beginner I'd try to code using Python idioms rather than writing Python using BASIC idioms. Try to understand how this code works: https://codereview.stackexchange.com

Re: Python and the need for speed

2017-04-15 Thread bartc
On 15/04/2017 14:27, Marko Rauhamaa wrote: bartc : while 1: body Why not say it like it is: while True: body but it's more psychological; I don't want to use an idiom to denote an endless loop, I want to be able to express it directly! C's: for (;;) st

Re: Python and the need for speed

2017-04-15 Thread Rick Johnson
On Saturday, April 15, 2017 at 7:17:55 AM UTC-5, bartc wrote: > On 15/04/2017 03:35, Rick Johnson wrote: > > On Wednesday, April 12, 2017 at 8:44:30 AM UTC-5, bart...@gmail.com wrote: > > > At a minimum, every language should offer > > the following four loop-forms (using Python semantics): > > > >

Re: Python and the need for speed

2017-04-15 Thread Marko Rauhamaa
bartc : > Of course, it's possible to overdo it; if you look at Lisp, you'll lose > yourself in the myriad looping options. Funny, in Scheme, the only looping construct I use is named-let. > The former /can/ be easily written as: > > while 1: > body Why not say it like it is: wh

what type of application implemented with python?

2017-04-15 Thread kondaiah sinha
what type of application implemented with python?...like by using java we can implement web,Standard alone app's,mobile based. Can anyone tell me is it possible to implement Standard alone applications with, if possible give any example -- https://mail.python.org/mailman/listinfo/python-list

Re: Calling dunder methods manually

2017-04-15 Thread Rick Johnson
On Thursday, April 13, 2017 at 2:01:41 AM UTC-5, Serhiy Storchaka wrote: > > __init__ is perhaps the most called dunder method. It is > often called from the __init__ method of subclasses. Yes, that would be one of the exceptions to the rule, but not because the rule is unsound, but because Python

Re: Python and the need for speed

2017-04-15 Thread Steve D'Aprano
On Sat, 15 Apr 2017 10:23 am, bartc wrote: > On 15/04/2017 00:40, Rick Johnson wrote: >> * `range(10)` will always produce a list of the _same_ 10 >> integers. > > You don't know if 'range' is still a range. If this has been executed > first, then the answer will be 20: > > oldrange=range >

Re: Python and the need for speed

2017-04-15 Thread bartc
On 15/04/2017 03:35, Rick Johnson wrote: On Wednesday, April 12, 2017 at 8:44:30 AM UTC-5, bart...@gmail.com wrote: At a minimum, every language should offer the following four loop-forms (using Python semantics): while CONDITION: doSomething() for VALUE in COLLECTION:

Python Environment Setup in Windows 10

2017-04-15 Thread Sayom Shakib
I am a beginner .NET developer. But I need to use python now for a project. I need to use Scikit-Learn, Numpy, Scipy, matplotlib.pyplot, Pandas, Keras, TensorFlow etc libraries (Mostly for Machine Learning). To be more specific, I want to implement this example- http://machinelearningmastery.co

TIC TAE TOE's problem(i am beginner)

2017-04-15 Thread tflchkl
A=['1', ' ', '1'] B=['1', ' ', '2'] C=['1', ' ', '3'] D=['2', ' ', '1'] E=['2', ' ', '2'] F=['2', ' ', '3'] G=['3', ' ', '1'] H=['3', ' ', '2'] I=['3', ' ', '3'] N=int(9) def my_func1(): X=list(input()) global N N=N-1 if X==['1', ' ', '1']: A="X" my_func3() m

Re: 'module' object has no attribute 'wrap_socket' when use ssl

2017-04-15 Thread Ho Yeung Lee
On Saturday, April 15, 2017 at 3:18:58 PM UTC+8, Peter Otten wrote: > Ho Yeung Lee wrote: > > > Python 2.7.6 (default, Jun 22 2015, 18:00:18) > > [GCC 4.8.2] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > import ssl > > Traceback (most recent call last)

RE: Namedtuples: some unexpected inconveniences

2017-04-15 Thread Peter Otten
Deborah Swanson wrote: > I know it's your "ugly" answer, but can I ask what the '**' in > > fix = {label: max(values, key=len)} > group[:] = [record._replace(**fix) for record in group] > > means? d = {"a": 1, "b": 2} f(**d) is equivalent to f(a=1, b=2) so ** is a means to call a function w

Re: 'module' object has no attribute 'wrap_socket' when use ssl

2017-04-15 Thread Peter Otten
Ho Yeung Lee wrote: > Python 2.7.6 (default, Jun 22 2015, 18:00:18) > [GCC 4.8.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. import ssl > Traceback (most recent call last): > File "", line 1, in > File "/home/martin/Documents/ssl.py", line 13, in

'module' object has no attribute 'wrap_socket' when use ssl

2017-04-15 Thread Ho Yeung Lee
Python 2.7.6 (default, Jun 22 2015, 18:00:18) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import ssl Traceback (most recent call last): File "", line 1, in File "/home/martin/Documents/ssl.py", line 13, in SSLError -- exception raised