[Python-Dev] complaints..

2008-01-13 Thread Jay
I'm sure you've heard most/all of this before but..it..just..seems..so..true...

Finally this week I've "written" (ported from sh) a bunch of Perl, 2000 sparse 
lines.
While it sure beats Perl, it has some glaring flaws, more glaring due to
its overall goodness.

I feel compelled to voice my opinion, as if we don't live in a benevolent 
dictatorship :),
and as if the weight of existing code was zero.
Much of what I dislike cannot be changed without massive breakage.

Below is what i get from:

jbook:/dev2/cm3/scripts/python/flaws jay$ ls -l
total 72
-rw-r--r--   1 jay  admin  834 Dec 29 16:02 1_not_lexically_scoped.py
-rw-r--r--   1 jay  admin  238 Dec 29 16:02 2_reads_scoped_writes_not.py
-rw-r--r--   1 jay  admin  593 Dec 29 16:02 3_lambda_is_neutered.py
-rw-r--r--   1 jay  admin  377 Dec 29 16:03 4_assignment_is_not_expression.py
-rw-r--r--   1 jay  admin  760 Dec 29 16:02 5_for_loop_off_by_one.py
-rw-r--r--   1 jay  admin  412 Dec 29 16:01 6_docs_good_but_a_complaint.txt
-rw-r--r--   1 jay  admin  254 Dec 29 16:02 7_print_is_wierd.py
-rw-r--r--   1 jay  admin  286 Dec 29 16:06 8_eval_vs_exec.py
-rw-r--r--   1 jay  admin  824 Dec 29 16:14 9_typo_on_read_error_but_write_ok.py

jbook:/dev2/cm3/scripts/python/flaws jay$ cat * > all.txt

jbook:/dev2/cm3/scripts/python/flaws jay$ edit all.txt

Each "---" seperates a file and they are executable Python.

 - Jay


#--
# flaw #1
# not lexically scopied
# Functions have their own locals, but other blocks do not.
# This is true both for "normal" variables and lexically nested functions.
#

#
# This is probably largely an outcome of not declaring variables?
#

A = "A1:global"

def F1():
A = "A1:in first F1"
print "F1:global"

if True:
A = "A1:in if"
def F1():
A = "A1:in if.F1" # This does the right thing.
print "F1:in if"
F1() # This does the right thing.

# This should go to "global" but it goes to "in if"
F1()

def F2():
A = "A1:in F2"
def F1():
A = "A1:in F2.F1"
print "F1:in F2"

# Given how if behaved, you'd expect this to go to F2.F1 but it does not.
F1()

# This should be "global" but is "in if".
print("A is " + A)

#--
# flaw #2
#
# In functions, reads are scoped. Writes are not.
#

A = "1"

def F1():
A = "2" # not an error

def F2():
#B = A # error
A = "3"

F1()
F2()
print(A)

#--
# flaw #3:
#  lambda is neutered
#  It allows just one expression, and no statements
#

# This should work:

import os

#os.path.walk(
#"..",
#lambda(a, b, c):
#print(b)
#print(b)
#None)

# Instead I must say:

def Callback(a, b, c):
print(b)
print(b)

os.path.walk(
"..",
Callback,
None)

#
# Moving callbacks away from their point of use hurts readability.
# This is probably mitigated by lexical scoping of functions, but
# notice that other blocks are not lexically scoped.
#

#--
# flaw #4:
#   assignment is not an expression
#

# This should work (seen in Perl code, nice idiom):

#A = [1,2]
#while (B = A.pop()):
#print(B)

# instead I must say:

A = [1,2]
while (A):
B = A.pop()
print(B)

# Even if you reject popping an empty list, ok
# there are PLENTY of applications of this.

#--
# flaw #5
#
# for loops suck
#
# It should be easy to iterate from 0 to n, not 0 to n - 1,
# thereby knowing why the loop terminated
#

#This should work:

# print the first even number, if there are any

A = [1, 3]
for i in range(0, len(A)):
if ((A[i] % 2) == 0):
print("even number found")
break;
if (i == len(A)):
print("no even numbers found")
 
# instead I must write:

i = 0
while (i != len(A)):
if ((A[i] % 2) == 0):
print("even number found")
break;
i += 1
if (i == len(A)):
print("no even numbers found")

