[issue38808] weird bug while using a for loop and array

2019-11-15 Thread Zach kuunka


Zach kuunka  added the comment:

I will check that out, Thank you

--

___
Python tracker 
<https://bugs.python.org/issue38808>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38808] weird bug while using a for loop and array

2019-11-14 Thread Zach kuunka


Zach kuunka  added the comment:

I found out it just happens when you set an array to an array they behave as 
the same thing, which if its not a bug it sure is counter-intuitive. 

if you do
x = 1
then 
y = x
then add one to y you have y = 2 and x = 1
if you do it for an array
arr1 = [1]
then set something equal to that
arr2 = arr1
you essentially have 1 var that act on each other which is odd
so arr2.append(2) or arr1.append(2) make both arr1 and arr2 equal to the same 
thing

--

___
Python tracker 
<https://bugs.python.org/issue38808>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38808] weird bug while using a for loop and array

2019-11-14 Thread Zach kuunka


New submission from Zach kuunka :

I haven't used this bug reporting thing before so sorry if I mess something up.

Anyway i'm not sure exactly what is causing the issue but the issue appears 
when you have a for loop looping through an array and you make a variable and 
set it to that array and append something to it. If you do the same thing with 
numbers it works as expected but if you do it with an array it for some reason 
doesn't get reset every iteration. Run this and you'll see what i'm talking 
about.

Arr = [1,2,3,4,5]
for num in Arr:
Arr2 = Arr
Arr2.append(1) #the 1 can be anything
print(Arr2)

Also i'm interested to know why this happens, Thank You

--
components: Library (Lib)
files: brokentest.py
messages: 356648
nosy: Zach kuunka
priority: normal
severity: normal
status: open
title: weird bug while using a for loop and array
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file48716/brokentest.py

___
Python tracker 
<https://bugs.python.org/issue38808>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37564] ArgumentParser should support bool type according to truth values

2019-07-11 Thread Zach Beniash


New submission from Zach Beniash :

Today when using argparse.ArgumentParser it seems that the bool type is not 
supported in a logical way.
Foe example:
-
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--mybool", type=bool)
parsed_args = parser.parse(["--mybool", "False"])
--
parsed_args.my_bool evaluates to True

Instead we should expect to evaluate False here.

--
components: Library (Lib)
messages: 347686
nosy: Zach Beniash
priority: normal
severity: normal
status: open
title: ArgumentParser should support bool type according to truth values
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue37564>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37480] add ptpython to list of alternate interpreters

2019-07-09 Thread Zach Valenta


Zach Valenta  added the comment:

Terry, I agree w/ you that this info has a better home in the wiki. Just 
commented on the PR to say as much there. I'll update the PR per Kyle Stanley's 
suggestion and port the info into the wiki.

--

___
Python tracker 
<https://bugs.python.org/issue37480>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37480] add ptpython to list of alternate interpreters

2019-07-01 Thread Zach Valenta


Change by Zach Valenta :


--
keywords: +patch
pull_requests: +14351
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14538

___
Python tracker 
<https://bugs.python.org/issue37480>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37480] add ptpython to list of alternate interpreters

2019-07-01 Thread Zach Valenta


New submission from Zach Valenta :

Referring to the last paragraph of chapter 14 of the tutorial on interactive 
interpreters: 

https://docs.python.org/3/tutorial/interactive.html#alternatives-to-the-interactive-interpreter

Despite personally using bpython, ptpython seems both mature and popular enough 
to merit inclusion in the docs. Plus, bpython recommends them :)

--
assignee: docs@python
components: Documentation
messages: 347099
nosy: docs@python, zjayv
priority: normal
severity: normal
status: open
title: add ptpython to list of alternate interpreters
type: enhancement
versions: Python 3.7

___
Python tracker 
<https://bugs.python.org/issue37480>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Dataframe iterating question : 3 ways of calling a row and column

2017-08-21 Thread zach . smith
I wouldn't say I'm a Python noob, but I wouldn't say I'm a Python expert 
either. I work in data science and use Pandas Dataframes a lot. My question is 
regarding the difference in calling out a specific row, column combination in a 
dataframe.

I see 3 ways of doing this:
(1) df.loc[row_ind, column_ind]
(2) df.column_ind.loc[row_ind]
(3) df[column_ind].loc[row_ind]

where column_ind is the column name & row_ind is the named row index/row name 
in the dataframe.

Can anyone enlighten me as to the differences between the above 3 methods of 
getting to the same cell in the dataframe? 
Are there speed differences? 
Is it simply a preference thing? 
Is there a PEP8 preferred way of doing this?
Are there specific disadvantages to any of the methods?

Thanks in advance.
Zach
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29335] subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-23 Thread Zach Riggle

Zach Riggle added the comment:

Neat, though that's not in the standard library.

The current logic for getting a handle to libc could also be simplified via 
ctypes.util.find_library 
(https://docs.python.org/3/library/ctypes.html#finding-shared-libraries).

Darwin:

>>> import ctypes.util
>>> ctypes.util.find_library('c')
'/usr/lib/libc.dylib'

Linux:

>>> import ctypes.util
>>> ctypes.util.find_library('c')
'libc.so.6'

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29335>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29335] subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-23 Thread Zach Riggle

Zach Riggle added the comment:

Of note, there's no need to actually cause a SIGSEGV to generate the signal.

The tests might be more clear to replace:

libc.printf(ctypes.c_char_p(0xdeadbeef))

with

os.kill(os.getpid(), signal.SIGSEGV)

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29335>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29335] Python 2.7 subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-21 Thread Zach Riggle

Zach Riggle added the comment:

To further clarify the report:

When the attached proof-of-concept is executed, a RuntimeException is raised, 
which has a comment "Should never happen".

The issue isn't due to SIGCHLD, but rather following a waitpid() call.  The 
code attempts to suss the exit code / reason for waitpid() returning, but does 
not check for WIFSTOPPED in its handler.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29335>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29335] Python 2.7 subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-20 Thread Zach Riggle

New submission from Zach Riggle:

The attached script hits some "This should never happen" code in the subprocess 
module.

These lines here:
https://github.com/python/cpython/blob/2.7/Lib/subprocess.py#L1036-L1038

The root cause is a lack of checking WIFSTOPPED and WSTOPSIG in the handler.

When a process elects into being ptraced via PTRACE_TRACEME, it is stopped on 
the SIGSEGV instead of terminating, allowing the user to attach a debugger 
before the kernel destroys the process.

This bug makes it impossible to wait on any process which crashes, which is set 
up to wait for a debugger.

--
components: Library (Lib)
files: bug.py
messages: 285921
nosy: Zach Riggle
priority: normal
severity: normal
status: open
title: Python 2.7 subprocess module does not check WIFSTOPPED on SIGCHLD
versions: Python 2.7
Added file: http://bugs.python.org/file46363/bug.py

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29335>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26280] ceval: Optimize list

2016-02-29 Thread Zach Byrne

Zach Byrne added the comment:

The new patch "subscr2" removes the tuple block, and addresses Victor's 
comments. This one looks a little faster, down to 0.0215 usec for the same test.

--
Added file: http://bugs.python.org/file42049/subscr2.patch

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26280>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26280] ceval: Optimize list

2016-02-18 Thread Zach Byrne

Zach Byrne added the comment:

Is it worth handling the exception, or just let it take the slow path and get 
caught by PyObject_GetItem()? We're still making sure the index is in bounds.

Also, where would be an appropriate place to put a macro for adjusting negative 
indices?

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26280>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26280] ceval: Optimize list[int] (subscript) operation similarly to CPython 2.7

2016-02-16 Thread Zach Byrne

Zach Byrne added the comment:

Here's a patch that looks likes Victor's from the duplicate, but with tuples 
covered as well. I ran some straight forward micro benchmarks but haven't 
bothered running the benchmark suite yet. Unsurprisingly, optimized paths are 
faster, and the others take a penalty.

