« first day (3603 days earlier)      last day (1360 days later) » 

2:07 AM
@roganjosh I'm working on some optimisations. Is there some way I can (inside an executemany) take insert a row, then take that row's primary key and use it in the next statement, rather than using cursor.lastrowid and making multiple db calls?
 
 
1 hour later…
3:30 AM
I have a private Python package on Github that I think I've updated to a new release and want installed on a VM. Every time I try to run pip install my-private-package==0.9.12 I get this error: ERROR: Could not find a version that satisfies the requirement my-private-repo==0.9.12 (from versions: none)
I know it's not strictly a Python question but how do I make sure the newest version was actually published on Github and it's installable from another machine?
 
3:49 AM
in order for a package to be pip installable, it needs to be on PyPI. Plus, it'll need a setup.py. Read this
 
got it. Took a quick look and the repo follows that setup.py format
how do I update it on PyPI for a private repo?
 
 
2 hours later…
5:47 AM
cbg
 
6:02 AM
I think I've spent too much time with Elixir:
In [55]: a = mpy.magic("""
    ...: import ast
    ...:
    ...: from mpy import macro
    ...:
    ...: @macro
    ...: def foo(a):
    ...:     print("got", ast.dump(a))
    ...:     return ast.BinOp(left=a.left, op=ast.Sub(), right=a.right)
    ...:
    ...: x, y = 1, 2
    ...: print(foo(x + y))
    ...: """)
got BinOp(left=Name(id='x', ctx=Load()), op=Add(), right=Name(id='y', ctx=Load()))

In [56]: exec(compile(a, "", "exec"))
-1
 
6:24 AM
hi
 
 
2 hours later…
8:33 AM
@toonarmycaptain where am I looking, sorry? I might not be the best person for this
 
9:20 AM
cbg all
 