# with the attendent problem of not being able to "continue" ever, since
# the end of the loop body must be run in order to proceed

Flaw #6

The docs are very good.

However the reference doesn't give much in the way
of semantic description.

It is surprising that an experienced programmer MUST
depend on the tutorial or any examples or semantics.
Light on examples, ok for reference.

The language reference is little more than the grammar in parts.

There needs to be links from the reference back to the tutorial.

Perhaps merge the indices for Tutorial, Language Reference, Library Reference.
Or maybe that's wha

[Python-Dev] New Contributor looking for help

2018-01-26 Thread Jay Yin
Hello everyone,


I've been trying to build the master branch on Ubuntu 16.04 and it currently 
fails 2 test, I was wondering if this was normal or if I'm missing 
dependencies, I also tried apt-get build-dev python3.6 and python3.7 to no 
avail, the build requirements install worked for python3.5 but I suspect 3.7 
has different dependencies but I can't find where the documentation for the 
requirements are.

2 tests failed:
test_dtrace test_subprocess


running test_dtrace as verbose gave https://pastebin.com/ZGzzxwjk

[https://pastebin.com/i/facebook.png]

[Bash] FAILED (errors=4) test test_dtrace failed 1 test failed: test_dtrace R - 
Pastebin.com
pastebin.com



and running test_subprocess gives


https://pastebin.com/DNjPzpgp

[https://pastebin.com/i/facebook.png]

[Bash] --- Modules/Setup.dist is 
newer tha - Pastebin.com
pastebin.com





___
[1488460367159_signiture.jpg]
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Python3 OSF/1 support?

2021-07-13 Thread Jay K
Hi. I have an Alpha/OSF machine up and running.
It is little slow, but it works ok.

I would like to run Python3 on it.

I have it "compiling and working". It was easy enough so far.
  https://github.com/python/cpython/pull/27063

Admitted, I haven't figured out what is happening with the posixsubprocess 
module.

Yes? No? Maybe?

I can possibly provide ongoing "support" (I don't expect it will be much) and a 
buildbot (if really required),
if I can get it working a bit more, if this is approved, etc. I haven't looked 
yet at what buildbot involves.

Thank you,
 - Jay
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/NK6ER7SIFQDEZ2W7OANZNGNFPO3FV7HW/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Python3 OSF/1 support?

2021-07-16 Thread Jay K
Yeah, good point, Python 3.2 was trivial to build, and that can aid later work.

Still I'd prefer to be more up to date, where possible (not withstanding the 
very old kernel..).

 - Jay


From: Guido van Rossum 
Sent: Wednesday, July 14, 2021 3:44 PM
To: Senthil Kumaran 
Cc: Jay K ; [email protected] ; 
Larkin Nickle 
Subject: Re: [Python-Dev] Re: Python3 OSF/1 support?

I'd like to add that probably the most economic solution for the OP is to just 
stay on a fixed version of Python and not bother trying to catch up with newer 
Python versions.

On Wed, Jul 14, 2021 at 7:47 AM Senthil Kumaran 
mailto:[email protected]>> wrote:
On Wed, Jul 14, 2021 at 04:30:33AM +, Jay K wrote:
> Hi. I have an Alpha/OSF machine up and running.
> It is little slow, but it works ok.
>
> I would like to run Python3 on it.
>
> I have it "compiling and working". It was easy enough so far.
>   
> https://github.com/python/cpython/pull/27063<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F27063&data=04%7C01%7C%7C1b2c321af29949e9677f08d946de563e%7C84df9e7fe9f640afb435%7C1%7C0%7C637618743001204090%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=T9sq%2FdVrIRKdo%2BzqMjJzLeGpXW8tPu5tIHVPqdjO7PQ%3D&reserved=0>
>
> Admitted, I haven't figured out what is happening with the posixsubprocess
> module.
>
> Yes? No? Maybe?
>
> I can possibly provide ongoing "support" (I don't expect it will be much) and 
> a
> buildbot (if really required),
> if I can get it working a bit more, if this is approved, etc. I haven't looked

It is difficult to maintain support for less commonly used systems. If
you maintain it personally (like using a cron) and look at the results
over time, you could see the difficulty in maintaining the support.

Personally, my vote is a -1 here. In the PR, another core-dev, Ronald
had commented that support for explicitly removed a few years ago.

--
Senthil
___
Python-Dev mailing list -- [email protected]<mailto:[email protected]>
To unsubscribe send an email to 
[email protected]<mailto:[email protected]>
https://mail.python.org/mailman3/lists/python-dev.python.org/<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman3%2Flists%2Fpython-dev.python.org%2F&data=04%7C01%7C%7C1b2c321af29949e9677f08d946de563e%7C84df9e7fe9f640afb435%7C1%7C0%7C637618743001214086%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=hBIZUeKvbI%2FqSTJaHCDeSK8SvF%2BXATqk6mattMG9O0c%3D&reserved=0>
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/QQOYHF77AFRZZ3ZPYZDNIPBGC2AEE7HN/<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Farchives%2Flist%2Fpython-dev%40python.org%2Fmessage%2FQQOYHF77AFRZZ3ZPYZDNIPBGC2AEE7HN%2F&data=04%7C01%7C%7C1b2c321af29949e9677f08d946de563e%7C84df9e7fe9f640afb435%7C1%7C0%7C637618743001224075%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=t757eCYuPIuHqbaPp9CtBw%2B05yJir8f5FM7zKuuvW%2BM%3D&reserved=0>
Code of Conduct: 
http://python.org/psf/codeofconduct/<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpython.org%2Fpsf%2Fcodeofconduct%2F&data=04%7C01%7C%7C1b2c321af29949e9677f08d946de563e%7C84df9e7fe9f640afb435%7C1%7C0%7C637618743001234078%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=0HaUQzHjaq%2BDIEjOfwvgB1qWRJFCsoFZizvp91O1ym0%3D&reserved=0>


--
--Guido van Rossum 
(python.org/~guido<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpython.org%2F~guido&data=04%7C01%7C%7C1b2c321af29949e9677f08d946de563e%7C84df9e7fe9f640afb435%7C1%7C0%7C637618743001234078%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=El1ZnyY6seI%2FUC39eb%2ByYCSJtDn9JPVbV5C4Q1iMY%2Bw%3D&reserved=0>)
Pronouns: he/him (why is my pronoun 
here?)<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ffeministing.com%2F2015%2F02%2F03%2Fhow-using-they-as-a-singular-pronoun-can-change-the-world%2F&data=04%7C01%7C%7C1b2c321af29949e9677f08d946de563e%7C84df9e7fe9f640afb435%7C1%7C0%7C637618743001244074%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=rsiZ43mk2FaT%2BxBhhEJriZXB4eoHYvIKgs6uofwXNRs%3D&reserved=0>
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to pyt

[Python-Dev] doc error in 2.6.2

2009-05-15 Thread Leo Jay
There is a syntax error in the client side code of
"SocketServer.UDPServer Example" in
http://docs.python.org/library/socketserver.html:
import socket
import sys

HOST, PORT = "localhost"
data = " ".join(sys.argv[1:])

Obviously, it should be:
HOST, PORT = "localhost", 

--
Leo Jay
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] SoC AST generation question

2007-03-19 Thread Jay Parlar
I'm considering applying to be a student in this year's SoC, and the
AST code generation in particular looks interesting to me (listed
here: http://wiki.python.org/moin/CodingProjectIdeas/PythonCore).

I was wondering a few things:

1) Who would most likely mentor this project?
2) I've never worked in the core before (but have been using Python as
my primary language for about 6 years), so I'm wondering if the
potential mentor thinks it'd even be feasible for me to jump at a
project like this without prior knowledge.