[0]byrnez@byrnez-laptop:~/git/python$ ./python.orig -m timeit -s "l = 
[1,2,3,4,5,6]" "l[3]"
1000 loops, best of 3: 0.0306 usec per loop
[0]byrnez@byrnez-laptop:~/git/python$ ./python -m timeit -s "l = [1,2,3,4,5,6]" 
"l[3]"
1000 loops, best of 3: 0.0243 usec per loop

[0]byrnez@byrnez-laptop:~/git/python$ ./python.orig -m timeit -s "l = 
(1,2,3,4,5,6)" "l[3]"
1000 loops, best of 3: 0.0291 usec per loop
[0]byrnez@byrnez-laptop:~/git/python$ ./python -m timeit -s "l = (1,2,3,4,5,6)" 
"l[3]"
1000 loops, best of 3: 0.0241 usec per loop

[0]byrnez@byrnez-laptop:~/git/python$ ./python.orig -m timeit -s "l = 
'asdfasdf'" "l[3]"
1000 loops, best of 3: 0.034 usec per loop
[0]byrnez@byrnez-laptop:~/git/python$ ./python -m timeit -s "l = 'asdfasdf'" 
"l[3]"
1000 loops, best of 3: 0.0366 usec per loop

[0]byrnez@byrnez-laptop:~/git/python$ ./python.orig -m timeit -s "l = 
[1,2,3,4,5,6]" "l[:3]"
1000 loops, best of 3: 0.124 usec per loop
[0]byrnez@byrnez-laptop:~/git/python$ ./python -m timeit -s "l = [1,2,3,4,5,6]" 
"l[:3]"
1000 loops, best of 3: 0.125 usec per loop

--
Added file: http://bugs.python.org/file41939/subscr1.patch

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26280>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26280] ceval: Optimize [] operation similarly to CPython 2.7

2016-02-05 Thread Zach Byrne

Zach Byrne added the comment:

I'm attaching output from a selection of the benchmarks, I'm counting 
non-builtins and slices, but for everything, not just lists and tuples.

Quick observation: math workloads seem list heavy, text workloads seem dict 
heavy, and tuples are usually somewhere in the middle.

--
Added file: http://bugs.python.org/file41826/subscr_stats.txt

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26280>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26280] ceval: Optimize [] operation similarly to CPython 2.7

2016-02-04 Thread Zach Byrne

Zach Byrne added the comment:

Ok, I've started on the instrumenting, thanks for that head start, that would 
have taken me a while to figure out where to call the stats dump function from. 
Fun fact: BINARY_SUBSCR is called 717 starting python.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26280>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26280] ceval: Optimize [] operation similarly to CPython 2.7

2016-02-04 Thread Zach Byrne

Zach Byrne added the comment:

I'll put together something comprehensive in a bit, but here's a quick preview:

$ ./python
Python 3.6.0a0 (default, Feb  4 2016, 20:08:03) 
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
Total BINARY_SUBSCR calls: 726
List BINARY_SUBSCR calls: 36
Tuple BINARY_SUBSCR calls: 103
Dict BINARY_SUBSCR calls: 227
Unicode BINARY_SUBSCR calls: 288
Bytes BINARY_SUBSCR calls: 68
[-1] BINARY_SUBSCR calls: 0

$ python bm_elementtree.py -n 100 --timer perf_counter
...[snip]...
Total BINARY_SUBSCR calls: 1078533
List BINARY_SUBSCR calls: 513
Tuple BINARY_SUBSCR calls: 1322
Dict BINARY_SUBSCR calls: 1063075
Unicode BINARY_SUBSCR calls: 13150
Bytes BINARY_SUBSCR calls: 248
[-1] BINARY_SUBSCR calls: 0

Lib/test$ ../../python -m unittest discover
...[snip]...^C <== I got bored waiting
KeyboardInterrupt
Total BINARY_SUBSCR calls:  4732885
List BINARY_SUBSCR calls:   1418730
Tuple BINARY_SUBSCR calls:  1300717
Dict BINARY_SUBSCR calls:   1151766
Unicode BINARY_SUBSCR calls: 409924
Bytes BINARY_SUBSCR calls:   363029
[-1] BINARY_SUBSCR calls: 26623

So dict seems to be the winner here

--
keywords: +patch
Added file: http://bugs.python.org/file41814/26280_stats.diff

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26280>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26280] ceval: Optimize [] operation similarly to CPython 2.7

2016-02-04 Thread Zach Byrne

Zach Byrne added the comment:

One thing I forgot to do was count slices.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26280>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26280] ceval: Optimize [] operation similarly to CPython 2.7

2016-02-03 Thread Zach Byrne

Zach Byrne added the comment:

Yury,
Are you going to tackle this one, or would you like me to?

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26280>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21955] ceval.c: implement fast path for integers with a single digit

2016-02-03 Thread Zach Byrne

Zach Byrne added the comment:

> Could you please take a look at the updated patch?
Looks ok to me, for whatever that's worth.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21955>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21955] ceval.c: implement fast path for integers with a single digit

2016-02-03 Thread Zach Byrne

Zach Byrne added the comment:

> I don't understand what this table means (why 4 columns?). Can you explain 
> what you did?

Yury suggested running perf.py twice with the binaries swapped
So "faster" and "slower" underneath "Baseline Reference" are runs where the 
unmodified python binary was the first argument to perf, and the "Modified 
Reference" is where the patched binary is the first argument.

ie. "perf.py -r -b all python patched_python" vs "perf.py -r -b all 
patched_python python"

bench_results.txt has the actual output in it, and the "slower in the right 
column" comment was referring to the contents of that file, not the table. 
Sorry for the confusion.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21955>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21955] ceval.c: implement fast path for integers with a single digit

2016-02-03 Thread Zach Byrne

Zach Byrne added the comment:

I ran 6 benchmarks on my work machine(not the same one as the last set) 
overnight.
Two with just the BINARY_ADD change, two with the BINARY_SUBSCR change, and two 
with both.
I'm attaching the output from all my benchmark runs, but here are the highlights
In this table I've flipped the results for running the modified build as the 
reference, but in the new attachment, slower in the right column means faster, 
I think :)
|--|---|---|
|Build | Baseline Reference| Modified Reference 
   |
|--||--||--|
|  | Faster | Slower   | Faster 
| Slower   |
|--||--||--|
|BINARY_ADD| chameleon_v2   | etree_parse  | chameleon_v2   
| call_simple  |
|  | chaos  | nbody| fannkuch   
| nbody|
|  | django | normal_startup   | normal_startup 
| pickle_dict  |
|  | etree_generate | pickle_dict  | nqueens
| regex_v8 |
|  | fannkuch   | pickle_list  | regex_compile  
|  |
|  | formatted_logging  | regex_effbot | spectral_norm  
|  |
|  | go |  | unpickle_list  
|  |
|  | json_load  |  |
|  |
|  | regex_compile  |  |
|  |
|  | simple_logging |  |
|  |
|  | spectral_norm  |  |
|  |
|--||--||--|
|BINARY_SUBSCR | chameleon_v2   | call_simple  | 2to3   
| etree_parse  |
|  | chaos  | go   | call_method_slots  
| json_dump_v2 |
|  | etree_generate | pickle_list  | chaos  
| pickle_dict  |
|  | fannkuch   | telco| fannkuch   
|  |
|  | fastpickle |  | formatted_logging  
|  |
|  | hexiom2|  | go 
|  |
|  | json_load  |  | hexiom2
|  |
|  | mako_v2|  | mako_v2
|  |
|  | meteor_contest |  | meteor_contest 
|  |
|  | nbody  |  | nbody  
|  |
|  | regex_v8   |  | normal_startup 
|  |
|  | spectral_norm  |  | nqueens
|  |
|  ||  | pickle_list
|  |
|  ||  | simple_logging 
|  |
|  ||  | spectral_norm  
|  |
|  ||  | telco  
|  |
|--||--||--|
|BOTH  | chameleon_v2   | call_simple  | chameleon_v2   
| fastpickle   |
|  | chaos  | etree_parse  | choas  
| pickle_dict  |
|  | etree_generate | pathlib  | etree_generate 
| pickle_list  |
|  | etree_process  | pickle_list  | etree_process  
| telco|
|  | fannkuch   |  | fannkuch   
|  |
|  | fastunpickle   |  | float  
|  |
|  | float  |  | formatted_logging  
|  |
|  | formatted_logging  |  | go 
|  |
|  | hexiom2|  | hexiom2
|  |
|  | nbody  |  | nbody  
|  |
|  | nqueens|  | normal_startup 
|  |
|  | regex_v8   |  | nqueens
|  |
|  | spectral_norm