9:47 AM
@simplycoding Do you mean you want PyPI to serve private information? Don't do that - it's a public utility! You really need to set up a private warehouse and configure pip to use it as a preferred source.
[That's just one example - a search for "private pypi" will yield much information, quite a lot of it out of date.
 
10:12 AM
@simplycoding nonono, you don't need pypi at all to install it (cc @inspectorG4dget)
you can install from github, or from a local directory
and setup.py is optional these days, you can also use pyproject.toml (I don't know how, never used it, I only have two simple projects that are installable and they have very trivial setup.pys)
 
10:41 AM
@simplycoding what @AndrasDeak says is true. You can tag your versions in the repo, and download a tagged version to give you configuration control.
@AndrasDeak I only came across pyproject.toml when I started using poetry - I found the whole setup much easier to handle than the traditional setuptools-based workflow. I know the idea is for all Python tooling to consult it eventually, but I'm not sure how widespread its use is at present.
 
11:12 AM
pyproject.toml + flit is really convenient for standard packages. Can recommend.
It seems like many non-packaging tools are hesitating to transition to pyproject.toml, though. See the flake8 showstoppers, for example.
 
11:24 AM
Hey guys I was trying to apply the `yield from` keyword in this short snippet below,

        def gen_factorial(n):
            if n == 1:
                yield 1
            else:
                for u in gen_factorial(n - 1):
                    yield u
                yield u * n

    def gen_factorial2(n):
        s = 1
        if n == 1:
            yield 1
        else:
            yield from gen_factorial2(n - 1) * n

Do you guys got any ideas, if it's possible to do this?
 
11:35 AM
@solid.py what happens when you run that?
 
@AndrasDeak well I get this error, unsupported operand type(s) for *: 'generator' and 'int'
 
@MisterMiyagi The introduction of pyproject.toml was much talked-about in dev land, but I think it took the user world rather by surprise. I wasn't personally convinced of the need for TOML, but accepted it as the price of using poetry.
 
@solid.py indeed. That means that gen_factorial12(n-1) * n` itself is an error, and you never reach yield from. If you get an actual iterable there, yield from will work.
so the job is to construct an iterable that contains (or yields) the elements you want
 
@AndrasDeak If I made an iterable(e.g a list) holding the previous n-1 values, wouldn't that defeat the purpose of using a generator?
 
question about python-dotenv, if I have a .env file in my directory do the variables get automatically read ?
variables in that file
 
11:54 AM
    def gen_factorial2(n):
        if n == 1:
            yield 1
        else:
            yield from (i*n for i in gen_factorial2(n-1) for j in range(1, i))
@AndrasDeak I managed to write it, with some effort, I still don't fully comprehend why it works the same as `gen_factorial().
 
12:21 PM
@Amundsen no, you need load_dotenv
Though if you're talking about Flask (and possibly other libraries) I think it does a sweep on its own for .env files when you initiate an app. In which case, having python-dotenv installed would make it seem as though it was the case
 
@roganjosh seems I dont need a load_dotenv for flask
 
You don't need it. But I'm pretty sure it checks to see if you have it installed and, if you do, it will run helper methods. I'll have to recheck the repo but I have to head out quickly just now
 
Do do i inherit the functions of other class, i have tried this but it's not working
 
12:36 PM
@Raghav def __int__ is missing a letter...
 
@AndrasDeak I'm sorry
 
it's alright
 
@AndrasDeak whoa! I learn something new every day
 
1:06 PM
@roganjosh Nowhere to look. If I'm inserting a person's data into my person table, then I want to use that new person.id when I insert something else into a something_else table, in sqlite I use cursor.lastrowid to get person.id for the foreign key. Can I do that in one sql/cursor.execute/executemany action?
 
@solid.py I wouldn't expect it to work the same. In gen_factorial you don't multiply by n in the loop.
 
@solid.py You might be looking for a generator return.
def gen_factorial2(n):
    if n == 1:
        yield 1
        return 1
    else:
        last = (yield from gen_factorial2(n - 1)) * n
        yield last
        return last
That is an uncommon pattern though, to say the least.
It is more common to use generators for corecursion instead of recursion. See en.wikipedia.org/wiki/Corecursion
 
@roganjosh I'm trying to take this and slim it down in terms of db accesses. Each student w/avatar needs an avatar_id from the previous transaction, and all of them need the class.id from the first.
 
def gen_factorial3():
    step, factorial = 1, 1
    while True:
        yield factorial
        step += 1
        factorial *= step
@holdenweb I'm mostly happy about the declarative approach leading to one, clear way to describe packages (well, mostly...). The imperative approach of setup.py seems to beg for workarounds and hacks.
TOML is meh for me – I see the points they made, but in practice TOML seems a bit immature.
 
1:22 PM
cbg, yall
 
@toonarmycaptain I suspect you might be splitting hairs
Each transaction looks to be a single user? executemany isn't for altering multiple tables but repeated actions on the same table. Are you planning to pass a list to the function?
 
1:40 PM
@MisterMiyagi oof... too close to black magic
 
@AndrasDeak Distinctly octarine, if you don't mind me being pedantic.
 
@toonarmycaptain what's more, you still have to touch the database to get the auto-incremented ID key, so I'm not sure it can be cleanly done in a single transaction. It's perhaps possible but my SQL knowledge dries up for that
 
@inspectorG4dget sorry to keep correcting you, but we also have cv-pls rules that ask for a 10-minute grace period for salvageable questions :)
 
It's clearly been a while since I've been around these parts. Thank you for setting me straight. I should probably throttle my trigger finger
 
1:52 PM
Yeah, you watch it you eyes
 
it's a dupe
 
actually useful question: when you guys provision a new computer, what's on the list of software you install first? This list could include things like favorite mail client, browser, etc. A slightly different reading of the same question: when you set up a new project, what are the python packages you first install before you start writing your code
 
I rarely do the above. I install on-demand to minimise my attack surface where possible
For my environment it's generally: "new browser, pycharm"
 
Trying to recall what I installed on my most recent computer... Firefox, Chrome, Notepad++, Python, Steam, Keepass, Simon Tatham's Portable Puzzle Collection
 
@inspectorG4dget ubuntu -> firefox -> jetbrains ecosystem -> qgis -> GIMP -> spotify -> vim -> open drone map
 
2:02 PM
I have a file called to_install_for_me that I peruse when I set up a new system
 
Followed by several weeks of incidents of, "I need to do X, did I install X-Doer yet? No? I'll install it then"
My goal was not to eliminate the possibility of such incidents, but to reduce their frequency to a sane level for the first few days. I think I struck a good balance.
 
damn! I feel bloated by comparison: oh-my-zsh + agnoster + my custom shell aliases/functions, vim. Mail client (mail.app or Outlook/Thunderbird), RSS viewer. Firefox/Chrome + Instapaper&Mendeley importer bookmarklets. Pyenv + python 3.4/6/8, venv, ipython (which pulls all the data science stuff), colorama, pafy, tqdm (+my customization patch), Amethyst (if OSX)
@Dodge ODM looks pretty awesome. Do you do a lot of drone/image work?
 
My mail and RSS clients are websites, so no installation needed there for me
 
@inspectorG4dget Yes, I fly a drone 3 times a week on average
 
I'd love to hear more. Phantom 3? Mavic? What's in your standard kit? Do you have a "hangar" at home for continuous charging, maintenance, etc? Thoughts on which cameras to use? Ever build anything custom? I could go on for a while
 
2:16 PM
The ODM/QGIS/Python(keras, tf, numpy, ...) stack is extremely powerful. Mavic 2 pro currently but I flew a P4Pro for two years. Charging is trivial. With DJI maintenance is minimal. I don't use RTK devices for every flight, rather manually georeference my composites or use GCPs or reference to a preseason RTK layer. Cheap drones generally. Never built my own and probably not worth the time.
 
My workflow centers around high volume, frequent flights to monitor crops across a range of experimental interests rather than single, point-in-time, super-precise mapping missions. As high speed internet access becomes ubiquitous I think these two workflows will converge, however
@inspectorG4dget What is your area of expertise?
 
pancakes
 
@AndrasDeak is that just a wild coincidence, or do you know that to be my nickname?
 
I do :P
 
2:22 PM
It is known
 
I could even spell your name by heart
 
@AndrasDeak I would be impressed and very touched
@Dodge I'm just your average AI guy. My last big work was on fusing multiple data sources to enrich the dataset before running classifiers to solve the problem
 
but probably not pronounce it correctly :D
 
@toonarmycaptain That's the kind of thing that many people resort to tricksy SQL stored procedures and the like for. The purpose of cursor.executemany is to iterate over a set of tuples, performing the same (prepared) SQL statement on each one.
 
@inspectorG4dget And you are currently working with AI?
 
2:30 PM
@Dodge just started a new position. So, not as much AI just yet - more just setting up basic automation with some run-of-the-mill software engineering. The more interesting AI is just over the horizon of the next couple of sprints (I hope and trust)
 
Are there software engineers who never write code? Like an architect doesn't hammer nails.
Or is software engineer another way to say programmer? I read that term often.
 
while I do do a bunch of software eng, I'm actually not an engineer. I'm trained as a computer scientist which (a) does not legally allow me to call myself an engineer and (b) means that I'm more focused on designing solutions and doing research/benchmarks, rather than planning sprints etc. That latter point is why it's quite hilarious that I'm doing exactly that right now
 
legally?
 
yup. At least in Canada (where I live), Engineer is a professional classification, which would require me to pay association dues, etc, and to have the actual accreditation
 
2:42 PM
most people won't see much of a difference between comp.sci. and software eng, but I cannot justify (forget even the legal aspect of things) calling myself an engineer, because I don't know how to do sprint planning and couldn't even list the different dev methodologies (I know of agile and waterfall; that's pretty much it)
 
