Where did csv.parser() go?

2018-01-02 Thread jason
I need record the starting offsets of csv rows in a database for fast seeking later. Unfortunately, using any csv.reader() (or DictReader) tries to cache, which means: example_Data = "'data 0123456789ABCDE 1123456789ABCDE 2123456789ABCDE 3123456789ABCDE ... ''' for line in reader: offsets[r

why won't slicing lists raise IndexError?

2017-12-08 Thread Jason Maldonis
I was extending a `list` and am wondering why slicing lists will never raise an IndexError, even if the `slice.stop` value if greater than the list length. Quick example: my_list = [1, 2, 3] my_list[:100] # does not raise an IndexError, but instead returns the full list Is there any background

csv.DictReader line skipping should be considered a bug?

2017-12-05 Thread Jason
I ran into this: https://stackoverflow.com/questions/27707581/why-does-csv-dictreader-skip-empty-lines # unlike the basic reader, we prefer not to return blanks, # because we will typically wind up with a dict full of None # values while iterating over two files, which are line-by-line correspond

Re: Please tell me how to execute python file in Ubuntu by double clicking on file.

2017-12-05 Thread Jason
On Monday, December 4, 2017 at 4:49:11 AM UTC-5, dhananjays...@gmail.com wrote: > Respected Sir/Mam, > I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when i am > double click in python program (Dhananjay.py),it is opening in Text Editor by > Default in Ubuntu.I want to run this pro

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Jason Maldonis
I'll try to summarize what I've learned with a few responses in hodge-podge order and to no one in particular: >That's a feature dude, not a bug. Absolutely. I _do not_ think that how slicing works in python should be changed, but I _do_ want to understand its design decisions because it will mak

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Jason Maldonis
> > >> This is explained in the Python tutorial for strings > >> https://docs.python.org/3/tutorial/introduction.html#strings, as a list > >> is a sequence just like a string it will act in exactly the same way. > >> > > > > The only relevant bit I found in that link is: "However, out of range > >

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Jason Maldonis
> > This is explained in the Python tutorial for strings > https://docs.python.org/3/tutorial/introduction.html#strings, as a list > is a sequence just like a string it will act in exactly the same way. > The only relevant bit I found in that link is: "However, out of range slice indexes are hand

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Jason Maldonis
>Why would this simplify your code? What are you doing that would benefit >from an IndexError here? Without simplifying too much, I'm writing a wrapper around a REST API. I want lazy-loading functionality for lists-of-things, so I am creating a LazyList class. This LazyList class will load items

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Jason Maldonis
> > Have you ever used a language that does that? I have. > The String class in the C# language does that, and it's /really/ annoying. > I have to add extra code to prevent such exceptions. > In practice, I find that the way that Python does it is much nicer. (And > Python isn't unique in this res

why won't slicing lists raise IndexError?

2017-12-04 Thread Jason Maldonis
I was extending a `list` and am wondering why slicing lists will never raise an IndexError, even if the `slice.stop` value if greater than the list length. Quick example: my_list = [1, 2, 3] my_list[:100] # does not raise an IndexError, but instead returns the full list Is there any background

Re: General Purpose Pipeline library?