[issue21955] ceval.c: implement fast path for integers with a single digit

2016-02-02 Thread Zach Byrne

Zach Byrne added the comment:

I took another look at this, and tried applying it to 3.6 and running the 
latest benchmarks. It applied cleanly, and the benchmark results were similar, 
this time unpack_sequence and spectral_norm were slower. Spectral norm makes 
sense, it's doing lots of FP addition. The unpack_sequence instruction looks 
like it already has optimizations for unpacking lists and tuples onto the 
stack, and running dis on the test showed that it's completely dominated calls 
to unpack_sequence, load_fast, and store_fast so I still don't know what's 
going on there.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21955>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21955] ceval.c: implement fast path for integers with a single digit

2016-01-11 Thread Zach Byrne

Zach Byrne added the comment:

Anybody still looking at this? I can take another stab at it if it's still in 
scope.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21955>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21955] ceval.c: implement fast path for integers with a single digit

2016-01-11 Thread Zach Byrne

Zach Byrne added the comment:

> Can you figure why unpack_sequence and other benchmarks were slower?
I didn't look really closely, A few of the slower ones were floating point 
heavy, which would incur the slow path penalty, but I can dig into 
unpack_sequence.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21955>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24499] Python Installer text piles up during installation process

2015-06-24 Thread Zach “The Quantum Mechanic” W

New submission from Zach “The Quantum Mechanic” W:

A minor visual bug that causes text to pile up in the installer window. 
Installation finished, python seems to run fine.

Operating System: Windows 8.1 64x
Installer: Python 3.5.0b2

--
components: Installation
files: python_installer_visual_error.png
messages: 245759
nosy: Zach “The Quantum Mechanic” W
priority: normal
severity: normal
status: open
title: Python Installer text piles up during installation process
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file39801/python_installer_visual_error.png

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24499
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21955] ceval.c: implement fast path for integers with a single digit

2015-03-18 Thread Zach Byrne

Zach Byrne added the comment:

I haven't looked at it since I posted the benchmark results for 21955_2.patch.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21955
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Python Requests logging 401 immediately before 200

2015-02-20 Thread Zach Dunlap
Hi everyone,

I'm using MarkLogic and have a Python script set up to check for documents 
using Requests (http://docs.python-requests.org/en/latest/) and I have logging 
included in the script.

I have logging set to the DEBUG level.

When I set the script to simple search and return the HTTP status code for 
items it works, but when I look at what is generated by logging I see the 
following for everything:

INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 
localhost
DEBUG:requests.packages.urllib3.connectionpool:GET 
/v1/documents?uri=000248e4331d4db5856df8fd427b3cdb.xml HTTP/1.1 401 211
DEBUG:requests.packages.urllib3.connectionpool:GET 
/v1/documents?uri=000248e4331d4db5856df8fd427b3cdb.xml HTTP/1.1 200 18327

As you can see the 400 and the 200 are the same document (only 1 can exist in 
ML with the same URI) and in MarkLogic's logs both are executed at the same 
time.

When I search for a document using something like CURL for instance, I only get 
the 200 status code which seems correct to me.

Is this something I should be concerned about and should fix or is it just the 
log level I have set or something else I shouldn't worry about?

Thank you for your help!

Here's a snipped of my code in case it helps:

import requests
import logging

# initiate logging
log_path = os.path.join('my_log.log')
logging.basicConfig(filename=log_path,level=logging.DEBUG)

# make request
r = 
requests.get('http://localhost:8004/v1/documents?uri=000248e4331d4db5856df8fd427b3cdb.xml',auth=HTTPDigestAuth('USER',
 'PASSWORD'))

print r.status_code
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Requests logging 401 immediately before 200

2015-02-20 Thread Zach Dunlap
On Friday, February 20, 2015 at 12:31:00 PM UTC-5, Chris Angelico wrote:
 On Sat, Feb 21, 2015 at 4:16 AM, Zach Dunlap zrdun...@gmail.com wrote:
  INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection 
  (1): localhost
  DEBUG:requests.packages.urllib3.connectionpool:GET 
  /v1/documents?uri=000248e4331d4db5856df8fd427b3cdb.xml HTTP/1.1 401 211
  DEBUG:requests.packages.urllib3.connectionpool:GET 
  /v1/documents?uri=000248e4331d4db5856df8fd427b3cdb.xml HTTP/1.1 200 18327
 
  As you can see the 400 and the 200 are the same document (only 1 can exist 
  in ML with the same URI) and in MarkLogic's logs both are executed at the 
  same time.
 
  Is this something I should be concerned about and should fix or is it just 
  the log level I have set or something else I shouldn't worry about?
 
  r = 
  requests.get('http://localhost:8004/v1/documents?uri=000248e4331d4db5856df8fd427b3cdb.xml',auth=HTTPDigestAuth('USER',
   'PASSWORD'))
 
 
 Short explanation: It's part of the protocol.
 
 You're using Digest Auth, so what's happening here is that a request
 is sent without the authentication, and the inevitable 401 response is
 the signal that the request should be re-sent with credentials.
 
 There's a massive debate as to whether or not it's correct to send
 unsolicited credentials. On the one hand, this 401 then 200 pattern
 takes extra internet round-trips (not that that's a big deal with
 localhost, but it's the same issue everywhere) and puts extra load on
 both server and client; but on the other hand, nobody wants their
 credentials sent to the wrong server, and it's not always easy to tell
 when they'll be needed. Without the 401, you can't know whether or not
 you need to authenticate, so if once you start sending unsolicited
 credentials, you basically have to keep on doing so.
 
 If you don't have a problem with performance or latency, then consider
 this to be nothing more than a bit of log file spam. I'm not sure if
 the Python requests module can be easily configured to send
 credentials on the first query, but my advice is: don't even bother
 looking into that unless you have need to.
 
 All the best!
 
 ChrisA

Thanks very much for this it's extremely helpful! This clears it up and I think 
I will ignore it as log spam as you suggest.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23199] libpython27.a in amd64 release is 32-bit

2015-01-20 Thread Zach Welch

Zach Welch added the comment:

That's certainly an interesting data point.  We are just beginning to use 
MinGW-w64 internally, so I do not have enough experience to confirm or deny 
that advice.  For various reasons, we must use cross-compiling on a Linux host, 
so the advice to use a native compiler is moot for our situation.

Certainly, documenting the absense of the 64-bit library would be good.  
Providing a documented script to generate one is better.  Providing the library 
would be ideal, if there will not be forward compatibility or runtime issues.

It would be nice to see concrete details about the current state of affairs.  
The cython project's warning would carry more weight with me if it contained 
links to specific details: mailing list discussion that led to the deliberate 
decision to omit the 64-bit library, bug reports filed against the mingw-w64 
project about the runtime issues, etc..  That said, such details probably do 
exist, but my cursory searching has failed to turn them up.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23199
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23199] libpython27.a in amd64 release is 32-bit

2015-01-19 Thread Zach Welch

Zach Welch added the comment:

Yes, pe-i386 and pe-x86-64 are the respective 32-bit and 64-bit object formats.

Your commands seem reasonable.  With gendef, I just let it create a .def file 
with the same name (i.e. skip the '-' and redirection); in my mind, that 
reinforces the association between the dll and def files.  With dlltool, I did 
not have to use the -m flag (as x86-64 is the default for me), but I don't see 
anything wrong with being explicit.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23199
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23199] libpython27.a in amd64 release is 32-bit

2015-01-12 Thread Zach Welch