Just use 50% more comments to account for factor of safety and you're set with engineering
 
yet on the other hand, I feel like all computer scientists need to wear an engineer's hat from time to time and vice versa. I guess it's kinda like an architect being better at their job if they've ever nailed two pieces of wood together
 
Interesting. I wasn't aware that the term was regulated; In the UK I used to be a member of IChemE but that has since lapsed. But it wasn't a legal requirement to be able to call myself an engineer. Huh, TIL
 
heh! That's one thing I find that I'm doing more of, these days
 
1 demerit to Wikipedia for vaguely indicating that states including but not limited to Texas and Florida have introduced a licensing program for software engineers
 
2:45 PM
@roganjosh it varies a lot with country. Netherlands are also crazy pedantic about qualifications, it affects how you can and will be addressed etc.
 
At one point I had collected a number of letters after my name, usually by doing nothing but paying money on top of my degree. I can't even remember what the others were, now :)
 
Since the list is not exhaustive and no citations are given, I have no easy way of determining what licensing is required of me in the NJ/PA area
 
@roganjosh I was AMInstP for a while; took zero effort
 
cacm.acm.org/magazines/2014/7/… looks relevant for US engineers...
 
Same, I was an Associate of IChemE. To be fair, it was crucial if you wanted to progress because you can't get Chartered without them, and it was something like an immediate £5k uplift on pay grades if you got that (and also smashed a few ceilings regarding how high you could go professionally)
 