I'm interested in this project for two reasons. The first is that I'm
still trying to pick my PhD thesis, and I'm leaning in the direction
of automated code generation for embedded systems. I feel like working
on this project would at least push me one way or another in terms of
picking. I've done a major code generation tool before, but it was for
a problem domain I was already an "expert" in, so I didn't develop any
generic methods.

Also, I've been wanting to contribute to Python core for awhile now,
and just haven't had the opportunity to get my feet wet with the code.

Thanks,
Jay P.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] SoC AST generation question

2007-03-20 Thread Jay Parlar
On 3/20/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> Notice that there are really two separate AST projects listed: one
> is to improve usage of the AST compiler, by, say, adding more passes
> to it, or allowing round-tripping from the Python representation.
> The other one is to generate ast.c, which currently is hand-written,
> but could probably be generated automatically. This would not improve
> any end-user features, but would improve the maintainability, as
> currently, changing the AST is tedious as you have to change so
> much other stuff as well.

Part of my desired PhD research goals are in the creation of tools
that aid in the development of correct software, so a tool that
improves maintainability fits perfectly.



> If you want to focus on the "automated code generation" aspect, pick
> the generation of ast.c. Generating C code from a "domain-specific
> model" is a must-know of the compiler engineer. If you want to focus
> on "embedded systems", manipulating on the ast level may be closer
> as you will see how "backend" processing works (which you often
> find important when generating code for a specific target system).