Zach Welch added the comment:

The libpython27.a is an actual 32-bit version, as confirmed by running objdump 
-t on it.  It reports the sections' file format as pe-i386 instead of 
pe-x86-64.  I am only using it for building for the 64-bit target, so I cannot 
confirm its viability for 32-bit builds.

To build 64-bit Windows binaries, you need a MinGW-w64 toolchain (which is a 
completely separate project from the original MinGW project).  The target 
triplet is x86_64-w64-mingw32.

I cannot speak to the stability of the MinGW-w64 library interface, but I would 
expect it to be stable.  To wit, I would be shocked if future changes required 
regeneration of third-party .a files.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23199
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23199] libpython27.a in amd64 release is 32-bit

2015-01-08 Thread Zach Welch

New submission from Zach Welch:

I tried to link a program against the libpython27.a provided by the latest 
2.7.9 amd64 installer, only to discover that the provided library is a 32-bit 
version.  I had to go through the gendef/dlltool dance in order to produce a 
useable 64-bit library from the DLL.

--
components: Library (Lib), Windows
messages: 233702
nosy: steve.dower, tim.golden, zach.ware, zwelch
priority: normal
severity: normal
status: open
title: libpython27.a in amd64 release is 32-bit
type: compile error
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23199
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21955] ceval.c: implement fast path for integers with a single digit

2014-07-23 Thread Zach Byrne

Zach Byrne added the comment:

I ran the whole benchmark suite. There are a few that are slower: 
call_method_slots, float, pickle_dict, and unpack_sequence.

Report on Linux zach-vbox 3.2.0-24-generic-pae #39-Ubuntu SMP Mon May 21 
18:54:21 UTC 2012 i686 i686
Total CPU cores: 1

### 2to3 ###
24.789549 - 24.809551: 1.00x slower

### call_method_slots ###
Min: 1.743554 - 1.780807: 1.02x slower
Avg: 1.751735 - 1.792814: 1.02x slower
Significant (t=-26.32)
Stddev: 0.00576 - 0.01823: 3.1660x larger

### call_method_unknown ###
Min: 1.828094 - 1.739625: 1.05x faster
Avg: 1.852225 - 1.806721: 1.03x faster
Significant (t=2.28)
Stddev: 0.01874 - 0.24320: 12.9783x larger

### call_simple ###
Min: 1.353581 - 1.263386: 1.07x faster
Avg: 1.397946 - 1.302046: 1.07x faster
Significant (t=24.28)
Stddev: 0.03667 - 0.03154: 1.1629x smaller

### chaos ###
Min: 1.199377 - 1.115550: 1.08x faster
Avg: 1.230859 - 1.146573: 1.07x faster
Significant (t=16.24)
Stddev: 0.02663 - 0.02525: 1.0544x smaller

### django_v2 ###
Min: 2.682884 - 2.633110: 1.02x faster
Avg: 2.747521 - 2.690486: 1.02x faster
Significant (t=9.90)
Stddev: 0.02744 - 0.03010: 1.0970x larger

### fastpickle ###
Min: 1.751475 - 1.597340: 1.10x faster
Avg: 1.771805 - 1.613533: 1.10x faster
Significant (t=64.81)
Stddev: 0.01177 - 0.01263: 1.0727x larger

### float ###
Min: 1.254858 - 1.293067: 1.03x slower
Avg: 1.336045 - 1.365787: 1.02x slower
Significant (t=-3.30)
Stddev: 0.04851 - 0.04135: 1.1730x smaller

### json_dump_v2 ###
Min: 17.871819 - 16.968647: 1.05x faster
Avg: 18.428747 - 17.483397: 1.05x faster
Significant (t=4.10)
Stddev: 1.60617 - 0.27655: 5.8078x smaller

### mako ###
Min: 0.241614 - 0.231678: 1.04x faster
Avg: 0.253730 - 0.240585: 1.05x faster
Significant (t=8.93)
Stddev: 0.01912 - 0.01327: 1.4417x smaller

### mako_v2 ###
Min: 0.225664 - 0.213179: 1.06x faster
Avg: 0.234850 - 0.225984: 1.04x faster
Significant (t=10.12)
Stddev: 0.01379 - 0.01391: 1.0090x larger

### meteor_contest ###
Min: 0.777612 - 0.758924: 1.02x faster
Avg: 0.799580 - 0.780897: 1.02x faster
Significant (t=3.97)
Stddev: 0.02482 - 0.02212: 1.1221x smaller

### nbody ###
Min: 0.969724 - 0.883935: 1.10x faster
Avg: 0.996416 - 0.918375: 1.08x faster
Significant (t=12.65)
Stddev: 0.02426 - 0.03627: 1.4951x larger

### nqueens ###
Min: 1.142745 - 1.128195: 1.01x faster
Avg: 1.296659 - 1.162443: 1.12x faster
Significant (t=2.75)
Stddev: 0.34462 - 0.02680: 12.8578x smaller

### pickle_dict ###
Min: 1.433264 - 1.467394: 1.02x slower
Avg: 1.468122 - 1.506908: 1.03x slower
Significant (t=-7.20)
Stddev: 0.02695 - 0.02691: 1.0013x smaller

### raytrace ###
Min: 5.454853 - 5.538799: 1.02x slower
Avg: 5.530943 - 5.676983: 1.03x slower
Significant (t=-8.64)
Stddev: 0.05152 - 0.10791: 2.0947x larger

### regex_effbot ###
Min: 0.205875 - 0.194776: 1.06x faster
Avg: 0.28 - 0.198759: 1.06x faster
Significant (t=5.10)
Stddev: 0.01305 - 0.01112: 1.1736x smaller

### regex_v8 ###
Min: 0.141628 - 0.133819: 1.06x faster
Avg: 0.147024 - 0.140053: 1.05x faster
Significant (t=2.72)
Stddev: 0.01163 - 0.01388: 1.1933x larger

### richards ###
Min: 0.734472 - 0.727501: 1.01x faster
Avg: 0.760795 - 0.743484: 1.02x faster
Significant (t=3.50)
Stddev: 0.02778 - 0.02127: 1.3061x smaller

### silent_logging ###
Min: 0.344678 - 0.336087: 1.03x faster
Avg: 0.357982 - 0.347361: 1.03x faster
Significant (t=2.76)
Stddev: 0.01992 - 0.01852: 1.0755x smaller

### simple_logging ###
Min: 1.104831 - 1.072921: 1.03x faster
Avg: 1.146844 - 1.117068: 1.03x faster
Significant (t=4.02)
Stddev: 0.03552 - 0.03848: 1.0833x larger

### spectral_norm ###
Min: 1.710336 - 1.688910: 1.01x faster
Avg: 1.872578 - 1.738698: 1.08x faster
Significant (t=2.35)
Stddev: 0.40095 - 0.03331: 12.0356x smaller

### tornado_http ###
Min: 0.849374 - 0.852209: 1.00x slower
Avg: 0.955472 - 0.916075: 1.04x faster
Significant (t=4.82)
Stddev: 0.07059 - 0.04119: 1.7139x smaller

### unpack_sequence ###
Min: 0.30 - 0.20: 1.52x faster
Avg: 0.000164 - 0.000174: 1.06x slower
Significant (t=-13.11)
Stddev: 0.00011 - 0.00013: 1.2256x larger

### unpickle_list ###
Min: 1.333952 - 1.212805: 1.10x faster
Avg: 1.373228 - 1.266677: 1.08x faster
Significant (t=16.32)
Stddev: 0.02894 - 0.03597: 1.2428x larger

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21955
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21955] ceval.c: implement fast path for integers with a single digit

2014-07-21 Thread Zach Byrne

Zach Byrne added the comment:

I did something similar to BINARY_SUBSCR after looking at the 2.7 source as 
Raymond suggested. Hopefully I got my binaries straight this time :) The new 
patch includes Victor's inlining and my new subscript changes.