2:50 PM
> The [Fundamentals of Engineering exam required for licensure] comprises 180 multiple-choice questions and it is this exam that seems to cause the most resistance and fear when I discuss licensing. The morning session is the same for all engineering disciplines120 questions in mathematics, probability and statistics, chemistry, computers, ethics, business practice, economics, mechanics, strength of materials, material properties, fluid mechanics, electricity and magnetism, and thermodynamics.
Oh look, it's all the classes that made me drop out of the engineering track in college :-P
 
I was more or less grandfathered in to engineer status by virtue of membership of the BCS (now the chartered body for IT professionals in the UK), but I never sought the Eu.Eng. or whatever it is. But I am a Chartered IT Professional (CITP).
 
@Kevin ethics, eh?
 
The first rule of engineering, of course, is Know Your Sh*t.
 
I did take a philosophy of ethics class but all I learned is that you can't win an ethics debate using only knowledge gleaned from wikipedia pages on the trolley problem and the prisoner's dilemma
 
@holdenweb do you think I should be working towards chartership?
I don't know what it means in terms of this industry, only in chem. eng.
 
2:56 PM
The "evidence of good moral character" required to become an engineer is reminiscent of the JSMin custom license
 
Jun 25 at 10:13, by roganjosh
@JonClements Now that you've mentioned this, I'm reminded that, on more than one occasion, it was only half-jokingly suggested that I do this. I've seen it suggested that Chemical Engineers should take a Hippocratic Oath of some kind
 
@roganjosh That depends on your career goals, mostly. I recommend staff members become chartered if they can because that implies adherence to the chartered body's ethical standards. Also, such bodies often offer (usually through third parties) sensibly-priced professional indemnity insurance and access to legal advice.
 
PSA: there's new code block design on the main site for dark theme; looks nice
 
What are you supposed to do if you want to get into evil engineering? Presumably you need them if you want to, say, bulldoze an indigenous burial site to make room for an oil pipeline
 
Go work for Alphabet ... :P
 
2:59 PM
The context is around the message I linked :P Krokodil looked like a promising market
 
@holdenweb or IBM
 
Yeah, but they're establishment evil whereas alphabet is disruptive evil. Pick the lesser?
 
@roganjosh I believe this was addressed in one episode. He has periodic garage sales, frequented by men in black and alien warlords.
 
@holdenweb thanks, I'll take a look into it. It's not something I actually considered but if it's just based on work you're doing anyway, I might as well snag it (if I can) while going about daily life
 
@roganjosh Wouldn't recomend it: healthline.com/health/krokodil-desomorphine
 
3:02 PM
Exactly. Most of the side effects of Krokodil are from poor formulations that leave behind unreacted reagents. A Chemical Engineer wouldn't make such mistakes, and could still be price-competitive
 
@roganjosh Well right. One guy I recommended for BCS membership on the basis of his ten years of industry experience was surprised to find he was immediately accepted into the professional grades. You may be closer than you think.
 
Aanywho. I never did go into evil engineering. I used my powers for good :)
(mostly)
 
Sharks with fricking laser beams attached to their heads!
 
I'll look for you in the Breaking Bad sequel ...
 
3:05 PM
Yeah, well what do you expect when we have spy whales on the prowl?!
 
Maybe sharks just want to do the Michaelson-Morley experiment underwater :/
You guys are just very judgy
 
And that. That too. It was part of an educational program I set up for sharks
 