2017-11-21 Thread Jason
On Monday, November 20, 2017 at 10:49:01 AM UTC-5, Jason wrote: > a pipeline can be described as a sequence of functions that are applied to an > input with each subsequent function getting the output of the preceding > function: > > out = f6(f5(f4(f3(f2(f1(in)) > > Ho

Re: General Purpose Pipeline library? (Posting On Python-List Prohibited)

2017-11-21 Thread Jason
On Monday, November 20, 2017 at 4:02:31 PM UTC-5, Lawrence D’Oliveiro wrote: > On Tuesday, November 21, 2017 at 4:49:01 AM UTC+13, Jason wrote: > > a pipeline can be described as a sequence of functions that are > > applied to an input with each subsequent function getting the ou

General Purpose Pipeline library?

2017-11-20 Thread Jason
a pipeline can be described as a sequence of functions that are applied to an input with each subsequent function getting the output of the preceding function: out = f6(f5(f4(f3(f2(f1(in)) However this isn't very readable and does not support conditionals. Tensorflow has tensor-focused pip

Re: what exactly does type.__call__ do?

2017-11-02 Thread Jason Maldonis
choice -- for the reasons I listed above -- but I would like a more expert opinion (and I'd like to learn why :)). Thanks! Jason On Thu, Nov 2, 2017 at 12:28 AM, Steve D'Aprano wrote: > On Thu, 2 Nov 2017 10:13 am, Jason Maldonis wrote: > > > Hi everyone, > > &

Re: what exactly does type.__call__ do?

2017-11-01 Thread Jason Maldonis
Ok no worries then! Thanks for the tips. I might wait until tomorrow then until someone comes along who deals with metaclasses and alternate class constructors. In case you're curious, I'm doing two things that are relevant here, and I'll link the python3 cookbook examples that are super useful (I

Re: what exactly does type.__call__ do?

2017-11-01 Thread Jason Maldonis
(I'm using python3) @classmethod def normal_constructor(cls, *args, **kwargs): self = cls.__new__(cls) self.__init__(*args, **kwargs) return self On Wed, Nov 1, 2017 at 6:51 PM, Stefan Ram wrote: > Jason Maldonis writes: > >I was looking for documentation for what exac

what exactly does type.__call__ do?

2017-11-01 Thread Jason Maldonis
Hi everyone, I want to use a metaclass to override how class instantiation works. I've done something analogous to using the Singleton metaclass from the Python3 Cookbook example. However, I want to provide a classmethod that allows for "normal" class instantiation that prevents this metaclass fr

Re: multiprocessing shows no benefit

2017-10-20 Thread Jason
Yes, it is a simplification and I am using numpy at lower layers. You correctly observe that it's a simple operation, but it's not a shift it's actually multidimensional vector algebra in numpy. So the - is more conceptual and takes the place of hundreds of subtractions. But the example dies dem

Re: multiprocessing shows no benefit

2017-10-18 Thread Jason
I refactored the map call to break dict_keys into cpu_count() chunks, (so each f() call gets to run continuously over n/cpu_count() items) virtually the same results. pool map is much slower (4x) than regular map, and I don't know why. -- https://mail.python.org/mailman/listinfo/python-list

Re: multiprocessing shows no benefit

2017-10-18 Thread Jason
On Wednesday, October 18, 2017 at 12:14:30 PM UTC-4, Ian wrote: > On Wed, Oct 18, 2017 at 9:46 AM, Jason wrote: > > #When I change line19 to True to use the multiprocessing stuff it all slows > > down. > > > > from multiprocessing import Process, Manager, Pool, cpu_c

Re: multiprocessing shows no benefit

2017-10-18 Thread Jason
#When I change line19 to True to use the multiprocessing stuff it all slows down. from multiprocessing import Process, Manager, Pool, cpu_count from timeit import default_timer as timer def f(a,b): return dict_words[a]-b def f_unpack(args): return f(*args) def init():

Re: multiprocessing shows no benefit

2017-10-18 Thread Jason
I've read the docs several times, but I still have questions. I've even used multiprocessing before, but not map() from it. I am not sure if map() will let me use a common object (via a manager) and if so, how to set that up. -- https://mail.python.org/mailman/listinfo/python-list

multiprocessing shows no benefit

2017-10-17 Thread Jason
I've got problem that I thought would scale well across cores. def f(t): return t[0]-d[ t[1] ] d= {k: np.array(k) for k in entries_16k } e = np.array() pool.map(f, [(e, k) for k in d] At the heart of it is a list of ~16k numpy arrays (32 3D points) which are stored in a single dict. Using

Re: Nested Loop Triangle

2017-05-25 Thread Jason Friedman
> > I need the triangle to be in reverse. The assignment requires a nested > loop to generate a triangle with the user input of how many lines. > > Currently, I get answers such as: (A) > > OOO > OO > O > > When I actually need it to be like this: (B) > > OOO >OO > O > Try the

Re: No module named vtkCommonCorePython

2017-05-20 Thread Jason Friedman
> > I have a problem to finding file in Python path,Anybody knows how to solve > it? > > Unexpected error: > Traceback (most recent call last): > File > "/home/nurzat/Documents/vmtk-build/Install/bin/vmtklevelsetsegmentation", > line 20, in > from vmtk import pypeserver > File "/usr/loca

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2017-05-12 Thread Jason Friedman
> > >> The first section does not do what I think you want: a list with 7 > options. It makes a list with one option, then overwrites it with a new > list with one option, and so on. You want something like: > menu_list = [ > "O - open account" > "L - load details" > "D - display det

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2017-05-12 Thread Jason Friedman
> > menu_list = ["O -open account"] > menu_list =["l - load details"] > menu_list =["D- display details"] > menu_list =["A - Make deposit"] > menu_list =["W- Make withdraw",] > menu_list =["S - save"] > menu_list =["Q - quit"] > > command = input("command:") > if command.upper() == "O": > open_() >

Re: __getattribute__'s error is not available in __getattr__

2017-05-04 Thread Jason Maldonis
Thank you Ethan and Chris for the tips. I may be able to adapt that decorator for my use cases -- I hadn't thought of using something like that. Ethan, I'll drop a note over at Python Ideas too with some details about this. Thanks for your help, Jason On Tue, May 2, 2017 at 9:47

Re: __getattribute__'s error is not available in __getattr__

2017-05-02 Thread Jason Maldonis
-- I.e. if you just remove @property from the first example, it returns the full error stack exactly like we'd expect. That means the @property is changing the call order (?) in some way that I don't understand. Thanks! Jason On Tue, May 2, 2017 at 7:11 PM, Ethan Furman wrote: > On 0

__getattribute__'s error is not available in __getattr__

2017-05-02 Thread Jason Maldonis
letely discarded. So basically I want access to the intermediate AttributeError that caused __getattr__ to be raised in the first place. This is complicated, and I may have explained something poorly. If so, please don't hesitate to ask for more explanation or examples. This is already long, so I'll stop typing now. Thanks, Jason -- https://mail.python.org/mailman/listinfo/python-list

Not understanding itertools.dropwhile()

2017-04-29 Thread Jason Friedman
< start code > import itertools data = """Line1 Line2 Line4 Line5""" def test_to_start(s): return "2" in s for line in itertools.dropwhile(test_to_start, data.splitlines()): print(line) < end code > I expect: $ python3 dropwhile.py Line2 Line4 Line5 I get: $ pyth

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

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

Re: homework confusion

2017-04-12 Thread Jason Friedman
> > The example command is: Lockable("diary", "under Sam's bed", tiny_key, > True) > > And I keep getting a NameError: tiny_key is not defined. > > What do I do? > Without knowing what your professor intends this is a guess: define tiny_key. For example tiny_key = "some string" thing = Lockable

Re: Moderating the list [was: Python and the need for speed]

2017-04-12 Thread Jason Friedman
> > However, it's simply a technical fact: the thing which we moderate is the >> mailing list. We can control which posts make it through from the newsgroup >> by blocking them at the gateway. But the posts will continue to appear on >> comp.lang.python which is, as the description says, unmoderate

Re: Python Command Line Arguments

2017-04-12 Thread Jason Friedman
> > I have this code which I got from https://www.tutorialspoint. > com/python/python_command_line_arguments.htm The example works fine but > when I modify it to what I need, it only half works. The problem is the > try/except. If you don't specify an input/output, they are blank at the end > but i

Re: Online Python Editor with Live Syntax Checking

2017-03-05 Thread Jason Friedman
> > I made a tool called PythonBuddy (http://pythonbuddy.com/). > > I made this so that MOOCs like edX or codecademy could easily embed and > use this on their courses so students wouldn't have to go through the > frustrations of setting up a Python environment and jump right into Python > programm

Re: List comprehension

2016-12-30 Thread Jason Friedman
> data = ( >> ... (1,2), >> ... (3,4), >> ... ) >> > [x,y for a in data] >> File "", line 1 >> [x,y for a in data] >>^ >> SyntaxError: invalid syntax >> >> I expected: >> [(1, 2), (3, 4)] > > > Why would you expect that? I would expect the global variables x and y, or > if

List comprehension

2016-12-30 Thread Jason Friedman
$ python Python 3.6.0 (default, Dec 26 2016, 18:23:08) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> data = ( ... (1,2), ... (3,4), ... ) >>> [a for a in data] [(1, 2), (3, 4)] Now, this puzzles me: >>> [x,y for a in data] File "", line 1 [x

Re: Options for stdin and stdout when using pdb debugger

2016-11-25 Thread Jason Friedman
> I would like to use pdb in an application where it isn't possible to use > sys.stdin for input. I've read in the documentation for pdb.Pdb that a file > object can be used instead of sys.stdin. Unfortunately, I'm not clear about > my options for the file object. > > I've looked at rpdb on PyPI

Re: passing a variable to cmd

2016-11-06 Thread Jason Friedman
> > import subprocess > import shlex > > domname = raw_input("Enter your domain name: "); > print "Your domain name is: ", domname > > print "\n" > > # cmd='dig @4.2.2.2 nbc.com ns +short' > cmd="dig @4.2.2.2 %s ns +short", % (domname) > proc=subprocess.Popen(shlex.split(cmd),stdout=subprocess.PIPE

Need help with coding a function in Python

2016-10-31 Thread devers . meetthebadger . jason
http://imgur.com/a/rfGhK#iVLQKSW How do I code a function that returns a list of the first n elements of the sequence defined in the link? I have no idea! So far this is my best shot at it (the problem with it is that the n that i'm subtracting or adding in the if/else part does not represe

Re: Internet Data Handling » mailbox

2016-10-23 Thread Jason Friedman
> > for message in mailbox.mbox(sys.argv[1]): > if message.has_key("From") and message.has_key("To"): > addrs = message.get_all("From") > addrs.extend(message.get_all("To")) > for addr in addrs: > addrl = addr.lower() >

Re: Stompy

2016-09-25 Thread Jason Friedman
> > My error: >> Traceback (most recent call last): >> File "temp.py", line 8, in >> my_stomp.connect(AMQ_USERNAME, AMQ_PASSWORD) >> File "/lclapps/oppen/thirdparty/stompy/stomp.py", line 48, in connect >> self.frame.connect(self.sock, username=username, password=password, >> clientid=

Stompy

2016-09-25 Thread Jason Friedman
My goal is to send messages to an AMQ server using Python 3.3. I found Stompy and performed 2to3-3.3 before building. I am open to non-Stompy solutions. My code: from stompy.stomp import Stomp my_stomp = Stomp(AMQ_HOST, AMQ_PORT) my_stomp.connect(AMQ_USERNAME, AMQ_PASSWORD) My error: Traceback

multiprocessing.pool.Pool.map should take more than one iterable

2016-08-26 Thread ycm . jason
gnature to `Pool.map(function, iterable, ... [, chunksize])`. This will bring true equivalent to these functions. Tell me what you think. Pool.map: https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.Pool.map map: https://docs.python.org/3/library/functions.html#map Jason

Re: Is Activestate's Python recipes broken?

2016-08-04 Thread Jason Friedman
> > Log in to Activestate: > > https://code.activestate.com/recipes/langs/python/new/ > > and click "Add a Recipe". I get > > > Forbidden > > You don't have permission to access /recipes/add/ on this server. > Apache Server at code.activestate.com Port 443 > > > > Broken for everyone, or just for m

Re: ImportError: Import by filename is not supported when unpickleing

2016-07-27 Thread Jason Benjamin
On Wed, 27 Jul 2016 17:25:43 -0400, Larry Martell wrote: > When I try and unpickle an object with pickle.loads it fails with: > > ImportError: Import by filename is not supported when unpickleing > > I've never used pickle before. Why do I get this and how can I fix it? Try using *pickle.load*

Re: Is it possible to draw a BUTTON?

2016-07-27 Thread Jason Benjamin
On Wed, 27 Jul 2016 13:18:16 -0700, huey.y.jiang wrote: > Hi Folks, > > It is common to put a BUTTON on a canvas by the means of coding. > However, in my application, I need to draw a circle on canvas, and then > make this circle to work as if it is a button. When the circle is > clicked, it trig

Re: Quick poll: gmean or geometric_mean

2016-07-09 Thread Jason Friedman
> > +1 for consistency, but I'm just fine with the short names. It's in the > statistics module after all, so the context is very narrow and clear and > people who don't know which to use or what the one does that they find in a > given piece of code will have to read the docs and maybe fresh up th

View committed code via gitpython

2016-07-01 Thread Jason Bailey
regex matching on it. Anyone savvy with this module that could steer me in the right direction??? Thanks Jason -- https://mail.python.org/mailman/listinfo/python-list

View committed code via gitpython

2016-07-01 Thread Jason Bailey
regex matching on it. Anyone savvy with this module that could steer me in the right direction??? Thanks Jason -- https://mail.python.org/mailman/listinfo/python-list

Re: python parsing suggestion

2016-05-30 Thread Jason Friedman
> > Trying to extract the '1,1,114688:8192' pattern form the below output. > > pdb>stdout: > '3aae5d0-1: Parent Block for 1,1,19169280:8192 (block 1,1,114688:8192) > --\n3aae5d0-1: > magic 0xdeaff2fe mark_cookie > 0x\ngpal-3aae5d0-1: super.status > 3s

Re: How can I debug silent failure - print no output

2016-05-27 Thread Jason Friedman
> > def GetArgs(): > '''parse XML from command line''' > parser = argparse.ArgumentParser() > > parser.add_argument("path", nargs="+") > parser.add_argument('-e', '--extension', default='', > help='File extension to filter by.') > args = parser.parse_args

Re: Why online forums have bad behaviour (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?)

2016-05-12 Thread Jason Friedman
> TL;DR: because we're all human, and human behaviour needs either > immediate face-to-face feedback or social enforcement to correct > selfishness and abrasiveness. Where face-to-face feedback is lacking, > social enforcement needs to take more of the load. > > > Many people have a false sense of

The reason I uninstalled Python 3.5.1 (32-bit) for Windows

2016-04-12 Thread Jason Honeycutt
up at all. I'm going to try to download the 64-bit version and see if that helps. Kind Regards, Jason Honeycutt -- https://mail.python.org/mailman/listinfo/python-list

Re: Python,ping,csv

2016-04-11 Thread Jason Friedman
> I added a line. > I would need to put the output into a csv file which contained the > results of the hosts up and down. > Can you help me? > > import subprocess > from ipaddress import IPv4Network > for address in IPv4Network('10.24.59.0/24').hosts(): > a = str(address) > res = sub

Re: Python,ping,csv

2016-04-11 Thread Jason Friedman
> I added a line. > I would need to put the output into a csv file which contained the results > of the hosts up and down. > Can you help me? > > > import subprocess > from ipaddress import IPv4Network > for address in IPv4Network('10.24.59.0/24').hosts(): > a = str(address) > res =

Re: Python,ping,csv

2016-04-09 Thread Jason Friedman
> for ping in range(1,254): > address = "10.24.59." + str(ping) > res = subprocess.call(['ping', '-c', '3', address]) > if res == 0: > print ("ping to", address, "OK") > elif res == 2: > print ("no response from", address) > else: > print ("ping to", addr

Re: i cant seem to figure out the error

2016-04-03 Thread Jason Friedman
> def deposit(self, amount): > self.amount=amount > self.balance += amount > return self.balance > > > def withdraw(self, amount): > self.amount=amount > if(amount > self.balance): > return ("Amount greater than available balance.") > else: > self.balance -= amou

Re: i cant seem to figure out the error

2016-04-03 Thread Jason Friedman
> >- Create a method called `withdraw` that takes in cash withdrawal amount >and updates the balance accordingly. if amount is greater than balance >return `"invalid transaction"` > > def withdraw(self, amount): > self.amount=amount > if(amount > self.balance): > return

Re: Computational Chemistry Analysis

2016-02-28 Thread Jason Swails
aces to start. FWIW, I did all my work with the AMBER and OpenMM software suites, (and wrote a substantial amount of code for both projects). But those are far from the only options out there. HTH, Jason -- Jason M. Swails BioMaPS, Rutgers University Postdoctoral Researcher -- https://mail.python.org/mailman/listinfo/python-list

Re: [Off-topic] Requests author discusses MentalHealthError exception

2016-02-27 Thread Jason Friedman
Yes, thank you for sharing. Stories from people we know, or know of, leads to normalization: mental illness is a routine illness like Type I diabetes or appendicitis. On Sat, Feb 27, 2016 at 2:37 AM, Steven D'Aprano wrote: > The author of Requests, Kenneth Reitz, discusses his recent recovery fr

Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO

2016-02-08 Thread Jason Swails
On Sun, Feb 7, 2016 at 2:58 AM, Chris Angelico wrote: > > Would writing a script to figure out whether there are more > statisticians or programmers be a statistician's job or a > programmer's? > ​Yes. -- https://mail.python.org/mailman/listinfo/python-list

Re: ts.plot() pandas: No plot!

2016-02-01 Thread Jason Swails
; to have all plots sent directly to the ipython console you are typing commands in. I've found that kind of workflow quite convenient for directly interacting with data. HTH, Jason -- https://mail.python.org/mailman/listinfo/python-list

Re: Why generators take long time?

2016-01-19 Thread Jason Swails
On Tue, Jan 19, 2016 at 3:19 PM, Jason Swails wrote: > > I use generator expressions when > > - I *might* want to > ​I forgot to finish my thought here. I use generator expressions when I don't want to worry about memory, there's a decent chance of short-circuiting​,

Re: Why generators take long time?

2016-01-19 Thread Jason Swails
adness to have code actually relying on this behavior :). At the end of the day, I use list comprehensions in the following circumstances: - I *know* I won't blow memory with a too-large list - I want to iterate over the object multiple times or I want/may want non-sequential access - I know

Re: What use of these _ prefix members?

2016-01-12 Thread Jason Swails
to implement directly is _process_arg1. This reduces code duplication and improves maintainability, and is a pattern I've used myself and like enough to use again (not necessarily in __init__, but outside of being automatically called during construction I don't see anything else inherently "specialer" about __init__ than any other method). All the best, Jason -- https://mail.python.org/mailman/listinfo/python-list

Re: Python and multiple user access via super cool fancy website

2015-12-25 Thread Jason Friedman
>> I have a hunch that you do not want to write the program, nor do you >> want to see exactly how a programmer would write it? >> >> The question is more like asking a heart surgeon how she performs >> heart surgery: you don't plan to do it yourself, but you want a >> general idea of how it is do

Re: Python and multiple user access via super cool fancy website

2015-12-24 Thread Jason Friedman
> I am not sure if this is the correct venue for my question, but I'd like to > submit my question just in case. I am not a programmer but I do have an > incredible interest in it, so please excuse my lack of understanding if my > question isn't very thorough. > > As an example, a website backend

Brief Code Review Please - Learning Python

2015-12-06 Thread Jason Alan Smith
me text\na new line", 23 "Segoe UI", 24 40, 25 "True")) Any and all feedback is much appreciated. As I said, I'm just beginning to learn Python and want to start off with a solid foundation. Thank you to everyone in advance for your time and thoughts. Jason -- https://mail.python.org/mailman/listinfo/python-list

Brief Code Review Please - Learning Python

2015-12-06 Thread Jason Alan Smith
me text\na new line", 23 "Segoe UI", 24 40, 25 "True")) Any and all feedback is much appreciated. As I said, I'm just beginning to learn Python and want to start off with a solid foundation. Thank you to everyone in advance for your time and thoughts. Jason -- https://mail.python.org/mailman/listinfo/python-list

Re: Exclude text within quotation marks and words beginning with a capital letter

2015-12-04 Thread Jason Friedman
> > I am working on a program that is written in Python 2.7 to be compatible > with the POS tagger that I import from Pattern. The tagger identifies all > the nouns in a text. I need to exclude from the tagger any text that is > within quotation marks, and also any word that begins with an upper ca

Re: reading from a txt file

2015-11-26 Thread Jason Friedman
> > Hey, I'm wondering how to read individual strings in a text file. I can > read a text file by lines with .readlines() , > but I need to read specifically by strings, not including spaces. Thanks > in advance > How about: for a_string in open("/path/to/file").read().split(): print(a_stri

Re: What is the meaning of Py_INCREF a static PyTypeObject?

2015-11-12 Thread Jason Swails
ing NoddyType from the noddy namespace and Py_DECREFing it. Alternatively, doing import noddy noddy.NoddyType = 10 # rebind the name Then the original object NoddyType was pointing to will be DECREFed and NoddyType will point to an object taking the value of 10. HTH, Jason -- https://mail.python.org/mailman/listinfo/python-list

Re: teacher need help!

2015-10-18 Thread Jason Friedman
> Can I suggest you find the turtle.py module in c:\windows\system32, move it > to somewhere more suitable and try the code again? Or, copy it, rather than move it? It may be that for some students turtle.py is in a terrific place already. -- https://mail.python.org/mailman/listinfo/python-list

Re: Stylistic question regarding no-op code and tests

2015-10-15 Thread Jason Swails
On Wed, Oct 14, 2015 at 10:07 PM, Ben Finney wrote: > Jason Swails writes: > > > What I recently realized, though, that what this construct allows is > > for the coverage testing package (which I have recently started > > employing for my project... thanks Ned and ot

Stylistic question regarding no-op code and tests

2015-10-14 Thread Jason Swails
ou are not >100% sure is well-covered in your test suite, but that your first instinct should be to avoid such code. What do you think? Thanks! Jason -- Jason M. Swails BioMaPS, Rutgers University Postdoctoral Researcher -- https://mail.python.org/mailman/listinfo/python-list

Re: Strong typing implementation for Python

2015-10-12 Thread Jason Swails
he most computationally intensive kernels do (which themselves are small portions of the main simulation engines!). Performance only matters when it allows you to do something that you otherwise couldn't. pypy makes some things possible that otherwise wasn't, but there's a reas

Re: Script To Remove Files Made Either By Python Or Git

2015-10-09 Thread Jason Swails
t directory of a git repo (and recursively all subdirectories). You can optionally specify a directory at the end of that command. Careful with this sledgehammer, though, as it will also trash any untracked source code files as well (and you may never get them back). HTH, Jason -- https://mai

Re: netcdf read

2015-09-01 Thread Jason Swails
tcdf4' is not defined > > > > > > What can I do to solve this. > > My crystal ball tells me you're probably running Windows. > ​Or Mac OS X. Unless you go out of your way to specify otherwise, the default OS X filesystem is case-insensitive. All the best, Jason -- https://mail.python.org/mailman/listinfo/python-list

Re: problem with netCDF4 OpenDAP

2015-08-14 Thread Jason Swails
uffix for some reason (not sure if the server redirected the request there or not). But this looks like a netCDF4 issue. Perhaps you can go to their project page on Github and file an issue there -- they will be more likely to have your answer than people here. HTH, Jason > > an

Re: problem with netCDF4 OpenDAP

2015-08-13 Thread Jason Swails
URLs are not files and cannot be opened like normal files. netCDF4 *requires* a local file as far as I can tell. All the best, Jason -- Jason M. Swails BioMaPS, Rutgers University Postdoctoral Researcher -- https://mail.python.org/mailman/listinfo/python-list

Re: How Do I ............?

2015-07-31 Thread Jason Swails
wer your question, then provide enough information so that someone can actually figure out what went wrong ;).​ HTH, Jason -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to install ALL Python packages?

2015-07-22 Thread Jason Swails
and even Fortran libraries), conda blows pip out of the water.​ There are other solutions (like Enthought's Canopy distribution, for example), but conda is so nice that I really have little incentive to try others. All the best, Jason -- https://mail.python.org/mailman/listinfo/python-list

Re: Should non-security 2.7 bugs be fixed?

2015-07-22 Thread Jason Swails
#x27;t switch" are not only wrong, but in actuality counter-productive. Apologies for the novel, Jason On Sat, Jul 18, 2015 at 7:36 PM, Terry Reedy wrote: > I asked the following as an off-topic aside in a reply on another thread. > I got one response which presented a point I had

Address field [was: Integers with leading zeroes]

2015-07-21 Thread Jason Friedman
> Of course, most of the > time, I advocate a single multi-line text field "Address", and let > people key them in free-form. No postcode field whatsoever. I'm curious about that statement. I could see accepting input as you describe above, but I'm thinking you'd want to *store* a postcode field.

Re: Noob in Python. Problem with fairly simple test case

2015-07-21 Thread Jason P.
El miércoles, 15 de julio de 2015, 14:12:08 (UTC+2), Chris Angelico escribió: > On Wed, Jul 15, 2015 at 9:44 PM, Jason P. wrote: > > I can't understand very well what's happening. It seems that the main > > thread gets blocked listening to the web server. My intent

Re: linux os.rename() not an actual rename?

2015-07-20 Thread Jason H
> From: "Christian Heimes" > On 2015-07-20 20:50, Marko Rauhamaa wrote: > > "Jason H" : > > > >> I have a server process that looks (watches via inotify) for files to > >> be moved (renamed) into a particular directory from elsewhere

linux os.rename() not an actual rename?

2015-07-20 Thread Jason H
I have a server process that looks (watches via inotify) for files to be moved (renamed) into a particular directory from elsewhere on the same filesystem. We do this because it is an atomic operation, and our server process can see the modify events of the file being written before it is close

Noob in Python. Problem with fairly simple test case

2015-07-15 Thread Jason P.
Hi all! I'm working in a little Python exercise with testing since the beginning. So far I'm with my first end to end test (not even finished yet) trying to: 1) Launch a development web server linked to a demo app that just returns 'Hello World!' 2) Make a GET request successfully I can't un

Re: bottle app "crashes"

2015-07-06 Thread Jason Friedman
> Last summer I fumbled together a small appplication that calculates both LASK > and Elo ratings for chess. I managed to "webify" it using Bottle. This works > nicely on my laptop for testing. > > Once I log off (or my user session times out) my server where I've started the > application with pyt

Re: Bug in floating point multiplication

2015-07-06 Thread Jason Swails
On Mon, Jul 6, 2015 at 11:44 AM, Oscar Benjamin wrote: > On Sat, 4 Jul 2015 at 02:12 Jason Swails wrote: > >> On Fri, Jul 3, 2015 at 11:13 AM, Oscar Benjamin < >> oscar.j.benja...@gmail.com> wrote: >> >>> On 2 July 2015 at 18:29, Jason Swails wrote: >

Re: Should iPython Notebook replace Idle

2015-07-03 Thread Jason Swails
trictions on a library. If the IPython team agreed to release their tools with the stdlib instead of IDLE, they'd have to give up a lot of control over their project: - License - Release schedule - Development environment Everything gets swallowed into Python. I can't imagine this ever

Re: Bug in floating point multiplication

2015-07-03 Thread Jason Swails
On Fri, Jul 3, 2015 at 11:13 AM, Oscar Benjamin wrote: > On 2 July 2015 at 18:29, Jason Swails wrote: > > > > As others have suggested, this is almost certainly a 32-bit vs. 64-bit > > issue. Consider the following C program: > > > > // maths.h > > #

Re: Bug in floating point multiplication

2015-07-02 Thread Jason Swails
hs.c swails@batman ~/test $ ./a.out swails@batman ~/test $ gcc -m32 maths.c swails@batman ~/test $ ./a.out 2049 That this happens at the C level in 32-bit mode is highly suggestive, I think, since I believe these are the actual machine ops that CPython float maths execute under the hood. All the best, Jason -- https://mail.python.org/mailman/listinfo/python-list

Re: Classic OOP in Python

2015-06-18 Thread Jason P.
El miércoles, 17 de junio de 2015, 22:39:31 (UTC+2), Marko Rauhamaa escribió: > Ned Batchelder : > > > TDD is about writing tests as a way to design the best system, and > > putting testing at the center of your development workflow. It works > > great with Python even without interfaces. > > I

Re: Classic OOP in Python

2015-06-18 Thread Jason P.
El miércoles, 17 de junio de 2015, 21:44:51 (UTC+2), Ned Batchelder escribió: > On Wednesday, June 17, 2015 at 3:21:32 PM UTC-4, Jason P. wrote: > > Hello Python community. > > > > I come from a classic background in what refers to OOP. Mostly Java and PHP > > (&

Re: Classic OOP in Python

2015-06-18 Thread Jason P.
El miércoles, 17 de junio de 2015, 21:44:51 (UTC+2), Ned Batchelder escribió: > On Wednesday, June 17, 2015 at 3:21:32 PM UTC-4, Jason P. wrote: > > Hello Python community. > > > > I come from a classic background in what refers to OOP. Mostly Java and PHP > > (&

Classic OOP in Python

2015-06-17 Thread Jason P.
Hello Python community. I come from a classic background in what refers to OOP. Mostly Java and PHP (> 5.3). I'm used to abstract classes, interfaces, access modifiers and so on. Don't get me wrong. I know that despite the differences Python is fully object oriented. My point is, do you know an

Re: Memory error while using pandas dataframe

2015-06-10 Thread Jason Swails
l "seek(0)" on that instead. That might work. Otherwise, you should be more specific with your question and provide a full segment of code that is as small as possible to reproduce the error you're seeing. HTH, Jason -- https://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   9   10   >