Platform of campaign orig:
Python version: 3.5.0a0 (default:c8ce5bca0fcd+, Jul 15 2014, 18:11:28) [GCC 
4.6.3]
Timer precision: 6 ns
Date: 2014-07-21 20:28:30

Platform of campaign patch:
Python version: 3.5.0a0 (default:c8ce5bca0fcd+, Jul 21 2014, 20:21:20) [GCC 
4.6.3]
Timer precision: 20 ns
Date: 2014-07-21 20:28:39

-+-+---
Tests    |    orig |  patch
-+-+---
1+2  |  118 ns (*) |  103 ns (-13%)
1+2 ran 100 times  | 7.28 us (*) | 5.93 us (-19%)
x[1] |  120 ns (*) |   98 ns (-19%)
x[1] ran 100 times | 7.35 us (*) | 5.31 us (-28%)
-+-+---
Total    | 14.9 us (*) | 11.4 us (-23%)
-+-+---

--
Added file: http://bugs.python.org/file36021/21955_2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21955
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21955] ceval.c: implement fast path for integers with a single digit

2014-07-16 Thread Zach Byrne

Zach Byrne added the comment:

Well, dont' I feel silly. I confirmed both my regression and the inline speedup 
using the benchmark Victor added. I wonder if I got my binaries backwards in my 
first test...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21955
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21955] ceval.c: implement fast path for integers with a single digit

2014-07-15 Thread Zach Byrne

Zach Byrne added the comment:

So I'm trying something pretty similar to Victor's pseudo-code and just using 
timeit to look for speedups
timeit('x+x', 'x=10', number=1000)
before:
1.193423141393
1.1988609210002323
1.1998214110003573
1.206968028999654
1.2065417159997196

after:
1.1698650090002047
1.170515890227
1.1752884750003432
1.174481861933
1.1741297110002051
1.176042264782

Small improvement. Haven't looked at optimizing BINARY_SUBSCR yet.

--
keywords: +patch
nosy: +zbyrne
Added file: http://bugs.python.org/file35961/21955.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21955
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21323] CGI HTTP server not running scripts from subdirectories

2014-07-11 Thread Zach Byrne

Zach Byrne added the comment:

Done and done.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21323] CGI HTTP server not running scripts from subdirectories

2014-07-08 Thread Zach Byrne

Zach Byrne added the comment:

Hi, I'm new. I wrote a test for nested directories under cgi-bin and got that 
to pass without failing the test added for 19435 by undoing most of the changes 
to run_cgi() but building path from the values in self.cgi_info. Thoughts?

--
keywords: +patch
nosy: +zbyrne
Added file: http://bugs.python.org/file35908/21323.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16333] Trailing whitespace in json dump when using indent

2012-10-28 Thread Zach Mathew

Zach Mathew added the comment:

To Ezio's first point ... yes, I was wondering if trailing whitespace should be 
left alone in the case of an explicitly defined separator. However, this 
behavior seems a little odd to me as I don't see a use case for it (happy to 
change the patch if there are differing opinions on this).

Keep in mind that the patch does retain the *leading* white space (for both 
default and explicit separators) - only trailing whitespace is removed prior to 
newlines.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16333
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16333] Trailing whitespace in json dump when using indent

2012-10-26 Thread Zach Mathew

New submission from Zach Mathew:

When using the indent option in json.JSONEncoder, extra trailing whitespace 
(preceding the newline) is added to list and dict items.

For example:

 import json
 json.dumps(['foo', 'bar'], indent=1)
'[\n foo, \n bar\n]'

Notice the blank space between foo, and \n

EXPECTED OUTPUT:

'[\n foo,\n bar\n]'

--
components: Library (Lib)
files: fix_json_trailing_space_and_tests.patch
keywords: patch
messages: 173891
nosy: zmathew
priority: normal
severity: normal
status: open
title: Trailing whitespace in json dump when using indent
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 
3.4, Python 3.5
Added file: 
http://bugs.python.org/file27735/fix_json_trailing_space_and_tests.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16333
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Python IDE/Eclipse

2011-08-26 Thread Zach Dziura
I've honestly always used either PyDev or IDLE. However, Python is pretty easy 
to usd without a big IDE slowing you down, so you could also use a developer's 
text editor like Notepad++ or gedit and still be good.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Function within class and in modules

2011-06-15 Thread Zach Dziura
 On Jun 15, 7:57 am, TheSaint nob...@nowhere.net.no wrote:
 Hello
 sorry, I'm bit curious to understand what could be the difference to pack up
 a class for some number of functions in it and a simple module which I just
 import and use the similar functions?
 The only perspective that I think of is that class might instantiate a
 function several time. For my use I don't have multithread and mostly
 programs are sequencial.

I had a hard time with this at first when I started using Python. I
personally come from a background of using Java in an educational
environment, so I'm pretty familiar with it. Going from a pure
Object-Oriented language, where everything MUST be bundled into a
class, and an Object is less of a bit of data and more of a data
structure that actually DOES something, was a little difficult.

Just repeat this to yourself: Python ISN'T Java. Repeat it until the
words start sounding funny to you. Then continue for another 10
minutes. It'll sink in.

Anyhow... In Python, classes aren't necessarily treated as things
that do stuff (though they can DEFINITELY act in that way!). Python
classes are made to hold data. If you have something that you need to
save for later, put it in a class and call it a day. If you only have
a bunch of functions that are meant to process something, just put
them into a module. You'll save yourself some time, you won't have to
instantiate a class in order to call the functions, and you'll be
happier overall. (I know was happy from being freed from the Pure OO
model that Java shoves down your throat!)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-15 Thread Zach Dziura
On Jun 14, 8:22 pm, zainul franciscus zainul.francis...@gmail.com
wrote:
 Thank you for the reply. I should have mentioned where I am hosting
 the code *doh slap on the wrist.

 I am hosting the code in google 
 code:http://code.google.com/p/mirandafileorganizer/

 There is a link to the user/developer guide on how to get started with
 the 
 software:https://docs.google.com/document/d/1OGvrS5offb27WlkZ5genMJX2El18Aqrnf...

 Just email me directly if you are interested to join the project and I
 will add you as a contributor in Google Code

 Best Wishes

Sounds good, I shall take a look at it when I get home from work. (The
Google Docs domain is blocked here. Curses!)

Just as a tip: on the project's homepage, just write about your
project and what it's features are. Don't write in the first person.
This isn't about you, it's about the project. O=)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-15 Thread Zach Dziura
Also, can I be added to the project? Email is zcdzi...@gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?

2011-06-14 Thread Zach Dziura
 d={'Header2': ['2', '5', '8'], 'Header3': ['3', '6', '9'],
     'Header1': ['1', '4', '7'], 'Header4': ['10', '11', '12']}

 arr = []
 for key,value in d.items():
      line = ['{:10s}'.format(key)]
      for num in value:
          line.append('{:10s}'.format(num))
      arr.append(line)

 for line in zip(*arr):
      for item in line:
          print(item, end='')
      print() # newline
  
     Header2   Header3   Header1   Header4
           2         3         1        10
           5         6         4        11
           8         9         7        12

 For zip(*arr) to work properly, each line of arr should have the same
 length, which means that either each value of d has the same length or
 that you find the max length and pad lines with blanks up to the max
 length. The code above assumes the first.

 If the items in each value of d are not strings, more fiddling is
 needed. The printed field size is also arbitrary. It needs adjusting for
 the actual max length. You might want to adjust it for each key-value
 pair in the dict, which is to say, each column of the resulting table.

 --
 Terry Jan Reedy

I just have one quick question. On the line where you have zip(*arr),
what is the * for? Is it like the pointer operator, such as with C? Or
is it exactly the pointer operator?

Otherwise, thank you for the example! This isn't homework, but I'm
working on something at work, and I was wondering how to properly
format the output from CSV files into another file. It's all a part of
an analyzer script for database tables, and the table wherein. Thank
you a bunch for the help!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-18 Thread Zach
Cobra seems to similar to python. Or it at least compares itself to python.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-18 Thread Zach
Anyone have thoughts on Cobra?
On Jan 18, 2011 4:20 PM, Zach taylo...@gmail.com wrote:
 Cobra seems to similar to python. Or it at least compares itself to