Upon review, it seems like the garage sale wasn't particularly profitable, and the bulk of the funding came from his sister's lottery winnings. That doesn't seem like a sustainable model.
 
Deedee is forever remembered for her sacrifice in the name of science, though
 
I suppose the laws of narrative causality in the Dexter's Lab universe could cause Deedee to win the lottery every month. One in a million shots succeed 99 out of 100 times, if it's convenient for the plot.
 
3:17 PM
@inspectorG4dget I've not used this site before. If I put really restrictive ranges in, is it going to chop up the options given to others to ensure 100% overlap?
 
@AndrasDeak Yargh. That's dark indeed.
 
For the best SO dark mode experience, turn your monitor off
11
 
I took the screenshots because they also messed with spacing to make it ugly
 
I don't know whether this existed before, but there's inconsistent rounding of corners in code blocks with the new theme and it's making things very difficult for me
Some are right angles and others are rounded. Gross.
Huh, old tab checks tell me that it always existed that way, it's just more dramatic to my eyes now :P
 
3:48 PM
solved the path issue with a mix of pathlib and os module. Thanks for all the help.
 
How can I convert a SymPy's symbol to a int type?
 
@Marco do you mean substituting an int value into a symbolic expression?
 
@AndrasDeak the opposite
 
Then please elaborate
>>> from sympy.abc import x
>>> (3*x + 2)
3*x + 2
>>> (3*x + 2).subs({'x': 3})
11
that's how I read your question
 
4:13 PM
If you think it doesn't work, come back with a complete example that doesn't work
@Marco the half hour of discussion I just trashed led nowhere. From what I can tell the code I posted above should do exactly what you want. If that's not the case come back with an unambiguous and executable example (not longer than 10 lines) so we can discuss without miscommunicating.
 
A generous offer! I was prepared to point him towards the main site.
 
generous and unwise :P
 
Most programmers spec into high int low wis, so it must be expected
 
I put everything into charisma. The results are obvious.
 
Beautifully indented O(N!) code
 
4:24 PM
@AndrasDeak Do as you see fit.
 
PHP programmers have to have a high constitution score in order to stomach the work required of them
 
4:41 PM
it does not do that. Everyone always sees the entire grid (what you see right now). I can choose to get a report whenever I'd like, which shows all "works for everyone" slots, as well as annotations on each slot that show conflicts.

Currently, there is no "works for everyone" slot.

I should really post a publicly accessible version of this with gDrive or such - tonight! It'll be as up-to-date as I download it... maybe I can automate this with requests
 
I might be imagining things then cos I don't think I got the same offering just now that I got when I originally loaded it
Even so, it's a shame there's no "works for everyone" before I submit my times :/
 
wim
@AnttiHaapala Yep, I quite like those new APIs. I wonder if zipfile.Path was added in 3.8 specifically for the resources purpose- it's not there in 3.7. Now I just need to get through to this user that they're confused about what a namespace package means, but I don't know how I can explain it any more clearly!
 
It might be worth considering kicking it back by a few weeks and just dictating a time?
 
that's one mess of a Q&A
 
@roganjosh I will take your recommendation on this, given that you have much more experience planning Room6 meetings and such. Could I therefore ask you to please send that message into rotating knives?
 
4:51 PM
@inspectorG4dget Please don't just defer it to me. This is your initiative and you can't just take my word for it :) I'm just thinking that it might be easier if you cast the horizon a bit further
 
stackoverflow.com/q/57835937 duplicate, lack of tags prevented hammer
 
5:30 PM
@roganjosh Or alternatively we get a little more pragmatic and settle for one of the times that suit the largest number of those expressing an opinion? I understand that's a traditional way of solving matters in the absence of consensus ... :)
 
@holdenweb The state of play
I think it's going to get kicked back by a few weeks at least
 
6:16 PM
Huh, there's now an "edit tags" hyperlink on questions
 
congratz on 10k (:
 
Kapow, 10K. I limped over the finish-line with an extra 2 rep to spare for revenge downvotes on me
Thanks :)
 
So do you lose the privs if I go on a downvoting spree? "Nice rep you got there, it would be a dreadful shame if it were t go back to 4 digits, don't you think [slaps cosh into palm of hand].
Congratulations anyway!
 