The code generator I mentioned in my first post created C code from a
DSL. I learned a good deal on that, but because I was generating code
for a platform I was already an "expert" in, I didn't really develop
many "general" code generation strategies or techniques. Because I'm
not an expert on Python's ast.c, my hope is that along the way to
creating the tool, I'll be able to learn or develop more general
strategies. But maybe that's a crazy thought :)

Jay P.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [ANN] Python 2.5.6 Release Candidate 1

2011-04-17 Thread Leo Jay
Hi,

I think the release date of 2.5.6c1 should be 17-Apr-2011, instead of
17-Apr-2010
http://www.python.org/download/releases/2.5.6/NEWS.txt

On Mon, Apr 18, 2011 at 5:57 AM, "Martin v. Löwis"  wrote:
>
> On behalf of the Python development team and the Python community, I'm
> happy to announce the release candidate 1 of Python 2.5.6.
>
> This is a source-only release that only includes security fixes. The
> last full bug-fix release of Python 2.5 was Python 2.5.4. Users are
> encouraged to upgrade to the latest release of Python 2.7 (which is
> 2.7.1 at this point).
>
> This releases fixes issues with the urllib, urllib2, SimpleHTTPServer,
> and audiop modules. See the release notes at the website (also
> available as Misc/NEWS in the source distribution) for details of bugs
> fixed.
>
> For more information on Python 2.5.6, including download links for
> various platforms, release notes, and known issues, please see:
>
>    http://www.python.org/2.5.6
>
> Highlights of the previous major Python releases are available from
> the Python 2.5 page, at
>
>    http://www.python.org/2.5/highlights.html
>
> Enjoy this release,
> Martin
>
> Martin v. Loewis
> [email protected]
> Python Release Manager
> (on behalf of the entire python-dev team)


--
Best Regards,
Leo Jay
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Cannot use multiprocessing and zip together on windows

2011-12-21 Thread Leo Jay
Hi All,

I posted this several days ago in python mailing list but got no response
and I think it might be a bug, so I post it here. Apologize if it's
not appropriate.

I have a file p.zip, there is a __main__.py in it, and the content of
__main__.py is:

from multiprocessing import Process
import os

def f():
  print 'in f, pid:', os.getpid()

if __name__ == '__main__':
  print 'pid:', os.getpid()
  p = Process(target=f)
  p.start()
  p.join()


On linux, I can get expected result for running "python p.zip"
But on windows xp, I got:

Traceback (most recent call last):
 File "", line 1, in 
 File "C:\python27\lib\multiprocessing\forking.py", line 346, in main
  prepare(preparation_data)
 File "C:\python27\lib\multiprocessing\forking.py", line 454, in prepare
  assert main_name not in sys.modules, main_name
AssertionError: __main__

It seems that the situation described here is similar:
http://bugs.python.org/issue10128

But the patch doesn't work for me.

Anybody knows how to fix this?
Thanks.

--
Best Regards,
Leo Jay
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] lambda in Python

2006-05-04 Thread Jay Parlar

On May 4, 2006, at 6:00 AM, Talin wrote:

> xahlee  xahlee.org> writes:
>
>> Today i ran into one of Guido van Rossum's blog article titled
>> ?Language Design Is Not Just Solving Puzzles? at
>> http://www.artima.com/weblogs/viewpost.jsp?thread=147358
>
> The confrontational tone of this post makes it pretty much impossible
> to have a reasonable debate on the subject. I'd suggest that if you
> really want to be heard (instead of merely having that "I'm right"
> feeling) that you try a different approach.
>
> -- Talin

Xah Lee is a well known troll, he does stuff like this on c.l.p. all 
the time. Best to just ignore him, he doesn't listen to reason.

Jay P.

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com