python.
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-06 Thread Zach Dwiel

Zach Dwiel zdw...@gmail.com added the comment:

Here is the terminal log of what happens when I try to install and then import 
regex.  Any ideas what is going on?

$ python setup.py install
running install
running build
running build_py
creating build
creating build/lib.linux-i686-2.6
copying Python2/regex.py - build/lib.linux-i686-2.6
copying Python2/_regex_core.py - build/lib.linux-i686-2.6
running build_ext
building '_regex' extension
creating build/temp.linux-i686-2.6
creating build/temp.linux-i686-2.6/Python2
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall 
-Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c Python2/_regex.c -o 
build/temp.linux-i686-2.6/Python2/_regex.o
Python2/_regex.c:109: warning: ‘struct RE_State’ declared inside parameter list
Python2/_regex.c:109: warning: its scope is only this definition or 
declaration, which is probably not what you want
Python2/_regex.c:110: warning: ‘struct RE_State’ declared inside parameter list
Python2/_regex.c:538: warning: initialization from incompatible pointer type
Python2/_regex.c:539: warning: initialization from incompatible pointer type
Python2/_regex.c:679: warning: initialization from incompatible pointer type
Python2/_regex.c:680: warning: initialization from incompatible pointer type
Python2/_regex.c:1217: warning: initialization from incompatible pointer type
Python2/_regex.c:1218: warning: initialization from incompatible pointer type
Python2/_regex.c: In function ‘try_match’:
Python2/_regex.c:3153: warning: passing argument 1 of 
‘state-encoding-at_boundary’ from incompatible pointer type
Python2/_regex.c:3153: note: expected ‘struct RE_State *’ but argument is of 
type ‘struct RE_State *’
Python2/_regex.c:3184: warning: passing argument 1 of 
‘state-encoding-at_default_boundary’ from incompatible pointer type
Python2/_regex.c:3184: note: expected ‘struct RE_State *’ but argument is of 
type ‘struct RE_State *’
Python2/_regex.c: In function ‘search_start’:
Python2/_regex.c:3535: warning: assignment from incompatible pointer type
Python2/_regex.c:3581: warning: assignment from incompatible pointer type
Python2/_regex.c: In function ‘basic_match’:
Python2/_regex.c:3995: warning: assignment from incompatible pointer type
Python2/_regex.c:3996: warning: assignment from incompatible pointer type
Python2/_regex.c: At top level:
Python2/unicodedata_db.h:241: warning: ‘nfc_first’ defined but not used
Python2/unicodedata_db.h:448: warning: ‘nfc_last’ defined but not used
Python2/unicodedata_db.h:550: warning: ‘decomp_prefix’ defined but not used
Python2/unicodedata_db.h:2136: warning: ‘decomp_data’ defined but not used
Python2/unicodedata_db.h:3148: warning: ‘decomp_index1’ defined but not used
Python2/unicodedata_db.h:: warning: ‘decomp_index2’ defined but not used
Python2/unicodedata_db.h:4122: warning: ‘comp_index’ defined but not used
Python2/unicodedata_db.h:4241: warning: ‘comp_data’ defined but not used
Python2/unicodedata_db.h:5489: warning: ‘get_change_3_2_0’ defined but not used
Python2/unicodedata_db.h:5500: warning: ‘normalization_3_2_0’ defined but not 
used
Python2/_regex.c: In function ‘basic_match’:
Python2/_regex.c:4106: warning: ‘info.captures_count’ may be used uninitialized 
in this function
Python2/_regex.c:4720: warning: ‘info.captures_count’ may be used uninitialized 
in this function
Python2/_regex.c: In function ‘splitter_split’:
Python2/_regex.c:8076: warning: ‘result’ may be used uninitialized in this 
function
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions 
build/temp.linux-i686-2.6/Python2/_regex.o -o build/lib.linux-i686-2.6/_regex.so
running install_lib
copying build/lib.linux-i686-2.6/_regex.so - 
/usr/local/lib/python2.6/dist-packages
copying build/lib.linux-i686-2.6/_regex_core.py - 
/usr/local/lib/python2.6/dist-packages
copying build/lib.linux-i686-2.6/regex.py - 
/usr/local/lib/python2.6/dist-packages
byte-compiling /usr/local/lib/python2.6/dist-packages/_regex_core.py to 
_regex_core.pyc
byte-compiling /usr/local/lib/python2.6/dist-packages/regex.py to regex.pyc
running install_egg_info
Writing /usr/local/lib/python2.6/dist-packages/regex-0.1.20101123.egg-info
$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
Type help, copyright, credits or license for more information.
 import regex
Traceback (most recent call last):
  File stdin, line 1, in module
  File 
/usr/local/lib/python2.6/dist-packages/regex-0.1.20101207-py2.6-linux-i686.egg/regex.py,
 line 273, in module
from _regex_core import *
  File 
/usr/local/lib/python2.6/dist-packages/regex-0.1.20101207-py2.6-linux-i686.egg/_regex_core.py,
 line 54, in module
import _regex
ImportError: 
/usr/local/lib/python2.6/dist-packages/regex-0.1.20101207-py2.6-linux-i686.egg/_regex.so:
 undefined symbol: max

--
nosy: +zdwiel
type: feature request - compile error
versions: +Python 2.6 -Python 3.2

___
Python tracker rep...@bugs.python.org
http

[issue8500] Erroneous Invalid Syntax Error

2010-04-22 Thread Zach Lym

New submission from Zach Lym zach...@indolering.com:

 I love you python
  File stdin, line 1
I love you python
 ^
SyntaxError: invalid syntax


There is nothing invalid about that!

--
components: None
messages: 103973
nosy: indolering
severity: normal
status: open
title: Erroneous Invalid Syntax Error
type: compile error
versions: Python 2.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8500
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Mimicing an HTML form

2009-08-12 Thread Zach Hobesh
Hi all,
I'm having alot of trouble automating the submitting of form.  I have an
HTML page that works and it looks like this:

form action='*script here*' enctype=multipart/form-data method=post
input name=txtTitle id=txtTitle value=Video Title maxlength=50
/BR /
input type=file id=FileUploadedVideo name=FileUploadedVideo /BR /
input name=txtDescription id=txtDescription value=Description
maxlength=50 /BR /
input id=hdnADCID name=hdnADCID value=*app ID here* type=hidden /
input type=submit value=Submit /
/form

When I put valid values for the handling script an app ID, this page works.
 Now I'm trying to turn this same functionality into a script.  Here's my
code:

import urllib
import os
import urllib2

appID = *value here*
video = os.path.normpath(os.getcwd() + '/news.wmv')
title = 'News'
desc = 'Here is a sample News video'

uploader = *script here*

print Encoding url...
data = urllib.urlencode({FileUploadedVideo: video,
 hdnADCID : appID,
 txtTitle : title,
 txtDescription: desc})

user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
headers = { 'User-Agent' : user_agent }


print Calling url...
req = urllib2.Request(uploader, data, headers)

response = urllib2.urlopen(req)
s = response.read()
response.close()

print Writing results...
result = open('result.html','w')
result.write(s)
result.close()

Does anybody have any suggestions?  I keep on getting bad request, so I'm
assuming that the html page is passing something that my script is not.  Is
there some way to scrape the POST request from the html form?

Thanks,

Zach
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Config files with different types

2009-07-03 Thread Zach Hobesh
yaml looks pretty interesting.  Also, I wouldn't have to change much,
I would still use the same function, and still output a dict.

Thanks!

-Zach