@holdenweb you have one downvote at your disposal :P thanks :)
 
6:21 PM
congrats, Josh! just two more zeros now, to catch up with Him... and Him
 
Now why would I do that to a nice guy like you?
 
@NIKHILCHANDRAROY cabbage
 
I want to use template {% (item.symbol).replace("|", "<br>") %} like this way at django project the item.symbol came from json but I want to remplate "|"
replace "|"
but I have no idea how can I use it, I am new at django
 
I'm not a Django guy but I don't like the idea of this being done on the frontend
 
I'd recommend starting out with some sample input. Then the code that you currently have, along with the output it provides. Followed by your desired output, and a short discussion of how it differs from your current output.
Once you have all these things, head over to stackoverflow.com and post it as a question and I'd be very surprised if you don't get a meaningful reply soon.

That's the best I can do right now, given that I don't know Django either
 
6:35 PM
import sympy.printing as printing
from IPython.display import display, Math, Latex
from sympy import *
from mpmath import *
from sympy.codegen.ast import aug_assign, For

init_printing()

c, d, c_max, d_max, jzeros = symbols("c d c_max d_max jzeros")

d_max.subs(d_max, 3)
c_max.subs(c_max, 3)

For(d, Range(d_max.subs(d_max, 3)), [jzeros.subs(jzeros, besseljzero(d, c_max))])

Why do I get this error (TypeError: cannot create mpf from d) when I execute the above code? I am trying to code according to this "For" documentation:
 
7:24 PM
@Marco can you explain what you're trying to do? Are you really trying to generate code for some other language? Just making sure that this is not an XY problem.
 
Just converting a simple python "for" to a sympy "For" structure.
 