On Thu, Jul 2, 2009 at 11:55 PM, Javier Colladojavier.coll...@gmail.com wrote:
 Hello,

 Have you considered using something that is already developed?

 You could take a look at this presentation for an overview of what's 
 available:
 http://us.pycon.org/2009/conference/schedule/event/5/

 Anyway, let me explain that, since I discovered it, my favourite
 format for configuration files is yaml (http://yaml.org/,
 http://pyyaml.org/). It's easy to read, easy to write, available in
 different programming languagues, etc. In addition to this, type
 conversion is already in place so I think it covers your requirement.
 For example:

 IIn [1]: import yaml

 In [2]: yaml.load(name: person name
   ...: age: 25
   ...: is_programmer: true)
 Out[2]: {'age': 25, 'is_programmer': True, 'name': 'person name'}

 Best regards,
    Javier

 2009/7/2 Zach Hobesh hob...@gmail.com:
 Hi all,

 I've written a function that reads a specifically formatted text file
 and spits out a dictionary.  Here's an example:

 config.txt:

 Destination = C:/Destination
 Overwrite = True


 Here's my function that takes 1 argument (text file)

 the_file = open(textfile,'r')
 linelist = the_file.read().split('\n')
 the_file.close()
 configs = {}
 for line in linelist:
       try:
              key,value = line.split('=')
              key.strip()
              value.strip()
              key.lower()
              value.lower()
              configs[key] = value

       except ValueError:
              break

 so I call this on my config file, and then I can refer back to any
 config in my script like this:

 shutil.move(your_file,configs['destination'])

 which I like because it's very clear and readable.

 So this works great for simple text config files.  Here's how I want
 to improve it:

 I want to be able to look at the value and determine what type it
 SHOULD be.  Right now, configs['overwrite'] = 'true' (a string) when
 it might be more useful as a boolean.  Is there a quick way to do
 this?  I'd also like to able to read '1' as an in, '1.0' as a float,
 etc...

 I remember once I saw a script that took a string and tried int(),
 float() wrapped in a try except, but I was wondering if there was a
 more direct way.

 Thanks in advance,

 Zach
 --
 http://mail.python.org/mailman/listinfo/python-list


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


Config files with different types

2009-07-02 Thread Zach Hobesh
Hi all,

I've written a function that reads a specifically formatted text file
and spits out a dictionary.  Here's an example:

config.txt:

Destination = C:/Destination
Overwrite = True


Here's my function that takes 1 argument (text file)

the_file = open(textfile,'r')
linelist = the_file.read().split('\n')
the_file.close()
configs = {}
for line in linelist:
   try:
  key,value = line.split('=')
  key.strip()
  value.strip()
  key.lower()
  value.lower()
  configs[key] = value

   except ValueError:
  break

so I call this on my config file, and then I can refer back to any
config in my script like this:

shutil.move(your_file,configs['destination'])

which I like because it's very clear and readable.

So this works great for simple text config files.  Here's how I want
to improve it:

I want to be able to look at the value and determine what type it
SHOULD be.  Right now, configs['overwrite'] = 'true' (a string) when
it might be more useful as a boolean.  Is there a quick way to do
this?  I'd also like to able to read '1' as an in, '1.0' as a float,
etc...

I remember once I saw a script that took a string and tried int(),
float() wrapped in a try except, but I was wondering if there was a
more direct way.

Thanks in advance,

Zach
-- 
http://mail.python.org/mailman/listinfo/python-list


Executing a python script while it is running

2009-06-16 Thread Zach Hobesh
Hi everybody,

Here's my situation:

I have a batch file that calls a python script.

This batch file is triggered by an outside application when the
application completes a task.  The problem is that while the batch
file (and pythons script) is running, the application will complete
the next task, and try to call the batch file again (while it is
already running)

Hopefully that's not too confusing.

I'm not sure what direction to go with this, any help or nudges in the
RIGHT direction would be greatly appreciated.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Executing a python script while it is running

2009-06-16 Thread Zach Hobesh
 A lot more information would be useful.  What version of Python, and what
 operating system environment?  Exactly what would you like to happen when
 the batch file is invoked a second time?

I'm running Python 2.6.2 on Windows.  I'm passing filenames to the
batch files and I need all filenames to be processed.  I can't have
any fails.  I'm working on logging any fails I do have so that I can
maybe batch process at the end of the day.

  2) let them both run as separate processes

This sounds like a good option, but I'm not totally sure on how to go
about this?

  4) queue something to be processed when the first run finishes

I had the same idea, but I believe it would involve having another
python script run all day long, which wouldn't necessarily be a bad
thing, but I'd like to explore other options as well.

 What provisions does this existing application have for long-running batch
 files?  Seems the synchronization ought to happen there.  Do you have any
 constraints on how long your script might take, worst case?  What if the
 application finishes its tasks at a faster average rate than your script can
 process them?

The batch file is moving large video files.  Duration probably ranges
from 10 sec to 45 mins.  On average, the application takes longer to
process the files than it does the batch file/python script takes to
copy them, but I'm concerned about the occasional time that the
application finishes a small file right after finishing a large file.

Thanks for your response!

-Zach
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Executing a python script while it is running

2009-06-16 Thread Zach Hobesh
On Tue, Jun 16, 2009 at 6:37 PM, Chris Rebertc...@rebertia.com wrote:
 On Tue, Jun 16, 2009 at 6:21 PM, hob...@gmail.com wrote:
 Hey Dave,

 Thanks for the helpful responses.

 Option 2 is what you get by default.  Naturally it depends on what the
 application  is using to launch the batch file, but the most common cases
 will launch a separate process.

 The app ended up delaying starting the second batch file until it finished
 the first. I had the app trigger an infinite loop on completion, and sent
 two files through at the same time. The second file finished seconds after
 the first, but the batch file didn't trigger until I closed the first one.

 Are you sure you aren't unknowingly having the app wait on the first
 batch file process until it terminates? How exactly are you launching
 the batch files?

 Cheers,
 Chris
 --
 http://blog.rebertia.com

Hey Chris,

I actually think that's what's happening, which is fine in my case
(for now anyway) as I just need them all to complete, we don't need
them running at the same time.  I'm using a job management system, and
they have the option of triggering a command line after completing a
job.

A better/safer solution might be spawning another job and re-inserting
to the jms queue.

Thanks again,

Zach
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue2622] Import errors in email.message.py

2009-05-12 Thread Zach Hirsch

Zach Hirsch zhir...@umich.edu added the comment:

I'm not sure if this is the same problem, but it seems related.  I can
get the same ImportError without involving py2exe or modulefinder:

Python 2.5.4 (r254:67916, Feb 18 2009, 03:00:47) 
[GCC 4.3.3] on linux2
Type help, copyright, credits or license for more information.
 import sys
 import email.message
 sys.modules = sys.modules.copy()
 msg = email.message.Message()
 msg['From'] = 'f...@bar.com'
 msg.as_string()
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.5/email/message.py, line 128, in as_string
from email.Generator import Generator
  File /usr/lib/python2.5/email/__init__.py, line 80, in __getattr__
mod = sys.modules[self.__name__]
KeyError: 'email.generator'

If the sys.modules = sys.modules.copy() line is left out, everything
works as expected.

--
nosy: +zhirsch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2622
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



methods and class methods

2009-03-31 Thread Zach Goscha
I just learned python programming and is wondering how to change a method to
a class method. Also what are the differences between a method and class
method.

Thanks in advance
- Zach (Freshman student in High school)
--
http://mail.python.org/mailman/listinfo/python-list


Can't get a simple TCP program to work

2009-03-30 Thread Zach
The following *extremely* simple script complains that Socket is not
connected when I try to call recv. Could anyone provide some quick
guidance?

http://pastebin.com/m64317b32
--
http://mail.python.org/mailman/listinfo/python-list


Problems with code

2009-03-30 Thread Zach Goscha
Hi,

I am trying to call an unbound method (Map.Background) but getting the 
following error:
 TypeError: unbound method background() must be called with Map instance as 
first argument (got nothing instead)

Here is some of the code(not completed) 

Thanks in Advance
- Zach


Code:

class Knight(games.Sprite):
 A moving knight. 
SWORD_DELAY = 50
sword_wait = 0


def update(self):
 moving knight based on keys pressed. 

if games.keyboard.is_pressed(games.K_w):
self.y -= 3
self.angle = 0
if games.keyboard.is_pressed(games.K_s):
self.y += 3
self.angle = 180
if games.keyboard.is_pressed(games.K_a):
self.x -= 3
self.angle = 270
if games.keyboard.is_pressed(games.K_d):
self.x += 3
self.angle = 90

if self.top  games.screen.height:
self.bottom = 0

if self.bottom  0:
self.top = games.screen.height
Map.background()

if self.left  games.screen.width:
self.right = 0

if self.right  0:
self.left = games.screen.width

class Map(games.Sprite):

def background(self):
new_back = games.load_image(map3.jpg,
transparent = False)
games.screen.background = new_back

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


[issue5447] future unicode literals and r'\u'

2009-03-09 Thread Zach Hirsch

Zach Hirsch zhir...@umich.edu added the comment:

I've hit this, too, and it's annoyed me. So here's a patch against trunk
that should fix it. 

The idea is: whenever unicode_literals are turned on (or the -U command
line flag is passed), to convert r\u to \u005c\u0075 and r\U to
\u005c\u0055 for every string literal in the source file before
passing the string to PyUnicode_DecodeRawUnicodeEscape.

--
keywords: +patch
message_count: 2.0 - 3.0
nosy: +zhirsch
nosy_count: 2.0 - 3.0
Added file: http://bugs.python.org/file13280/raw-unicode-literals.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5447
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2889] curses for windows (alternative patch)

2009-03-09 Thread Zach Hirsch

Zach Hirsch zhir...@umich.edu added the comment:

 * test_curses: I'd be happier to see the 'if' statement as sys.platform
 != 'win32' and (not term or term == 'unknown')  -- easier to read.

OK, fixed.

 * test_curses: does putp() make PDCurses crash, or is it not available?
  If the latter, I'd prefer to see 'if hasattr(curses, putp): putp
test'.Same for the tparm() test.

They're stubs in pdcurses that always return an error. I'm not sure
which is better in this case -- make them available through the curses
module but always raise an exception on Windows, or make them
unavailable and have it be an AttributeError if something tries to call
them on Windows.

 * Given that you include term.h and IRIX included term.h, I wonder if we
 should make _cursesmodule.c include term.h on all platforms that have
it, and then fix the resulting breakage claimed by the comment (if any).

Yea, it was actually really easy to resolve the conflicts. I've done
that, and tested the result on Linux and OS X 10.4.

 * Is setupterm() a no-up on Windows?  Maybe the function just shouldn't
 be defined on Windows, then, so that user code can check for the
function's existence.

PDCurses does the same thing for setupterm as it does for putp/tparm
(and a number of other unsupported functions) -- always returns an
error. However, the curses module keeps track of whether it's been
initialized based on whether setupterm has been called, so I think it
makes sense to keep setupterm available but not call PDCurses's
setupterm function on Windows.

--
message_count: 4.0 - 5.0
Added file: http://bugs.python.org/file13282/python-pdcurses-2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2889
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5297] Bug in SocketServer Example

2009-02-17 Thread Zach Dwiel

New submission from Zach Dwiel zdw...@gmail.com:

There is a bug in the example code:
http://docs.python.org/library/socketserver.html

The very last example has the line:

print Server loop running in thread:, t.getName()

should be:

print Server loop running in thread:, server_thread.getName()

Should I post this somewhere else or is this the right place?

--
assignee: georg.brandl
components: Documentation
messages: 82363
nosy: georg.brandl, zdwiel
severity: normal
status: open
title: Bug in SocketServer Example
type: compile error

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5297
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2889] curses for windows (alternative patch)

2009-01-25 Thread Zach Hirsch

Zach Hirsch zhir...@umich.edu added the comment:

Here's a patch against the head of trunk that adds vcproj files for
_curses and _curses_panel, modifies (slightly) the test suite and
_cursesmodule.c (again, slightly) to get Python to work with pdcurses on
windows. I also added a blurb to PCbuild\readme.txt.

With this, test_curses.py passes and I'm able to run all the curses
demos that come with Python's source.

--
keywords: +patch
nosy: +zhirsch
Added file: http://bugs.python.org/file12862/python-pdcurses.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2889
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4120] Do not embed manifest files in *.pyd when compiling with MSVC

2009-01-18 Thread Zach Hirsch

Zach Hirsch zhir...@umich.edu added the comment:

Without msvc9compiler_stripruntimes.diff, or a patch like it, it doesn't
seem possible to use pywin32 (or other binary extensions) with
Python-2.6+ installed just for me (i.e., without the VC90 runtime
installed globally).

Using the python-2.6.1 MSI installed just for me and the pywin32-212
installer, I get the following error when trying to import win32api:

Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 import win32api
Traceback (most recent call last):
  File stdin, line 1, in module
ImportError: DLL load failed: This application has failed to start
because the application configuration is incorrect. Reinstalling the
application may fix this problem.

Removing the manifest from all the .pyd files installed by pywin32
allows me to import win32api without issue.

--
nosy: +zhirsch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4120
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4541] Add str method for removing leading or trailing substrings

2008-12-05 Thread Zach Hirsch

Zach Hirsch [EMAIL PROTECTED] added the comment:

Sounds good to me, except for one thing: define sensible.

To me, lstrips seems sensible, since it's a recurring pattern that I've
used in multiple locations. But perhaps my sense of sensibility is warped :)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4541
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4541] Add str method for removing leading or trailing substrings

2008-12-04 Thread Zach Hirsch

New submission from Zach Hirsch [EMAIL PROTECTED]:

I've found that having a way to strip a leading substring from a string
is convienent. I've also gotten bitten by the fact that str.strip takes
a sequence of characters to remove from the beginning -- not a full string.

I've attached a patch that implements lstrips, rstrips, and strips on
str, unicode, and as methods in the string module. I'm not particularly
attached to the names.

Please consider this patch for inclusion in Python. Thanks!

--
components: Library (Lib)
files: lstrips-67529.patch
keywords: patch
messages: 76953
nosy: zhirsch
severity: normal
status: open
title: Add str method for removing leading or trailing substrings
type: feature request
versions: Python 2.7
Added file: http://bugs.python.org/file12232/lstrips-67529.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4541
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4541] Add str method for removing leading or trailing substrings

2008-12-04 Thread Zach Hirsch

Zach Hirsch [EMAIL PROTECTED] added the comment:

Thanks for taking a look.

Yea, it's pretty easy to write it in Python, but I've found that I've
needed it in quite a few things that I've worked on, so I thought it
might be useful in Python itself.

I've updated the patch to fix the reference leak.

I could imagine someone wanting to strip the same string from both
sides, e.g. -- hello --.strips('--').strip() == hello. It might also
be a good idea to include str.strips for parallelism with str.strip.

Added file: http://bugs.python.org/file12236/lstrips-67529.2.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4541
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Shared script

2008-08-01 Thread Zach Hobesh
I wrote a script that several different people on different machines need to
run on a regular basis.  When I first wrote it, it was in crisis mode, I got
something out that was quick and dirty, very bare bones.  Recently I had
some more time, so I pushed most of the functions that the script uses into
a module, because I use those functions on a pretty regular basis.

My problem is this:

The module is on MY machine in MY Python25 folder.  I like it there, because
like I said, I use the functions within it on a pretty regular basis.
However, the other people who need to run the original script don't have the
module.  My quick fix was to throw the module into the shared folder, which
works, but means everytime I have to update the module I have to update 2
different files, the one in my Python25 folder and the one in the shared
network folder.  Is there a better way to do this, short of asking everybody
else to put the module in thir Python 25 folder (which would mean me
e-mailing them to update the module, and then assuming that they did) ?!?

Thanks,

Zach
--
http://mail.python.org/mailman/listinfo/python-list

Running python scripts in a VB program

2008-07-28 Thread Zach Hobesh
Does anyone have any clue on how to embed python scripts in a visual basic
windows app?

Additionally, does anybody else feel like Visual Basic is ridiculously
confusing?

Any help is appreciated.

Thanks,

-Zach
--
http://mail.python.org/mailman/listinfo/python-list