But... why? a "sympy For structure" is not a thing that people normally use. which the sympy.codegen.ast chain should demonstrate
Most people don't need that at all, which is why I'm asking if you're sure you need it.
Looking at the things you're using (Bessel functions for instance) I'd find it a lot more likely that you really need symbolic Series instead
(side note: the star imports don't help with debugging, you should probably use explicit imports for your own sake)
 
Because it's a exercise of my graduate, I need to do it in symbolic math (SymPy).
 
OK, but what is "it" that you have to do? Write up a formal sum? For that you don't need such trickery.
Anyway, that's all I can offer
 
I want to code below code in SymPy.
"""
Calculate the frequencies of the vibration modes of a circular
membrane (drum head, etc)
"""

from scipy.special import jn_zeros  # Finds the zeros of the Bessel function

d_max = 8  # Number of diametric nodes to calculate
c_max = 3  # Number of circular nodes to calculate

modes = {}

fundamental = jn_zeros(0, 1)[0]

for d in range(d_max):
    zeros = jn_zeros(d, c_max)
    for c in range(c_max):
        modes.update({(d, c+1): zeros[c] / fundamental})

# Print the modes sorted by frequency
Don't mind the whole code, I just put that code in because you asked.
 
7:39 PM
Why does that need Sympy?
 
@roganjosh Because my teacher wants.
 
mm, ok. I guess we're getting closer to the root source
 
I'd like to say "you must've misunderstood the assignment", but the sad part is that I know teachers who would assign this kind of homework...
 
haha
But, again, don't mind the whole code, I just want it (chat.stackoverflow.com/transcript/message/50324447#50324447) to get work.
 
@Marco OK, so what I'd do is define a symbol for jn_zeros
>>> import sympy as sym
>>> jnz = sym.Function('jn_zeros')
>>> jnz
jn_zeros
>>> jnz(3, 4)
jn_zeros(3, 4)
 
7:45 PM
@Aran-Fey You mean it's a hard or weird assignment? Or both?
 
Then use that symbolic function in basically the same python code. You will end up with a dict that has symbolic expressions for values.
 
I don't know if it's hard, but it's certainly weird
 
there's probably a way to substitute symbolic functions with numerical functions, just like doing the same with scalar symbols and numbers
 
I posted this question at SO: stackoverflow.com/questions/63622424/…
 
OK, you'll at least get an answer for the XY problem ;)
 
7:48 PM
What is a XY problem?
Sorry
 
It's when you have a problem, and accidentally transform it into a different problem using some assumptions, and then try to solve the new (worse) problem instead of targetting the original.
 
@Aran-Fey Yeah
@AndrasDeak It seems a bit weird.
 
The original task is weird (and probably pointless). Your transformed task going deep into sympy's black magic modules is super weird :)
 
hahahaha
 
@Marco besseljzero(d, c_max) will actually run besseljzero.
 
7:52 PM
@AndrasDeak Yeah, maybe there's a simpler solution than mine.
@MisterMiyagi Yes.
@MisterMiyagi What's your inquiry?
 
That was not an inquiry.
 
@AndrasDeak What do you have against sympy's black magic modules? :)
 
You are mixing AST of expressions and execution of expressions.
 
@MisterMiyagi How it should be? The code between [] is the code to be executed in For, right?
 
hi friends. can i have a question please?
ask*
 
7:58 PM
@ArdaAltun Hi. Yes, just ask it.
 
@Marco But you are not supplying code. besseljzero(d, c_max) isn't code.
 
i made a game in pygame, and i also created a highscore file to save the highscores, but it doesnt work if i dont close the app. i mean everything works perfect but when i die in the game, the end screen comes with 2 options, go to menu to play again and exit, if you click menu, the high score is still the old one. but if you quit and re-open the app, the highscore is changed. how can i change the highscore without quitting the app?
 
@MisterMiyagi it's the code I want to be executed in this for...
I mean
 
@Marco Then you must supply it as code!
You must tell sympy to include the AST of besseljzero(d, c_max), not tell Python to execute besseljzero(d, c_max) .
 
@MisterMiyagi I want that the return value of this function (besseljzero(d, c_max)) be assigned to "jzeros" symbol.
@MisterMiyagi jzeros.subs(jzeros, besseljzero(d, c_max))
 
8:03 PM
How so? What should besseljzero(d, c_max) even be? d has no value at this point.
 
@MisterMiyagi "d" must start at 0, on the first run. Maybe I should initially assign 0 to "d" in some way?
 
I think you should initially understand what an AST is, and how representing and evaluating code differs.
 
@MisterMiyagi So could you help me understand it?
 
8:21 PM
@ArdaAltun There's not enough info; you need to tell us what your persistence is. Is it a file/database/other? How do you save the info?
@Marco I'm starting to think that you want a solver from scipy rather than sympy
 
@roganjosh what you mean?
 
You're saying that you have an initial value
 
@ArdaAltun It may be you only write the high scores at the end of your program, but you are somehow skipping that code. Maybe you need to write it out at the end of every game?
 
Well, "d" must be a initial value so that the For/Range is executed.
 
@Marco What you are trying to build is a representation of instructions, e.g. ['a', '+', 'b']. What you are building instead is the evaluation of instructions, e.g. a + b.
The TypeError is from mixing the two, because you are feeding the representation of a variable to an evaluation using that variable. So if representation were ['a', '+', 'b'], and evaluation were a + b, then you are doing 'a' + b.
 
8:31 PM
@NIKHILCHANDRAROY The normal way to do this in the template would be with so-called filter functions, but Django doesn't seem to offer a general replace one. You are close to being able to use linebreak or linebreaksbr
It seems that the best solution is indeed to transform the string in your Pythion code before the value is passed to the template context.
 
@MisterMiyagi I think I got it. So the "For" won't do what "for" does? How should be?
 
No, no, no, this is unrelated to the For!
besseljzero(d, c_max) is a mix of representation (d and c_max) and evaluation (besseljzero(...)).
Your code never makes it to the For
 
@MisterMiyagi I understand now.
Like integrate (evaluation) != Integral (representation), at SymPy
I should put in the code a besseljzero() representation, no evaluation.
but I believe that it should not exist.
it seems that everything in For must be representative, nothing should be evaluative.
 
9:22 PM
NameError: name 'FutureSession' is not defined. I've been away too long from requests-sessions :/
I can fix the typo and then hit other issues. Grr, arg, trying to keep on top of everything. Juggling too much :)
nm, the error was on the import :P
 

« first day (3603 days earlier)      last day (1360 days later) »